4780
This commit is contained in:
parent
c1a3d36cad
commit
e5cbbea435
|
@ -1,7 +1,6 @@
|
||||||
# _write: write to a file descriptor
|
# _write: write to a file descriptor
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Rudimentary test harness
|
# Rudimentary test harness
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# would cause tests to not run, rather than to fail as we'd like.)
|
# would cause tests to not run, rather than to fail as we'd like.)
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Create a new segment (for data) using mmap().
|
# Create a new segment (for data) using mmap().
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
c3/return
|
||||||
|
|
||||||
== data
|
== data
|
||||||
|
|
||||||
# various constants used here were found in the Linux sources (search for file mman-common.h)
|
# various constants used here were found in the Linux sources (search for file mman-common.h)
|
||||||
mmap-new-segment: # type mmap_arg_struct
|
mmap-new-segment: # type mmap_arg_struct
|
||||||
# addr
|
# addr
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Comparing 'regular' length-prefixed strings.
|
# Comparing 'regular' length-prefixed strings.
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -38,7 +38,6 @@ _test-trace-stream:
|
||||||
00 00 00 00 00 00 00 00 # 8 bytes
|
00 00 00 00 00 00 00 00 # 8 bytes
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
# data: (array byte) # prefixed by length as usual
|
# data: (array byte) # prefixed by length as usual
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
# returns. (This is a poor man's setjmp/longjmp, if you know what that is.)
|
# returns. (This is a poor man's setjmp/longjmp, if you know what that is.)
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
# data: (array byte) # prefixed by length as usual
|
# data: (array byte) # prefixed by length as usual
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -27,7 +27,6 @@ Stdin:
|
||||||
# TODO: 8 bytes is too small. We'll need to grow the buffer for efficiency.
|
# TODO: 8 bytes is too small. We'll need to grow the buffer for efficiency.
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# write-stream: like write, but write streams rather than strings
|
# write-stream: like write, but write streams rather than strings
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
# 42
|
# 42
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
bb/copy-to-EBX 2a/imm32
|
bb/copy-to-EBX 2a/imm32
|
||||||
# exit(EBX)
|
# exit(EBX)
|
||||||
b8/copy-to-EAX 1/imm32
|
b8/copy-to-EAX 1/imm32
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
# would cause tests to not run, rather than to fail as we'd like.)
|
# would cause tests to not run, rather than to fail as we'd like.)
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
c3/return
|
||||||
|
|
||||||
== data
|
== data
|
||||||
|
|
||||||
Newline:
|
Newline:
|
||||||
# size
|
# size
|
||||||
01 00 00 00
|
01 00 00 00
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
cd/syscall 0x80/imm8
|
cd/syscall 0x80/imm8
|
||||||
|
|
||||||
== data
|
== data
|
||||||
|
|
||||||
# various constants used here were found in the Linux sources (search for file mman-common.h)
|
# various constants used here were found in the Linux sources (search for file mman-common.h)
|
||||||
Mmap-new-segment: # type mmap_arg_struct
|
Mmap-new-segment: # type mmap_arg_struct
|
||||||
# addr
|
# addr
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
# 2
|
# 2
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
bb/copy-to-EBX 1/imm32
|
bb/copy-to-EBX 1/imm32
|
||||||
43/inc-EBX
|
43/inc-EBX
|
||||||
# exit(EBX)
|
# exit(EBX)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
# result: EBX = 0
|
||||||
bb/copy-to-EBX 0/imm32
|
bb/copy-to-EBX 0/imm32
|
||||||
# counter: ECX = 1
|
# counter: ECX = 1
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
# $ subx run examples/ex4
|
# $ subx run examples/ex4
|
||||||
|
|
||||||
== code
|
== code
|
||||||
|
|
||||||
# syscall(read, stdin, X, 1)
|
# syscall(read, stdin, X, 1)
|
||||||
# fd = 0 (stdin)
|
# fd = 0 (stdin)
|
||||||
bb/copy-to-EBX 0/imm32
|
bb/copy-to-EBX 0/imm32
|
||||||
|
@ -32,6 +33,7 @@ b8/copy-to-EAX 1/imm32/exit
|
||||||
cd/syscall 0x80/imm8
|
cd/syscall 0x80/imm8
|
||||||
|
|
||||||
== data
|
== data
|
||||||
|
|
||||||
X:
|
X:
|
||||||
00 00 00 00 # space for read() to write to
|
00 00 00 00 # space for read() to write to
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
cd/syscall 0x80/imm8
|
cd/syscall 0x80/imm8
|
||||||
|
|
||||||
== data
|
== data
|
||||||
|
|
||||||
Size: # size of string
|
Size: # size of string
|
||||||
0e 00 00 00 # 14
|
0e 00 00 00 # 14
|
||||||
X: # string to print
|
X: # string to print
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
cd/syscall 0x80/imm8
|
cd/syscall 0x80/imm8
|
||||||
|
|
||||||
== data
|
== data
|
||||||
|
|
||||||
Stream:
|
Stream:
|
||||||
00 00 00 00
|
00 00 00 00
|
||||||
A:
|
A:
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
# prolog
|
||||||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||||
# call ascii-length(argv[1])
|
# call ascii-length(argv[1])
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
# instruction effective address operand displacement immediate
|
# instruction effective address operand displacement immediate
|
||||||
# op subop mod rm32 base index scale r32
|
# 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
|
# 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
|
# prolog
|
||||||
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
|
||||||
# call ascii-difference(argv[1], argv[2])
|
# call ascii-difference(argv[1], argv[2])
|
||||||
|
|
Loading…
Reference in New Issue