1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 == code
18
19
20
21
22
23
24 e8/call run-tests/disp32
25
26 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
27 b8/copy-to-EAX 1/imm32
28 cd/syscall 0x80/imm8
29
30
31
32 kernel-string-equal:
33
34 55/push-EBP
35 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
36
37 51/push-ECX
38 52/push-EDX
39 53/push-EBX
40 56/push-ESI
41 57/push-EDI
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 7/r32/EDI 8/disp8 .
59
60 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 0xc/disp8 .
61 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . .
62
63 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 6/r32/ESI 0xc/disp8 .
64 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 4/imm32
65
66 b9/copy-to-ECX 0/imm32/exit
67
68 $kernel-string-equal:loop:
69 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
70 74/jump-if-equal $kernel-string-equal:break/disp8
71
72 b8/copy-to-EAX 0/imm32
73 8a/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
74 bb/copy-to-EBX 0/imm32
75 8a/copy 0/mod/indirect 6/rm32/ESI . . . 3/r32/EBX . .
76
77 3d/compare-EAX 0/imm32
78 74/jump-if-equal $kernel-string-equal:false/disp8
79
80 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
81 75/jump-if-not-equal $kernel-string-equal:false/disp8
82
83 41/inc-ECX
84 46/inc-ESI
85 47/inc-EDI
86
87 eb/jump $kernel-string-equal:loop/disp8
88 $kernel-string-equal:break:
89
90 b8/copy-to-EAX 0/imm32
91 8a/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
92 3d/compare-EAX 0/imm32
93 75/jump-if-not-equal $kernel-string-equal:false/disp8
94 $kernel-string-equal:true:
95 b8/copy-to-EAX 1/imm32
96 eb/jump $kernel-string-equal:end/disp8
97
98 $kernel-string-equal:false:
99 b8/copy-to-EAX 0/imm32
100
101 $kernel-string-equal:end:
102
103 5f/pop-to-EDI
104 5e/pop-to-ESI
105 5b/pop-to-EBX
106 5a/pop-to-EDX
107 59/pop-to-ECX
108
109 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
110 5d/pop-to-EBP
111 c3/return
112
113
114
115 test-compare-null-kernel-string-with-empty-array:
116
117
118 68/push ""/imm32
119 68/push Null-kernel-string/imm32
120
121 e8/call kernel-string-equal/disp32
122
123 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
124
125
126 68/push "F - test-compare-null-kernel-string-with-empty-array"/imm32
127 68/push 1/imm32/true
128 50/push-EAX
129
130 e8/call check-ints-equal/disp32
131
132 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
133 c3/return
134
135 test-compare-null-kernel-string-with-non-empty-array:
136
137
138 68/push "Abc"/imm32
139 68/push Null-kernel-string/imm32
140
141 e8/call kernel-string-equal/disp32
142
143 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
144
145
146 68/push "F - test-compare-null-kernel-string-with-non-empty-array"/imm32
147 68/push 0/imm32/false
148 50/push-EAX
149
150 e8/call check-ints-equal/disp32
151
152 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
153 c3/return
154
155 test-compare-kernel-string-with-equal-array:
156
157
158 68/push "Abc"/imm32
159 68/push Abc-kernel-string/imm32
160
161 e8/call kernel-string-equal/disp32
162
163 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
164
165
166 68/push "F - test-compare-kernel-string-with-equal-array"/imm32
167 68/push 1/imm32/true
168 50/push-EAX
169
170 e8/call check-ints-equal/disp32
171
172 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
173 c3/return
174
175 test-compare-kernel-string-with-inequal-array:
176
177
178 68/push "Adc"/imm32
179 68/push Abc-kernel-string/imm32
180
181 e8/call kernel-string-equal/disp32
182
183 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
184
185
186 68/push "F - test-compare-kernel-string-with-equal-array"/imm32
187 68/push 0/imm32/false
188 50/push-EAX
189
190 e8/call check-ints-equal/disp32
191
192 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
193 c3/return
194
195 test-compare-kernel-string-with-empty-array:
196
197
198 68/push ""/imm32
199 68/push Abc-kernel-string/imm32
200
201 e8/call kernel-string-equal/disp32
202
203 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
204
205
206 68/push "F - test-compare-kernel-string-with-equal-array"/imm32
207 68/push 0/imm32/false
208 50/push-EAX
209
210 e8/call check-ints-equal/disp32
211
212 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
213 c3/return
214
215 test-compare-kernel-string-with-shorter-array:
216
217
218 68/push "Ab"/imm32
219 68/push Abc-kernel-string/imm32
220
221 e8/call kernel-string-equal/disp32
222
223 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
224
225
226 68/push "F - test-compare-kernel-string-with-shorter-array"/imm32
227 68/push 0/imm32/false
228 50/push-EAX
229
230 e8/call check-ints-equal/disp32
231
232 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
233 c3/return
234
235 test-compare-kernel-string-with-longer-array:
236
237
238 68/push "Abcd"/imm32
239 68/push Abc-kernel-string/imm32
240
241 e8/call kernel-string-equal/disp32
242
243 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
244
245
246 68/push "F - test-compare-kernel-string-with-longer-array"/imm32
247 68/push 0/imm32/false
248 50/push-EAX
249
250 e8/call check-ints-equal/disp32
251
252 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
253 c3/return
254
255 == data
256
257 Null-kernel-string:
258 00/null
259 Abc-kernel-string:
260 41/A 62/b 63/c 00/null
261
262