https://github.com/akkartik/mu/blob/master/053new-segment.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14 == code
15
16
17
18
19 Entry:
20
21 68/push 0/imm32/limit
22 68/push 0/imm32/curr
23 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
24
25
26 51/push-ecx
27 68/push 0x1000/imm32
28
29 e8/call new-segment/disp32
30
31 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
32
33 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
34
35 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0x34/imm32
36
37 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
38 b8/copy-to-eax 1/imm32/exit
39 cd/syscall 0x80/imm8
40
41 new-segment:
42
43 55/push-ebp
44 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
45
46 50/push-eax
47 53/push-ebx
48
49 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 .
50 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax _mmap-new-segment:len/disp32
51
52 bb/copy-to-ebx _mmap-new-segment/imm32
53 b8/copy-to-eax 0x5a/imm32/mmap
54 cd/syscall 0x80/imm8
55
56
57 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 0xc/disp8 .
58
59 89/copy 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . .
60
61 03/add 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 .
62 89/copy 1/mod/*+disp8 3/rm32/ebx . . . 0/r32/eax 4/disp8 .
63 $new-segment:end:
64
65 5b/pop-to-ebx
66 58/pop-to-eax
67
68 89/copy 3/mod/direct 4/rm32/esp cgit-pink 1.4.1-2-gfad0 (git 2.36.2.497.gbbea4dcf42) at 2025-01-01 09:10:22 +0000