Commit Graph

4312 Commits

Author SHA1 Message Date
Kartik Agaram
b8cfbdc866 4351 2018-07-16 07:55:07 -07:00
Kartik Agaram
1f56ac6483 4350
Reorganize layers to introduce the translation workflow right at the start.

We also avoid duplicating parsing code. Programs are always parsed into
the `program` data structure.
2018-07-15 22:59:02 -07:00
Kartik Agaram
e1fcc521be 4349 2018-07-15 22:29:01 -07:00
Kartik Agaram
8f64fc0a60 4348 2018-07-15 15:21:51 -07:00
Kartik Agaram
fc455c969d 4347 2018-07-15 15:13:31 -07:00
Kartik Agaram
6ec89428bc 4346 2018-07-15 15:09:48 -07:00
Kartik Agaram
3897140588 4345 2018-07-15 15:00:38 -07:00
Kartik Agaram
b06d827f90 4344 2018-07-15 09:15:45 -07:00
Kartik Agaram
aa6c342af9 4343
Let's minimize the alignment requirements of each segment's offset.
It'll make binaries take less room later. Otherwise we may need to pad
lots of 0s for segments after the first.

Generated ELF binaries continue to work natively (except ex4, but that
was already not working).
2018-07-14 10:43:34 -07:00
Kartik Agaram
6f812e6ea1 4342 2018-07-11 07:45:45 -07:00
Kartik Agaram
262f6ea81b 4341 2018-07-10 22:39:46 -07:00
Kartik Agaram
39c0d1b1d5 4340
Start using data segments in scenarios.
2018-07-10 22:38:28 -07:00
Kartik Agaram
c8c5065869 4339 2018-07-10 22:17:11 -07:00
Kartik Agaram
1a48f95a87 4338 - preliminary support for data segments 2018-07-10 20:27:21 -07:00
Kartik Agaram
5e2e2eb5da 4337
Return to the usual whitespace-skipping istreams. No need to go beyond
word-based parsing.

This exercise reinforces the amount of duplication between
load_program() and transform_immediate().
2018-07-10 20:26:35 -07:00
Kartik Agaram
ced962dbf8 4336 2018-07-10 20:18:45 -07:00
Kartik Agaram
0fa9ccd15e 4335 2018-07-10 20:18:11 -07:00
Kartik Agaram
1f4d0aaf08 4334
Fix CI.
2018-07-10 07:18:36 -07:00
Kartik Agaram
5bb70d5e7f 4333
Fix a warning in CI.
2018-07-10 07:14:07 -07:00
Kartik Agaram
1ce67ba21b 4332
Minimize memory footprint while running subx ELF binaries. We don't use
memory before address 0x08048000, so we don't need to allocate space for
it.
2018-07-09 22:43:40 -07:00
Kartik Agaram
8291833d08 4331
Fix CI.
2018-07-08 23:00:15 -07:00
Kartik Agaram
43b170ea03 4330 - start allocating data/stack/heap segments
ex4 now writes to the (global) data segment, rather than trying to write
to the code segment.

We still need to specify the other segments in the generated ELF,
though.
2018-07-08 22:57:50 -07:00
Kartik Agaram
1e1eca1742 4329
Drop a safety net; we now assume that Memory is large enough for any
addresses we may encounter.

Dropping all comparisons with Mem.size() now makes our Memory_offset
indirection airtight.
2018-07-08 22:40:07 -07:00
Kartik Agaram
b0832f6676 4328
Insert an indirection to avoid over-allocating memory for RAM.
2018-07-08 22:35:48 -07:00
Kartik Agaram
665a4d7040 4327
Encapsulate RAM management.
2018-07-08 22:33:15 -07:00
Kartik Agaram
b0f89e4f9b 4326 - new example: read() from stdin
Currently only runs in emulated mode. Likely a paging issue, writing
data to code page. I'm not checking the return value.
2018-07-07 23:38:59 -07:00
Kartik Agaram
c90fa6534e 4325 2018-07-07 23:13:25 -07:00
Kartik Agaram
97a9bd1756 4324 - new example: add first ten numbers
Result has to be small enough to fit in AL so exit() can return it.
2018-07-07 14:31:56 -07:00
Kartik Agaram
bc394aaf39 4323 2018-07-07 13:54:16 -07:00
Kartik Agaram
bbd9c1f9ab 4322 2018-07-07 10:59:36 -07:00
Kartik Agaram
ebe2bda37b 4321
Modify helpers to run either external examples in the subx/teensy/
directory, or my own examples in subx/ directory.

Now I have to say `run test5` instead of `run 5`, and so on.
2018-07-07 10:57:56 -07:00
Kartik Agaram
37b3206e49 4320
Fix a few more typos in example programs.
2018-07-07 10:42:38 -07:00
Kartik Agaram
4bd643356f 4319 2018-07-07 09:36:24 -07:00
Kartik Agaram
486413fdde 4318
Simpler.

Now it's clear that what commit 4291 got wrong was an
alignment-violating address for both the entrypoint and the start of the
segment.
2018-07-06 23:38:33 -07:00
Kartik Agaram
a62f334c60 4317 - example program: simple addition 2018-07-06 23:34:10 -07:00
Kartik Agaram
517a471bc0 4316
Second attempt at commit 4291. We'll now not copy the headers into
memory, but we'll still allocate space for them. Still some security
benefits, and I'm gaining confidence that I understand the ELF format.
2018-07-06 23:33:42 -07:00
Kartik Agaram
21b5cf52e2 4315 2018-07-06 23:12:36 -07:00
Kartik Agaram
eca07d6a6b 4314 2018-07-06 22:50:30 -07:00
Kartik Agaram
f0b99910f3 4313 - some helpers for managing test binaries
I'm getting sick of hitting the <Tab> key.
2018-07-06 22:49:55 -07:00
Kartik Agaram
5f1de34a67 4312 - fix one of the test binaries 2018-07-06 22:48:08 -07:00
Kartik Agaram
c110018250 4311 - subx running binaries with global variables
Learning to use the data segment.

Currently, subx can only run the teensy files generated from flat
assembler:
  test4
  test5
  test7

This is not a priority to fix. These files are just useful references to
have around.
2018-07-03 16:36:37 -07:00
Kartik Agaram
c833fbad65 4310
Temporarily do all prints in hex.
2018-07-03 15:37:45 -07:00
Kartik Agaram
d2026fa73b 4309
Simplify a couple of test programs.
2018-07-03 15:06:53 -07:00
Kartik Agaram
0defd18cfc 4308
Undo 4291; turns out the generated ELF binary was no longer running
natively on 32-bit Linux. Even with p_align set to 0.

Agh, not worth my time.
2018-07-03 14:57:39 -07:00
Kartik Agaram
7c71860b87 4307
Undo 4306.
2018-07-03 10:06:07 -07:00
Kartik Agaram
c07651f8ec 4306 - architecture sketch
Doesn't compile.
I'm still not sure how to represent types and global variables.
Types won't be in the final binary.
But globals will. Perhaps I should first figure out what that looks like.
2018-07-02 22:16:22 -07:00
Kartik Agaram
50f59b4102 4305 2018-07-01 21:01:34 -07:00
Kartik Agaram
8ee9b7b7bd 4304 2018-07-01 11:25:39 -07:00
Kartik Agaram
863a42d360 4303 - subx: first real transform
We'll see if this is useful. Mostly just stretching our legs.
2018-07-01 00:04:11 -07:00
Kartik Agaram
fc5b5e3704 4302 - a more elaborate pass-through phase
Starting to work out the skeleton every phase needs to have.
2018-06-30 23:31:39 -07:00