This commit is contained in:
Kartik K. Agaram 2021-03-04 00:24:24 -08:00
parent 2d306e2a98
commit b964fa586f
37 changed files with 81 additions and 82 deletions

View File

@ -200,8 +200,7 @@ If you're still reading, here are some more things to check out:
- [Commandline reference for the bootstrap C++ program.](bootstrap.md) - [Commandline reference for the bootstrap C++ program.](bootstrap.md)
- The [list of x86 opcodes](subx_opcodes) supported in SubX: `./bootstrap - The [list of x86 opcodes](subx_opcodes) supported in SubX: `linux/bootstrap/bootstrap help opcodes`.
help opcodes`.
- [Some details on the unconventional organization of this project.](http://akkartik.name/post/four-repos) - [Some details on the unconventional organization of this project.](http://akkartik.name/post/four-repos)

View File

@ -9,7 +9,7 @@
# To convert to a disk image, first prepare a realistically sized disk image: # To convert to a disk image, first prepare a realistically sized disk image:
# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB # dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB
# Create initial sectors from this file: # Create initial sectors from this file:
# ./bootstrap run apps/hex < baremetal/boot.hex > boot.bin # bootstrap/bootstrap run hex < baremetal/boot.hex > boot.bin
# Translate other sectors into a file called a.img # Translate other sectors into a file called a.img
# Load all sectors into the disk image: # Load all sectors into the disk image:
# cat boot.bin a.img > disk.bin # cat boot.bin a.img > disk.bin

View File

@ -11,7 +11,7 @@
# To convert to a disk image, first prepare a realistically sized disk image: # To convert to a disk image, first prepare a realistically sized disk image:
# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB # dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB
# Now fill in sectors: # Now fill in sectors:
# ./bootstrap run apps/hex < baremetal/boot0.hex > boot.bin # bootstrap/bootstrap run hex < baremetal/boot0.hex > boot.bin
# dd if=boot.bin of=disk.img conv=notrunc # dd if=boot.bin of=disk.img conv=notrunc
# To run: # To run:
# qemu-system-i386 disk.img # qemu-system-i386 disk.img

View File

@ -6,7 +6,7 @@
# To convert to a disk image, first prepare a realistically sized disk image: # To convert to a disk image, first prepare a realistically sized disk image:
# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB # dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB
# Load the program on the disk image: # Load the program on the disk image:
# cat baremetal/boot.hex baremetal/ex1.hex |./bootstrap run apps/hex > a.bin # cat baremetal/boot.hex baremetal/ex1.hex |bootstrap/bootstrap run hex > a.bin
# dd if=a.bin of=disk.img conv=notrunc # dd if=a.bin of=disk.img conv=notrunc
# To run: # To run:
# qemu-system-i386 disk.img # qemu-system-i386 disk.img

View File

@ -3,7 +3,7 @@
# To run, first prepare a realistically sized disk image: # To run, first prepare a realistically sized disk image:
# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB # dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB
# Load the program on the disk image: # Load the program on the disk image:
# cat baremetal/boot.hex baremetal/ex2.hex |./bootstrap run apps/hex > a.bin # cat baremetal/boot.hex baremetal/ex2.hex |bootstrap/bootstrap run hex > a.bin
# dd if=a.bin of=disk.img conv=notrunc # dd if=a.bin of=disk.img conv=notrunc
# To run: # To run:
# qemu-system-i386 disk.img # qemu-system-i386 disk.img

View File

@ -4,7 +4,7 @@
# To run, first prepare a realistically sized disk image: # To run, first prepare a realistically sized disk image:
# dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB # dd if=/dev/zero of=disk.img count=20160 # 512-byte sectors, so 10MB
# Load the program on the disk image: # Load the program on the disk image:
# cat baremetal/boot.hex baremetal/ex3.hex |./bootstrap run apps/hex > a.bin # cat baremetal/boot.hex baremetal/ex3.hex |bootstrap/bootstrap run hex > a.bin
# dd if=a.bin of=disk.img conv=notrunc # dd if=a.bin of=disk.img conv=notrunc
# To run: # To run:
# qemu-system-i386 disk.img # qemu-system-i386 disk.img

View File

@ -9,8 +9,8 @@
# string'. # string'.
# #
# To run (from the subx directory): # To run (from the subx directory):
# $ ./bootstrap translate 05[0-2]*.subx -o /tmp/tmp52 # $ bootstrap/bootstrap translate 10[0-3]*.subx -o a.elf
# $ ./bootstrap run /tmp/tmp52 # runs a series of tests # $ bootstrap/bootstrap run a.elf # runs a series of tests
# ...... # all tests pass # ...... # all tests pass
# #
# (We can't yet run the tests when given a "test" commandline argument, # (We can't yet run the tests when given a "test" commandline argument,

View File

@ -7,13 +7,13 @@
# because we don't know if they refer to the line above or the line below. # because we don't know if they refer to the line above or the line below.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/assort.subx -o apps/assort # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/assort.subx -o apps/assort
# $ cat x # $ cat x
# == code # == code
# abc # abc
# == code # == code
# def # def
# $ cat x |./bootstrap run apps/assort # $ cat x |bootstrap/bootstrap run assort
# == code # == code
# abc # abc
# def # def

View File

@ -3,8 +3,8 @@
# except that we support hex digits. # except that we support hex digits.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1 # $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1
# $ echo '3' |./bootstrap run apps/crenshaw2-1 # $ echo '3' |bootstrap/bootstrap run crenshaw2-1
# Expected output: # Expected output:
# # syscall(exit, 3) # # syscall(exit, 3)
# bb/copy-to-ebx 3/imm32 # bb/copy-to-ebx 3/imm32
@ -12,14 +12,14 @@
# cd/syscall 0x80/imm8 # cd/syscall 0x80/imm8
# #
# To run the generated output: # To run the generated output:
# $ echo '3' |./bootstrap run apps/crenshaw2-1 > z1.subx # $ echo '3' |bootstrap/bootstrap run crenshaw2-1 > z1.subx
# $ ./bootstrap translate init.linux z1.subx -o z1 # $ bootstrap/bootstrap translate z1.subx -o z1
# $ ./bootstrap run z1 # $ bootstrap/bootstrap run z1
# $ echo $? # $ echo $?
# 3 # 3
# #
# Stdin must contain just a single hex digit. Other input will print an error: # Stdin must contain just a single hex digit. Other input will print an error:
# $ echo 'xyz' |./bootstrap run apps/crenshaw2-1 # $ echo 'xyz' |bootstrap/bootstrap run crenshaw2-1
# Error: integer expected # Error: integer expected
# #
# Names in this file sometimes follow Crenshaw's original rather than my usual # Names in this file sometimes follow Crenshaw's original rather than my usual

View File

@ -3,8 +3,8 @@
# except that we support hex numbers of multiple digits. # except that we support hex numbers of multiple digits.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b # $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b
# $ echo '1a' |./bootstrap run apps/crenshaw2-1b # $ echo '1a' |bootstrap/bootstrap run crenshaw2-1b
# Expected output: # Expected output:
# # syscall(exit, 1a) # # syscall(exit, 1a)
# bb/copy-to-ebx 3/imm32 # bb/copy-to-ebx 3/imm32
@ -12,14 +12,14 @@
# cd/syscall 0x80/imm8 # cd/syscall 0x80/imm8
# #
# To run the generated output: # To run the generated output:
# $ echo '1a' |./bootstrap run apps/crenshaw2-1b > z1.subx # $ echo '1a' |bootstrap/bootstrap run crenshaw2-1b > z1.subx
# $ ./bootstrap translate init.linux z1.subx -o z1 # $ bootstrap/bootstrap translate z1.subx -o z1
# $ ./bootstrap run z1 # $ bootstrap/bootstrap run z1
# $ echo $? # $ echo $?
# 26 # 0x1a in decimal # 26 # 0x1a in decimal
# #
# Stdin must contain just a single hex digit. Other input will print an error: # Stdin must contain just a single hex digit. Other input will print an error:
# $ echo 'xyz' |./bootstrap run apps/crenshaw2-1b # $ echo 'xyz' |bootstrap/bootstrap run crenshaw2-1b
# Error: integer expected # Error: integer expected
# #
# Names in this file sometimes follow Crenshaw's original rather than my usual # Names in this file sometimes follow Crenshaw's original rather than my usual

View File

@ -2,11 +2,11 @@
# Replace them with references to new variables in the data segment. # Replace them with references to new variables in the data segment.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/dquotes.subx -o apps/dquotes # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/dquotes.subx -o apps/dquotes
# $ cat x # $ cat x
# == code # == code
# ab "cd ef"/imm32 # ab "cd ef"/imm32
# $ cat x |./bootstrap run apps/dquotes # $ cat x |bootstrap/bootstrap run dquotes
# == code # == code
# ab __string1/imm32 # ab __string1/imm32
# == data # == data

View File

@ -2,8 +2,8 @@
# Just return 42. # Just return 42.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex1.subx -o apps/ex1 # $ bootstrap/bootstrap translate apps/ex1.subx -o apps/ex1
# $ ./bootstrap run apps/ex1 # $ bootstrap/bootstrap run ex1
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 42 # 42

View File

@ -1,8 +1,8 @@
# String comparison: return 1 iff the two args passed in at the commandline are equal. # String comparison: return 1 iff the two args passed in at the commandline are equal.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex10.subx -o apps/ex10 # $ bootstrap/bootstrap translate apps/ex10.subx -o apps/ex10
# $ ./bootstrap run apps/ex10 abc abd # $ bootstrap/bootstrap run ex10 abc abd
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 0 # false # 0 # false

View File

@ -6,8 +6,8 @@
# a null-terminated 'kernel string' with a size-prefixed 'SubX string'. # a null-terminated 'kernel string' with a size-prefixed 'SubX string'.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex11.subx -o apps/ex11 # $ bootstrap/bootstrap translate apps/ex11.subx -o apps/ex11
# $ ./bootstrap run apps/ex11 # runs a series of tests # $ bootstrap/bootstrap run ex11 # runs a series of tests
# ...... # all tests pass # ...... # all tests pass
# #
# (We can't yet run the tests when given a "test" commandline argument, # (We can't yet run the tests when given a "test" commandline argument,

View File

@ -2,8 +2,8 @@
# Create a new segment using mmap, save the address, write to it. # Create a new segment using mmap, save the address, write to it.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex12.subx -o apps/ex12 # $ bootstrap/bootstrap translate apps/ex12.subx -o apps/ex12
# $ ./bootstrap run apps/ex12 # $ bootstrap/bootstrap run ex12
# You shouldn't get a segmentation fault. # You shouldn't get a segmentation fault.
== code == code

View File

@ -1,8 +1,8 @@
# Compare 3 and 3. # Compare 3 and 3.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex13.subx -o apps/ex13 # $ bootstrap/bootstrap translate apps/ex13.subx -o apps/ex13
# $ ./bootstrap run apps/ex13 # $ bootstrap/bootstrap run ex13
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 1 # 1

View File

@ -1,8 +1,8 @@
# Multiply 2 numbers. # Multiply 2 numbers.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex14.subx -o apps/ex14 # $ bootstrap/bootstrap translate apps/ex14.subx -o apps/ex14
# $ ./bootstrap run apps/ex14 # $ bootstrap/bootstrap run ex14
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 6 # 6

View File

@ -1,8 +1,8 @@
# Add 3 and 4, and return the result in the exit code. # Add 3 and 4, and return the result in the exit code.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex2.subx -o apps/ex2 # $ bootstrap/bootstrap translate apps/ex2.subx -o apps/ex2
# $ ./bootstrap run apps/ex2 # $ bootstrap/bootstrap run ex2
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 2 # 2

View File

@ -1,8 +1,8 @@
# Add the first 10 numbers, and return the result in the exit code. # Add the first 10 numbers, and return the result in the exit code.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex3.subx -o apps/ex3 # $ bootstrap/bootstrap translate apps/ex3.subx -o apps/ex3
# $ ./bootstrap run apps/ex3 # $ bootstrap/bootstrap run ex3
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 55 # 55

View File

@ -1,8 +1,8 @@
# Read a character from stdin, save it to a global, write it to stdout. # Read a character from stdin, save it to a global, write it to stdout.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex4.subx -o apps/ex4 # $ bootstrap/bootstrap translate apps/ex4.subx -o apps/ex4
# $ ./bootstrap run apps/ex4 # $ bootstrap/bootstrap run ex4
== data == data

View File

@ -1,8 +1,8 @@
# Read a character from stdin, save it to a local on the stack, write it to stdout. # Read a character from stdin, save it to a local on the stack, write it to stdout.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex5.subx -o apps/ex5 # $ bootstrap/bootstrap translate apps/ex5.subx -o apps/ex5
# $ ./bootstrap run apps/ex5 # $ bootstrap/bootstrap run ex5
== code == code
# instruction effective address register displacement immediate # instruction effective address register displacement immediate

View File

@ -1,8 +1,8 @@
# Print out a (global variable) string to stdout. # Print out a (global variable) string to stdout.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex6.subx -o apps/ex6 # $ bootstrap/bootstrap translate apps/ex6.subx -o apps/ex6
# $ ./bootstrap run apps/ex6 # $ bootstrap/bootstrap run ex6
# Hello, world! # Hello, world!
== code == code

View File

@ -5,8 +5,8 @@
# the character read. # the character read.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex7.subx -o apps/ex7 # $ bootstrap/bootstrap translate apps/ex7.subx -o apps/ex7
# $ ./bootstrap run apps/ex7 # $ bootstrap/bootstrap run ex7
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 97 # 97

View File

@ -1,8 +1,8 @@
# Example reading commandline arguments: compute length of first arg. # Example reading commandline arguments: compute length of first arg.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex8.subx -o apps/ex8 # $ bootstrap/bootstrap translate apps/ex8.subx -o apps/ex8
# $ ./bootstrap run apps/ex8 abc de fghi # $ bootstrap/bootstrap run ex8 abc de fghi
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 3 # length of 'abc' # 3 # length of 'abc'

View File

@ -4,8 +4,8 @@
# letter of second arg. # letter of second arg.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux apps/ex9.subx -o apps/ex9 # $ bootstrap/bootstrap translate apps/ex9.subx -o apps/ex9
# $ ./bootstrap run apps/ex9 z x # $ bootstrap/bootstrap run ex9 z x
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 2 # 2

View File

@ -1,14 +1,14 @@
## compute the factorial of 5, and print the result ## compute the factorial of 5, and print the result
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/factorial.subx -o apps/factorial # $ bootstrap/bootstrap translate [01]*.subx apps/factorial.subx -o apps/factorial
# $ ./bootstrap run apps/factorial # $ bootstrap/bootstrap run factorial
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 120 # 120
# #
# You can also run the automated test suite: # You can also run the automated test suite:
# $ ./bootstrap run apps/factorial test # $ bootstrap/bootstrap run factorial test
# Expected output: # Expected output:
# ........ # ........
# Every '.' indicates a passing test. Failing tests get a 'F'. # Every '.' indicates a passing test. Failing tests get a 'F'.

View File

@ -5,13 +5,13 @@
# #
# To run: # To run:
# $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial # $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial
# $ ./bootstrap run apps/factorial # $ bootstrap/bootstrap run factorial
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 120 # 120
# #
# You can also run the automated test suite: # You can also run the automated test suite:
# $ ./bootstrap run apps/factorial test # $ bootstrap/bootstrap run factorial test
# Expected output: # Expected output:
# ........ # ........
# Every '.' indicates a passing test. Failing tests get a 'F'. # Every '.' indicates a passing test. Failing tests get a 'F'.

View File

@ -6,13 +6,13 @@
# #
# To run: # To run:
# $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial # $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial
# $ ./bootstrap run apps/factorial # $ bootstrap/bootstrap run factorial
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 120 # 120
# #
# You can also run the automated test suite: # You can also run the automated test suite:
# $ ./bootstrap run apps/factorial test # $ bootstrap/bootstrap run factorial test
# Expected output: # Expected output:
# ........ # ........
# Every '.' indicates a passing test. Failing tests get a 'F'. # Every '.' indicates a passing test. Failing tests get a 'F'.

View File

@ -7,13 +7,13 @@
# #
# To run: # To run:
# $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial # $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial
# $ ./bootstrap run apps/factorial # $ bootstrap/bootstrap run factorial
# Expected result: # Expected result:
# $ echo $? # $ echo $?
# 120 # 120
# #
# You can also run the automated test suite: # You can also run the automated test suite:
# $ ./bootstrap run apps/factorial test # $ bootstrap/bootstrap run factorial test
# Expected output: # Expected output:
# ........ # ........
# Every '.' indicates a passing test. Failing tests get a 'F'. # Every '.' indicates a passing test. Failing tests get a 'F'.

View File

@ -3,8 +3,8 @@
# comments between '#' and newline. # comments between '#' and newline.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/hex.subx -o apps/hex # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/hex.subx -o apps/hex
# $ echo '80 81 82 # comment' |./bootstrap run apps/hex |xxd - # $ echo '80 81 82 # comment' |bootstrap/bootstrap run hex |xxd -
# Expected output: # Expected output:
# 00000000: 8081 82 # 00000000: 8081 82
# #

View File

@ -3,8 +3,8 @@
# uses are left untouched. # uses are left untouched.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/pack.subx -o apps/pack # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/pack.subx -o apps/pack
# $ echo '05/add-to-eax 0x20/imm32' |./bootstrap run apps/pack # $ echo '05/add-to-eax 0x20/imm32' |bootstrap/bootstrap run pack
# Expected output: # Expected output:
# 05 20 00 00 00 # 05/add-to-eax 0x20/imm32 # 05 20 00 00 00 # 05/add-to-eax 0x20/imm32
# The original instruction gets included as a comment at the end of each # The original instruction gets included as a comment at the end of each

View File

@ -1,8 +1,8 @@
# Repeatedly read 32-bit numbers from /dev/random, print them to stdout. # Repeatedly read 32-bit numbers from /dev/random, print them to stdout.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [01]*.subx apps/random.subx -o apps/random # $ bootstrap/bootstrap translate [01]*.subx apps/random.subx -o apps/random
# $ ./bootstrap run apps/random # $ bootstrap/bootstrap run random
== code 0x09000000 == code 0x09000000
# instruction effective address register displacement immediate # instruction effective address register displacement immediate

View File

@ -2,36 +2,36 @@
# arguments. # arguments.
# #
# To run: # To run:
# $ ./bootstrap translate init.linux [012]*.subx apps/subx-params.subx apps/sigils.subx -o apps/sigils # $ bootstrap/bootstrap translate [012]*.subx apps/subx-params.subx apps/sigils.subx -o apps/sigils
# #
# We currently support the following notations: # We currently support the following notations:
# #
# 1. # 1.
# $ echo '%eax' | ./bootstrap run apps/sigils # $ echo '%eax' | bootstrap/bootstrap run sigils
# 3/mod 0/rm32 # 3/mod 0/rm32
# #
# 2. # 2.
# $ echo '*eax' | ./bootstrap run apps/sigils # $ echo '*eax' | bootstrap/bootstrap run sigils
# 0/mod 0/rm32 # 0/mod 0/rm32
# #
# 3. # 3.
# $ echo '*(eax+4)' | ./bootstrap run apps/sigils # $ echo '*(eax+4)' | bootstrap/bootstrap run sigils
# 2/mod 0/rm32 4/disp32 # 2/mod 0/rm32 4/disp32
# #
# 4. # 4.
# $ echo '*(eax+ecx)' | ./bootstrap run apps/sigils # $ echo '*(eax+ecx)' | bootstrap/bootstrap run sigils
# 0/mod 4/rm32 0/base 1/index 0/scale # 0/mod 4/rm32 0/base 1/index 0/scale
# #
# 5. # 5.
# $ echo '*(eax+ecx+4)' | ./bootstrap run apps/sigils # $ echo '*(eax+ecx+4)' | bootstrap/bootstrap run sigils
# 2/mod 4/rm32 0/base 1/index 0/scale 4/disp32 # 2/mod 4/rm32 0/base 1/index 0/scale 4/disp32
# #
# 6. # 6.
# $ echo '*(eax+ecx<<2+4)' | ./bootstrap run apps/sigils # $ echo '*(eax+ecx<<2+4)' | bootstrap/bootstrap run sigils
# 2/mod 4/rm32 0/base 1/index 2/scale 4/disp32 # 2/mod 4/rm32 0/base 1/index 2/scale 4/disp32
# #
# 7. # 7.
# $ echo '*Foo' | ./bootstrap run apps/sigils # $ echo '*Foo' | bootstrap/bootstrap run sigils
# 0/mod 5/rm32/.disp32 Foo/disp32 # 0/mod 5/rm32/.disp32 Foo/disp32
# #
# TODO: *(Foo+ecx<<2) # TODO: *(Foo+ecx<<2)

View File

@ -29,7 +29,7 @@ rudimentary but hopefully still workable toolkit:
``` ```
$ cd linux $ cd linux
$ ./translate_subx_debug file1.subx file2.subx ... # generating a.elf $ ./translate_subx_debug file1.subx file2.subx ... # generating a.elf
$ ./bootstrap --trace run a.elf arg1 arg2 $ bootstrap/bootstrap --trace run a.elf arg1 arg2
saving trace to 'last_run' saving trace to 'last_run'
``` ```

View File

@ -3,7 +3,7 @@
# Use the addresses assigned to replace labels. # Use the addresses assigned to replace labels.
# #
# To build: # To build:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/survey_baremetal.subx -o apps/survey_baremetal # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/survey_baremetal.subx -o apps/survey_baremetal
# #
# The expected input is a stream of bytes and some interspersed labels. # The expected input is a stream of bytes and some interspersed labels.
# Comments and '==' segment headers are allowed, but ignored. The emitted code # Comments and '==' segment headers are allowed, but ignored. The emitted code
@ -22,7 +22,7 @@
# The output is the stream of bytes without segment headers or label definitions, # The output is the stream of bytes without segment headers or label definitions,
# and with label references replaced with numeric values/displacements. # and with label references replaced with numeric values/displacements.
# #
# $ cat x |./bootstrap run apps/survey_baremetal # $ cat x |bootstrap/bootstrap run survey_baremetal
# aa bb nn # some computed address # aa bb nn # some computed address
# cc dd nn nn nn nn # some computed displacement # cc dd nn nn nn nn # some computed displacement
# ee nn nn nn nn # address right after this instruction # ee nn nn nn nn # address right after this instruction

View File

@ -5,7 +5,7 @@
# b) add an ELF header and segment headers with addresses and offsets correctly filled in # b) add an ELF header and segment headers with addresses and offsets correctly filled in
# #
# To build: # To build:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/survey_elf.subx -o apps/survey_elf # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/survey_elf.subx -o apps/survey_elf
# #
# The expected input is a stream of bytes with '==' segment headers, comments # The expected input is a stream of bytes with '==' segment headers, comments
# and some interspersed labels. # and some interspersed labels.
@ -23,7 +23,7 @@
# The output is the stream of bytes without segment headers or label definitions, # The output is the stream of bytes without segment headers or label definitions,
# and with label references replaced with numeric values/displacements. # and with label references replaced with numeric values/displacements.
# #
# $ cat x |./bootstrap run apps/survey_elf # $ cat x |bootstrap/bootstrap run survey_elf
# ...ELF header bytes... # ...ELF header bytes...
# # ELF header above will specify that code segment begins at this offset # # ELF header above will specify that code segment begins at this offset
# aa bb nn # some computed address # aa bb nn # some computed address

View File

@ -2,7 +2,7 @@
# all functions starting with 'test-'. # all functions starting with 'test-'.
# #
# To build: # To build:
# $ ./bootstrap translate init.linux [01]*.subx apps/subx-params.subx apps/tests.subx -o apps/tests # $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/tests.subx -o apps/tests
== code == code
# instruction effective address register displacement immediate # instruction effective address register displacement immediate