From aef4efb959b215a2cd830e186c083c78f7bde60a Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 15 Jul 2019 12:26:41 -0700 Subject: 5404 - subx/examples/ex1 now translating The result isn't an identical binary to before, and it segfaults when run. But it's bugfix seven. A couple of places where we make .subx files a little more strict: a) All .subx files must define a data segment. Even if they have no data. b) All .subx files must define an `Entry` label for the binary to start at. Earlier we used to default to the start of the code label. That's not too hard to add; we'd just need to: i) rename `get` to `get-or-abort` ii) clone a third variant of `get-or-insert` called `get` that returns null if the key is not found. iii) use `get` rather than `get-or-abort` when looking up the `Entry` label. --- subx/examples/ex1 | Bin 96 -> 128 bytes subx/examples/ex1.subx | 3 +++ 2 files changed, 3 insertions(+) (limited to 'subx/examples') diff --git a/subx/examples/ex1 b/subx/examples/ex1 index 1c983c03..aeb62302 100755 Binary files a/subx/examples/ex1 and b/subx/examples/ex1 differ diff --git a/subx/examples/ex1.subx b/subx/examples/ex1.subx index 4b9f208e..0aca40f8 100644 --- a/subx/examples/ex1.subx +++ b/subx/examples/ex1.subx @@ -10,9 +10,12 @@ == code 0x09000000 +Entry: # syscall(exit, 42) bb/copy-to-EBX 2a/imm32 # 42 in hex b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 +== data 0x0a000000 + # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0