| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Purge all traces of the old assumption that segment 0 is code and
segment 1 is data.
|
|
|
|
|
|
|
| |
Bugfix twelve: ModR/M was being incorrectly computed.
This is one of two problems with subx/examples/ex3, so no new passing
examples.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Inline some macro definitions.
|
|
|
|
| |
Drop some prints as a first step to straightening things out.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
| |
Stop hackily tracing function being called. Trying something better.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
| |
Bugfix: I forgot about ELF segment offsets when implementing VMAs. Eventually
segments grew large enough that I started seeing overlaps.
|
|
|
|
|
| |
There can be situations where a run is striding through a segment. Reduce
the number of reallocations that reallocations that requires.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Fix CI.
|
| |
|
| |
|
|
|
|
| |
Check for duplicate docstrings.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
subx: append to trace
|
| |
|
|
|
|
|
| |
Some syscalls expect null-terminated strings while others get lengths.
Be clear about this distinction.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Error messages if we ever get segments messed up.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|