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 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . .
27 b8/copy . . . . . . . 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 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 7/r32/EDI 8/disp8 .
58
59 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 0xc/disp8 .
60 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . .
61
62 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 6/r32/ESI 0xc/disp8 .
63 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 4/imm32
64
65 b9/copy . . . . . . . 0/imm32/exit
66
67 $kernel_string_loop:
68 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
69 74/jump-if-equal $kernel_string_break/disp8
70
71 b8/copy 0/imm32
72 8a/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
73 bb/copy 0/imm32
74 8a/copy 0/mod/indirect 6/rm32/ESI . . . 3/r32/EBX . .
75
76 3d/compare-EAX 0/imm32
77 74/jump-if-equal $kernel_string_fail/disp8
78
79 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
80 75/jump-if-not-equal $kernel_string_fail/disp8
81
82 41/inc-ECX
83 46/inc-ESI
84 47/inc-EDI
85
86 eb/jump $kernel_string_loop/disp8
87 $kernel_string_break:
88
89 b8/copy 0/imm32
90 8a/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
91 3d/compare-EAX 0/imm32
92 75/jump-if-not-equal $kernel_string_fail/disp8
93 b8/copy . . . . . . . 1/imm32
94 eb/jump $kernel_string_end/disp8
95
96 $kernel_string_fail:
97 b8/copy . . . . . . . 0/imm32
98
99 $kernel_string_end:
100
101 5f/pop-to-EDI
102 5e/pop-to-ESI
103 5b/pop-to-EBX
104 5a/pop-to-EDX
105 59/pop-to-ECX
106
107 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
108 5d/pop-to-EBP
109 c3/return
110
111
112
113 test_compare_null_kernel_string_with_empty_array:
114
115
116 68/push ""/imm32
117 68/push Null_kernel_string/imm32
118
119 e8/call kernel_string_equal/disp32
120
121 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
122
123
124 68/push "F - test_compare_null_kernel_string_with_empty_array"/imm32
125 68/push 1/imm32/true
126 50/push-EAX
127
128 e8/call check_ints_equal/disp32
129
130 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
131 c3/return
132
133 test_compare_null_kernel_string_with_non_empty_array:
134
135
136 68/push "Abc"/imm32
137 68/push Null_kernel_string/imm32
138
139 e8/call kernel_string_equal/disp32
140
141 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
142
143
144 68/push "F - test_compare_null_kernel_string_with_non_empty_array"/imm32
145 68/push 0/imm32/false
146 50/push-EAX
147
148 e8/call check_ints_equal/disp32
149
150 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
151 c3/return
152
153 test_compare_kernel_string_with_equal_array:
154
155
156 68/push "Abc"/imm32
157 68/push Abc_kernel_string/imm32
158
159 e8/call kernel_string_equal/disp32
160
161 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
162
163
164 68/push "F - test_compare_kernel_string_with_equal_array"/imm32
165 68/push 1/imm32/true
166 50/push-EAX
167
168 e8/call check_ints_equal/disp32
169
170 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
171 c3/return
172
173 test_compare_kernel_string_with_inequal_array:
174
175
176 68/push "Adc"/imm32
177 68/push Abc_kernel_string/imm32
178
179 e8/call kernel_string_equal/disp32
180
181 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
182
183
184 68/push "F - test_compare_kernel_string_with_equal_array"/imm32
185 68/push 0/imm32/false
186 50/push-EAX
187
188 e8/call check_ints_equal/disp32
189
190 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
191 c3/return
192
193 test_compare_kernel_string_with_empty_array:
194
195
196 68/push ""/imm32
197 68/push Abc_kernel_string/imm32
198
199 e8/call kernel_string_equal/disp32
200
201 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
202
203
204 68/push "F - test_compare_kernel_string_with_equal_array"/imm32
205 68/push 0/imm32/false
206 50/push-EAX
207
208 e8/call check_ints_equal/disp32
209
210 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
211 c3/return
212
213 test_compare_kernel_string_with_shorter_array:
214
215
216 68/push "Ab"/imm32
217 68/push Abc_kernel_string/imm32
218
219 e8/call kernel_string_equal/disp32
220
221 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
222
223
224 68/push "F - test_compare_kernel_string_with_shorter_array"/imm32
225 68/push 0/imm32/false
226 50/push-EAX
227
228 e8/call check_ints_equal/disp32
229
230 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
231 c3/return
232
233 test_compare_kernel_string_with_longer_array:
234
235
236 68/push "Abcd"/imm32
237 68/push Abc_kernel_string/imm32
238
239 e8/call kernel_string_equal/disp32
240
241 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
242
243
244 68/push "F - test_compare_kernel_string_with_longer_array"/imm32
245 68/push 0/imm32/false
246 50/push-EAX
247
248 e8/call check_ints_equal/disp32
249
250 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
251 c3/return
252
253 == data
254
255 Null_kernel_string:
256 00/null
257 Abc_kernel_string:
258 41/A 62/b 63/c 00/null
259
260