| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
| |
I'm still trying to figure out what the defaults should be. At the moment
you have to explicitly pass in every file you want loaded into the output
binary. Maybe that control is a good thing. The examples need no libraries
so far.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
Detect overlapping segments when loading SubX source code.
This will start to become more of a risk as we start loading multiple files,
juggling multiple segments, etc.
|
|
|
|
| |
Detect overlapping segments when loading ELF binaries.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Start requiring a '-o' flag to designate the output binary when translating.
Things currently get funky if you pass in multiple inputs, but that's ok.
This is the first step to supporting multiple input files for a single
output binary.
|
| |
|
|
|
|
|
| |
When I started SubX I imagined that being able to write machine code directly
was a feature. Now it's just a hole I haven't bothered closing yet.
|
|
|
|
| |
Error messages if we ever get segments messed up.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
It was broken since I added support for global variables, back on Sep 1.
One other subtle thing I've improved is the name `looks_like_hex_int`.
We can now distinguish in the pack-operands transform between ignoring
'foo' because it doesn't look like a number, and immediately flagging '0xfoo'
as an error because it *should* be a number.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
More calling convention tweaks.
Use EBP to get consistently at parameters and locals.
Always put the first function argument closest to EBP.
|
|
|
|
|
| |
New '--dump' commandline arg to incrementally print trace lines to stderr
as they're emitted.
|
|
|
|
| |
Get the calling convention right, per http://www.cs.virginia.edu/~evans/cs216/guides/x86.html
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Add the test harness to the crenshaw compiler. Though we aren't calling
it yet. But that's because we aren't actually doing anything useful yet.
|
|
|
|
| |
Back to the Crenshaw compiler. Start by using string literals.
|
|
|
|
| |
Upgrade the test harness for the factorial "app" from ex11.
|
|
|
|
|
|
|
|
| |
New helper: compare a null-terminated string (from argv) with a length-prefixed
string (anywhere else).
As long as ex11 continues to pass we can copy the function and its tests
to other programs.
|
|
|
|
|
|
|
|
|
|
|
|
| |
check_ints_equal now prints a newline after the failure message on failure.
We still don't know how to print a final newline after all the tests have
run, for the common case when all tests pass.
Ideally I could just emit a few instructions to `run_tests`. But I'd also
need to add a variable for the newline to the data segment. Or I need some
literal syntax for newlines in strings. We don't have support for backslash-escapes
yet.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extract a helper from the factorial unit test: check_ints_equal.
Start of a vocabulary for unit tests.
I *could* also start thinking of supporting multi-file programs, but I'm
going to resist the temptation for now. Copy helpers as necessary, and
allow them to mutate and diverge for a while before we pummel them into
a Procrustean "standard library". Extracting a body of shared code immediately
starts to discourage innovation in the shared code.
|
| |
|
|
|
|
| |
Include LEA (load effective address) in the SubX subset of x86 ISA.
|
|
|
|
|
|
|
|
|
|
| |
Doesn't de-duplicate in the data segment, though. If you use the literal
"foo" a hundred times in your code segment you're gonna spend a hundred
times the space you need to.
We can now simplify our test harness a bit in the factorial app, but we
still have to put in commandline args to compare with manually. We only
support length-prefixed strings, not null-terminated ones.
|
| |
|