| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One of the more painful things I had to debug with machine code. Tricks
I used can be seen in ex10.subx:
- printing argv[1] in various places
- printing a single 'X' in various places to count how many times we get
to different instructions
- exiting with the current value of EAX in various places
I repeatedly went down the wrong trail in several ways:
- forgetting that the problem lay in native runs, and accidentally switching
to subx runs during debugging.
- forgetting to pass commandline args, because ex10 doesn't check its argv
- writing the wrong comment for an instruction, and then miscalculating
the set of registers that need to be saved.
- forgetting that syscalls clobber EAX.
Debugging native runs is hard, because you have to write non-trivial code
to instrument the binary, and instrumentation can itself be buggy.
When we finally tracked it down, I recognized the problem immediately.
I'd meant to confirm the behavior of opcode 8a against bare metal, and
then forgot.
In any case, opcode 8a was inconsistent with 88. Sloppy.
|
| |
|
|
|
|
| |
subx/examples/ex10 doesn't currently run natively. Grr..
|
|
|
|
|
|
|
|
|
|
|
|
| |
Even more cuddling. We want to keep lines short where the opcode and operands
are self-explanatory.
If there are any implicit registers, etc., we'll continue to do the table
layout.
The first two columns look messy now; let's see how this goes.
Maybe I'll give up on the tabular layout altogether, just string args with
a single space.
|
|
|
|
|
| |
Since we're cuddling jump/call args next to the opcode, we can have longer
labels without messing up the layout!
|
|
|
|
|
|
|
|
|
|
|
|
| |
New example program: ascii null-terminated string comparison
I'd hoped this would be a stepping stone to supporting general ascii comparison,
but we're planning to use size-prefixed rather than null-terminated arrays
everywhere. The only exception is commandline arguments, which will remain
null-terminated to interoperate with Linux.
So I'm going to need separate functions for "compare with argv" and for
general string comparison.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
New example, just to fix in my head how arguments go on the stack.
It's possible I'm still confused about the order callers push args in to
the stack. But even if this violates the calling convention, it should
still run.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Get the 'edit' script working again with the 'EE' command in Vim.
|
|
|
|
|
|
|
|
|
| |
All it takes is to code-generate a simple function called 'run_tests' that
calls all functions starting with 'test_' one by one.
I've temporarily switched the factorial app to run as a test. But that's
temporary, because all the code to print '.' vs 'F' needs to get extracted
out into a helper.
|
|
|
|
|
| |
Neither jump nor call instructions support immediates. Drop that.
The only form of absolute addressing relies on rm32.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Start of a new example program.
|
|
|
|
|
| |
More useful trace if we mess up args to a syscall and pass a non-pointer
where a pointer is expected.
|
|
|
|
|
|
|
|
| |
Running reset() doesn't seem necessary so far for the translate sub-command,
but it's likely to expose us to weird bugs.
Immediately, it requires toggling `Dump_trace` in different places to print
traces while translating vs while running.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Bring Mu's trace harness in line with recent changes in SubX.
|
|
|
|
| |
Stale file since 4523.
|
|
|
|
|
|
|
|
| |
Attempt #3 at fixing CI.
In the process the feature gets a lot less half-baked.
Ridiculously misleading that we had `has_metadata()` was special-cased
to one specific transform. I suck.
|
|
|
|
|
|
|
| |
Really fix CI.
Also realized we don't need to worry about function pointers. They won't
be in /disp32 fields.
|
|
|
|
| |
Fix CI (`subx translate examples/ex6.subx examples/ex6`)
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Streamline the factorial function; we don't need to save a stack variable
into a register before operating on it. All instructions can take a stack
variable directly.
In the process we found two bugs:
a) Opcode f7 was not implemented correctly. It was internally consistent
but I'd never validated it against a natively running program. Turns out
it encodes multiple instructions, not just 'not'.
b) The way we look up imm32 operands was sometimes reading them before
disp8/disp32 operands.
|
| |
|