diff options
Diffstat (limited to 'subx')
-rw-r--r-- | subx/Readme.md | 16 | ||||
-rw-r--r-- | subx/ex2.subx | 5 | ||||
-rw-r--r-- | subx/ex3.subx | 5 | ||||
-rwxr-xr-x | subx/ex4 | bin | 171 -> 171 bytes |
4 files changed, 22 insertions, 4 deletions
diff --git a/subx/Readme.md b/subx/Readme.md index e86b16b8..78ff30e8 100644 --- a/subx/Readme.md +++ b/subx/Readme.md @@ -68,8 +68,17 @@ $ chmod +x ex1 $ ./ex1 ``` -I'm not building general infrastructure here for all of the x86 ISA and ELF -format. SubX is about programming with a small, regular subset of 32-bit x86: +There are a few such example programs here. At any commit an example's binary +should be identical bit for bit with the output of translating the .subx file. +The binary should also be natively runnable on a 32-bit Linux system. If +either of these invariants is broken it's a bug on my part. The binary should +also be runnable on a 64-bit Linux system. I can't guarantee it, but I'd +appreciate hearing if it doesn't run. + +However, there are a few more binaries in the teensy/ directory. They are not +guaranteed to be runnable by subx. I'm not building general infrastructure +here for all of the x86 ISA and ELF format. SubX is about programming with a +small, regular subset of 32-bit x86: * Only instructions that operate on the 32-bit E\*X registers. (No floating-point yet.) @@ -80,6 +89,9 @@ format. SubX is about programming with a small, regular subset of 32-bit x86: on unsigned integers) * Only relative jump instructions (with 8-bit or 16-bit offsets). +The ELF binaries generated are statically linked and missing a lot of features +as well. But they will run. + For more details on programming in this subset, consult the online help: ``` $ ./subx help diff --git a/subx/ex2.subx b/subx/ex2.subx index de63f12e..4708a8b5 100644 --- a/subx/ex2.subx +++ b/subx/ex2.subx @@ -1,8 +1,11 @@ -## add 1 and 1 +## add 1 and 1, and return the result in the exit code # # To run: # $ subx translate ex2.subx ex2 # $ subx run ex2 +# Expected result: +# $ echo $? +# 2 == 0x08048054 # code segment, after leaving room for ELF header # opcode ModR/M SIB displacement immediate diff --git a/subx/ex3.subx b/subx/ex3.subx index 00ca234f..8560167d 100644 --- a/subx/ex3.subx +++ b/subx/ex3.subx @@ -1,8 +1,11 @@ -## add the first 10 numbers +## add the first 10 numbers, and return the result in the exit code # # To run: # $ subx translate ex3.subx ex3 # $ subx run ex3 +# Expected result: +# $ echo $? +# 55 == 0x08048054 # code segment, after leaving room for ELF header # opcode ModR/M SIB displacement immediate diff --git a/subx/ex4 b/subx/ex4 index 15529a9f..7721c94b 100755 --- a/subx/ex4 +++ b/subx/ex4 Binary files differ |