https://github.com/akkartik/mu/blob/master/050_write.subx
1
2
3 == code
4
5
6
7
8 Entry:
9 bb/copy-to-ebx 0/imm32
10 e8/call syscall_exit/disp32
11
12 _write:
13
14 55/push-ebp
15 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
16
17 50/push-eax
18 51/push-ecx
19 52/push-edx
20 53/push-ebx
21
22
23 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 8/disp8 .
24
25 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0xc/disp8 .
26 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32
27
28 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 .
29 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . .
30
31 e8/call syscall_write/disp32
32
33 3d/compare-eax-with 0/imm32
34 0f 8c/jump-if-< $_write:abort/disp32
35 $_write:end:
36
37 5b/pop-to-ebx
38 5a/pop-to-edx
39 59/pop-to-ecx
40 58/pop-to-eax
41
42 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
43 5d/pop-to-ebp
44 c3/return
45
46 $_write:abort:
47
48
49 bb/copy-to-ebx 0xff/imm32
50 e8/call syscall_exit/disp32
51
52
53