https://github.com/akkartik/mu/blob/main/linux/131table.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 == code
21
22
23
24
25
26 get:
27
28
29
30
31
32
33
34
35
36
37
38 55/push-ebp
39 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
40
41 51/push-ecx
42 52/push-edx
43 56/push-esi
44
45 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
46
47 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 .
48
49 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
50 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . .
51 $get:search-loop:
52
53 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
54 73/jump-if-addr>= $get:abort/disp8
55
56
57 ff 6/subop/push 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 .
58 ff 6/subop/push 0/mod/indirect 1/rm32/ecx . . . . . .
59
60 e8/call lookup/disp32
61
62 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
63
64
65
66 50/push-eax
67 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
68
69 e8/call string-equal?/disp32
70
71 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
72
73 3d/compare-eax-and 0/imm32/false
74 74/jump-if-= $get:mismatch/disp8
75 8d/copy-address 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 8/disp8 .
76 eb/jump $get:end/disp8
77 $get:mismatch:
78
79 03/add 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0x10/disp8 .
80
81 eb/jump $get:search-loop/disp8
82 $get:end:
83
84 5e/pop-to-esi
85 5a/pop-to-edx
86 59/pop-to-ecx
87
88 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
89 5d/pop-to-ebp
90 c3/return
91
92 $get:abort:
93
94
95 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
96 68/push 2/imm32/stderr
97
98 e8/call _write/disp32
99
100 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
101
102
103 68/push ": get: key not found: "/imm32
104 68/push 2/imm32/stderr
105
106 e8/call _write/disp32
107
108 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
109
110
111 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
112 68/push 2/imm32/stderr
113
114 e8/call _write/disp32
115
116 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
117
118
119 68/push Newline/imm32
120 68/push 2/imm32/stderr
121
122 e8/call _write/disp32
123
124 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
125
126 bb/copy-to-ebx 1/imm32
127 e8/call syscall_exit/disp32
128
129
130 test-get:
131
132 55/push-ebp
133 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
134
135
136 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
137 68/push 0x18/imm32/size
138 68/push 0/imm32/read
139 68/push 0/imm32/write
140 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
141
142
143 68/push Heap/imm32
144 68/push 0xc/imm32/row-size
145 68/push "code"/imm32
146 51/push-ecx
147
148 e8/call get-or-insert/disp32
149
150 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
151
152
153 68/push Heap/imm32
154 68/push 0xc/imm32/row-size
155 68/push "data"/imm32
156 51/push-ecx
157
158 e8/call get-or-insert/disp32
159
160 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
161 $test-get:check1:
162
163
164 68/push 0xc/imm32/row-size
165 68/push "code"/imm32
166 51/push-ecx
167
168 e8/call get/disp32
169
170 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
171
172
173
174 68/push "F - test-get/0"/imm32
175 68/push 0x14/imm32
176 29/subtract 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
177 50/push-eax
178
179 e8/call check-ints-equal/disp32
180
181 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
182 $test-get:check2:
183
184
185 68/push 0xc/imm32/row-size
186 68/push "data"/imm32
187 51/push-ecx
188
189 e8/call get/disp32
190
191 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
192
193
194
195 68/push "F - test-get/1"/imm32
196 68/push 0x20/imm32
197 29/subtract 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
198 50/push-eax
199
200 e8/call check-ints-equal/disp32
201
202 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
203 $test-get:end:
204