https://github.com/akkartik/mu/blob/master/306files.subx
1 == code
2
3 open:
4
5
6 55/push-ebp
7 89/<- %ebp 4/r32/esp
8
9 50/push-eax
10 51/push-ecx
11 52/push-edx
12 53/push-ebx
13 56/push-esi
14 57/push-edi
15
16 8b/-> *(ebp+8) 1/r32/ecx
17
18 8b/-> *ecx 2/r32/edx
19 42/increment-edx
20
21 29/subtract-from %esp 2/r32/edx
22 52/push-edx
23 68/push 0/imm32/read
24 68/push 0/imm32/write
25 89/<- %esi 4/r32/esp
26
27 (clear-stream %esi)
28 (write %esi %ecx)
29
30 52/push-edx
31
32 8d/copy-address *(esi+0xc) 3/r32/ebx
33 8b/-> *(ebp+0xc) 1/r32/ecx/flags
34 ba/copy-to-edx 0x180/imm32/permissions
35 e8/call syscall_open/disp32
36 89/<- %ecx 0/r32/eax
37
38 5a/pop-to-edx
39
40 (allocate Heap 0x1010 *(ebp+0x10))
41
42 8b/-> *(ebp+0x10) 7/r32/edi
43 (lookup *edi *(edi+4))
44 89/<- %edi 0/r32/eax
45
46 c7 0/subop/copy *(edi+0xc) 0x1000/imm32/file-buffer-size
47
48 89/<- *edi 1/r32/ecx
49 $open:end:
50
51 01/add-to %esp 2/r32/edx
52 81 0/subop/add %esp 0xc/imm32
53
54 5f/pop-to-edi
55 5e/pop-to-esi
56 5b/pop-to-ebx
57 5a/pop-to-edx
58 59/pop-to-ecx
59 58/pop-to-eax
60
61 89/<- %esp 5/r32/ebp
62 5d/pop-to-ebp
63 c3/return