This commit is contained in:
Kartik Agaram 2018-11-26 00:26:20 -08:00
parent c1a3d36cad
commit e5cbbea435
21 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,6 @@
# _write: write to a file descriptor
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -1,7 +1,6 @@
# Rudimentary test harness
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -15,7 +15,6 @@
# would cause tests to not run, rather than to fail as we'd like.)
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -1,7 +1,6 @@
# Create a new segment (for data) using mmap().
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
@ -44,6 +43,7 @@ new-segment: # len : int -> address
c3/return
== data
# various constants used here were found in the Linux sources (search for file mman-common.h)
mmap-new-segment: # type mmap_arg_struct
# addr

View File

@ -1,7 +1,6 @@
# Comparing 'regular' length-prefixed strings.
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -38,7 +38,6 @@ _test-trace-stream:
00 00 00 00 00 00 00 00 # 8 bytes
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -16,7 +16,6 @@
# data: (array byte) # prefixed by length as usual
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -26,7 +26,6 @@
# returns. (This is a poor man's setjmp/longjmp, if you know what that is.)
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -41,7 +41,6 @@
# data: (array byte) # prefixed by length as usual
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -27,7 +27,6 @@ Stdin:
# TODO: 8 bytes is too small. We'll need to grow the buffer for efficiency.
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -1,7 +1,6 @@
# write-stream: like write, but write streams rather than strings
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes

View File

@ -9,6 +9,7 @@
# 42
== code
bb/copy-to-EBX 2a/imm32
# exit(EBX)
b8/copy-to-EAX 1/imm32

View File

@ -15,7 +15,6 @@
# would cause tests to not run, rather than to fail as we'd like.)
== code
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
@ -335,6 +334,7 @@ write-stderr: # s : (address array byte) -> <void>
c3/return
== data
Newline:
# size
01 00 00 00

View File

@ -25,6 +25,7 @@
cd/syscall 0x80/imm8
== data
# various constants used here were found in the Linux sources (search for file mman-common.h)
Mmap-new-segment: # type mmap_arg_struct
# addr

View File

@ -8,6 +8,7 @@
# 2
== code
bb/copy-to-EBX 1/imm32
43/inc-EBX
# exit(EBX)

View File

@ -11,6 +11,7 @@
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# result: EBX = 0
bb/copy-to-EBX 0/imm32
# counter: ECX = 1

View File

@ -5,6 +5,7 @@
# $ subx run examples/ex4
== code
# syscall(read, stdin, X, 1)
# fd = 0 (stdin)
bb/copy-to-EBX 0/imm32
@ -32,6 +33,7 @@ b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
== data
X:
00 00 00 00 # space for read() to write to

View File

@ -26,6 +26,7 @@
cd/syscall 0x80/imm8
== data
Size: # size of string
0e 00 00 00 # 14
X: # string to print

View File

@ -91,6 +91,7 @@
cd/syscall 0x80/imm8
== data
Stream:
00 00 00 00
A:

View File

@ -18,6 +18,7 @@
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# prolog
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# call ascii-length(argv[1])

View File

@ -20,6 +20,7 @@
# instruction effective address operand displacement immediate
# op subop mod rm32 base index scale r32
# 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# prolog
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# call ascii-difference(argv[1], argv[2])