https://github.com/akkartik/mu/blob/main/linux/ex10.subx
1
2
3
4
5
6
7
8
9
10 == code
11
12
13
14
15 Entry:
16
17
18
19
20
21
22 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
23
24
25 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
26
27 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
28
29 e8/call argv-equal/disp32
30
31 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
32 e8/call syscall_exit/disp32
33
34
35
36 argv-equal:
37
38 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 1/r32/ecx 4/disp8 .
39 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 2/r32/edx 8/disp8 .
40 $argv-equal:loop:
41
42 b8/copy-to-eax 0/imm32
43 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
44 bb/copy-to-ebx 0/imm32
45 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
46
47 3d/compare-eax-and 0/imm32/null
48 74/jump-if-= $argv-equal:break/disp8
49
50 39/compare 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
51 75/jump-if-!= $argv-equal:false/disp8
52
53 41/increment-ecx
54 42/increment-edx
55
56 eb/jump $argv-equal:loop/disp8
57 $argv-equal:break:
58
59 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32/null
60 75/jump-if-!= $argv-equal:false/disp8
61 $argv-equal:success:
62 b8/copy-to-eax 1/imm32
63 c3/return
64
65 $argv-equal:false:
66 b8/copy-to-eax 0/imm32
67 c3/return
68
69