about summary refs log tree commit diff stats
path: root/subx/010---vm.cc
Commit message (Collapse)AuthorAgeFilesLines
* 5471Kartik Agaram2019-07-251-11/+0
| | | | | Purge all traces of the old assumption that segment 0 is code and segment 1 is data.
* 5413Kartik Agaram2019-07-171-2/+0
| | | | | | | Bugfix twelve: ModR/M was being incorrectly computed. This is one of two problems with subx/examples/ex3, so no new passing examples.
* 5408Kartik Agaram2019-07-161-1/+5
| | | | | | | | | | | | Bugfix ten: type error in `convert`. I was calling `rewind-stream` on a `buffered-file`. examples/ex1 is now just one nibble off the canonical. I *have* found one missing feature in the self-hosted translator, though: dquotes doesn't support newlines in strings, even though the C++ version does. dquotes parses them right, but the value initialized in the data segment is wrong.
* 5405Kartik Agaram2019-07-151-2/+1
|
* .Kartik Agaram2019-07-091-6/+1
| | | | | | Stop dumping huge traces on error. We can always rerun with --trace. Though perhaps we should just dump the trace automatically on error. Not bothering thinking about that right now.
* CF needs special handling for some arithmetic opsKartik Agaram2019-05-121-34/+0
| | | | Inline some macro definitions.
* .Kartik Agaram2019-05-121-3/+0
| | | | Drop some prints as a first step to straightening things out.
* snapshot of carry flag implementationKartik Agaram2019-05-121-17/+31
| | | | | | | | | | | | | | | | | | Tests failing. This approach seems wrong. I'm not sure even the tests are correct. Also, some open questions: 1. Should setting the overflow flag always set the carry flag? 2. Should the carry flag only be set on add/subtract/compare, or by all arithmetic ops? 3. Had to turn off the -ftrapv flag in `build`. Is there a way to detect overflow without actually causing overflow? Once we start setting CF correctly we have to implement jump above/below instructions (8- and 32-bit displacement variants). https://github.com/akkartik/mu/issues/30
* 5133 - show instruction source in traceKartik Agaram2019-04-281-2/+2
| | | | | | | | | | It's a little hacky in some corner cases. In particular, if debug information isn't available the trace will contain duplicated lines. This is because I don't want the core trace lines all my tests rely on (introduced in the 'vm' layer) to have to know about debug info (introduced in the 'labels' and 'debug' layers). Thanks Charles Saternos for the feedback and suggestion!
* 5132Kartik Agaram2019-04-281-8/+1
| | | | Stop hackily tracing function being called. Trying something better.
* 5085 - 'assort' phase done!Kartik Agaram2019-04-121-1/+3
| | | | | | | | | | | | | | | | | Current plan for SubX translator: $ cat files.subx ... |assort |pack |survey |hex > a.out Higher-level notations will be inserted at the start of the pipeline. The first (and needed for bootstrapping) is for string literals. $ cat files.subx ... |string-literals |assort |pack |survey |hex > a.out Alternatively, we should check how often we use string literals and just convert them by hand. They're used all over in tests, and converting them would make tests hard (even harder) to read.
* 5060Kartik Agaram2019-04-061-0/+1
|
* 5016Kartik Agaram2019-03-221-1/+8
|
* 4987 - support `browse_trace` tool in SubXKartik Agaram2019-02-251-6/+24
| | | | | | | | | | | | | | | | | | I've extracted it into a separate binary, independent of my Mu prototype. I also cleaned up my tracing layer to be a little nicer. Major improvements: - Realized that incremental tracing really ought to be the default. And to minimize printing traces to screen. - Finally figured out how to combine layers and call stack frames in a single dimension of depth. The answer: optimize for the experience of `browse_trace`. Instructions occupy a range of depths based on their call stack frame, and minor details of an instruction lie one level deeper in each case. Other than that, I spent some time adjusting levels everywhere to make `browse_trace` useful.
* 4986 - spending some time improving SubX tracesKartik Agaram2019-02-231-6/+8
| | | | | | Now that our test runs are getting longer, debugging is again becoming a bottleneck. Time to start using trace depths along with `mu browse-trace` from the top-level.
* 4920Kartik Agaram2019-01-111-4/+4
|
* 4898Kartik Agaram2018-12-301-1/+1
|
* 4761Kartik Agaram2018-11-231-6/+5
| | | | | Bugfix: I forgot about ELF segment offsets when implementing VMAs. Eventually segments grew large enough that I started seeing overlaps.
* 4750Kartik Agaram2018-11-181-0/+4
| | | | | There can be situations where a run is striding through a segment. Reduce the number of reallocations that reallocations that requires.
* 4749 - speed up testsKartik Agaram2018-11-181-8/+14
| | | | | | | When we implemented 'read' our apps went over 0x1000 bytes, so I grew the initial segment size. But that slowed down emulation because each test was reallocating all segments. Now we allocate small segments at the start, and grow them gradually as needed.
* 4747 - subx: 'read' primitiveKartik Agaram2018-11-181-1/+1
|
* 4723Kartik Agaram2018-10-241-10/+1
| | | | Fix CI.
* 4719 - testable interface wrapping around exit()Kartik Agaram2018-10-241-0/+10
|
* 4695Kartik Agaram2018-10-141-10/+10
|
* 4694Kartik Agaram2018-10-131-1/+1
| | | | Check for duplicate docstrings.
* 4693Kartik Agaram2018-10-131-2/+3
| | | | | | | | Add the standard mnemonic for each opcode. We aren't ever going to have complete docs of the subset of the x86 ISA we support, so we need to help readers cross-correlate with the complete docs.
* 4692 - update online help for subxKartik Agaram2018-10-131-8/+32
| | | | | | It now includes details for 8-bit registers. And we'll just use the classic names for the registers so that the relationships between 8- and 32-bit versions are more obvious.
* 4678Kartik Agaram2018-10-101-0/+1
| | | | | | | | | A debugging aid: 'subx --map translate' dumps a mapping from functions to addresses to a file called "map", and 'subx --map run' loads the mapping in "map", augmenting debug traces. Let's see how much this helps. Debugging machine code has been pretty painful lately.
* 4674Kartik Agaram2018-10-081-5/+5
| | | | subx: append to trace
* 4666Kartik Agaram2018-10-051-1/+1
|
* 4665Kartik Agaram2018-10-051-1/+8
| | | | | Some syscalls expect null-terminated strings while others get lengths. Be clear about this distinction.
* 4658 - subx: string_equalKartik Agaram2018-10-021-2/+4
|
* 4635Kartik Agaram2018-10-011-3/+20
| | | | | | | | | | | Another sanity check. We don't really have a clear big picture yet. But I've now slapped on checks for all the issues I was worrying about. A more rigorous solution would be some sort of interval tree. We'd also need to track segments generated at translation time. We don't do that so far.
* 4621Kartik Agaram2018-09-301-15/+33
| | | | Error messages if we ever get segments messed up.
* 4617Kartik Agaram2018-09-291-2/+5
|
* 4614 - redo simulated RAMKartik Agaram2018-09-291-10/+74
| | | | | | | | | | | Now simulated 'Memory' isn't just a single flat array. Instead it knows about segments and VMAs. The code segment will always be first, and the data/heap segment will always be second. The brk() syscall knows about the data segment. One nice side-effect is that I no longer need to mess with Memory initialization regardless of where I place my segments.
* 4612Kartik Agaram2018-09-291-11/+16
|
* 4611Kartik Agaram2018-09-291-3/+4
|
* 4520 - several syscalls for filesKartik Agaram2018-08-131-0/+3
|
* 4498Kartik Agaram2018-08-091-0/+18
|
* 4482Kartik Agaram2018-08-041-0/+242