diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-08-26 11:55:26 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-08-26 11:59:21 -0700 |
commit | 333525360b22f3d3ea31db46a4d2f1b4edbfebdb (patch) | |
tree | ed255f308542ba28a99d862d54d4992dcf749622 /053new-segment.subx | |
parent | 22fb844ba4edf14eb85245a35f42e721658c4f8e (diff) | |
download | mu-333525360b22f3d3ea31db46a4d2f1b4edbfebdb.tar.gz |
5592 - switch register names to lowercase
Diffstat (limited to '053new-segment.subx')
-rw-r--r-- | 053new-segment.subx | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/053new-segment.subx b/053new-segment.subx index 83c890ea..4ca74e63 100644 --- a/053new-segment.subx +++ b/053new-segment.subx @@ -17,56 +17,56 @@ # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes Entry: # manual test - # var ad/ECX : (address allocation-descriptor) = {0, 0} + # var ad/ecx : (address allocation-descriptor) = {0, 0} 68/push 0/imm32/limit 68/push 0/imm32/curr - 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX + 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # new-segment(0x1000, ad) # . . push args - 51/push-ECX + 51/push-ecx 68/push 0x1000/imm32 # . . call e8/call new-segment/disp32 # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # EAX = ad->curr - 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . . # copy *ECX to EAX - # write to *EAX to check that we have access to the newly-allocated segment - c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0x34/imm32 # copy to *EAX - # syscall(exit, EAX) - 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX - b8/copy-to-EAX 1/imm32/exit + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # eax = ad->curr + 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax + # write to *eax to check that we have access to the newly-allocated segment + c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0x34/imm32 # copy to *eax + # syscall(exit, eax) + 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx + b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 new-segment: # len : int, ad : (address allocation-descriptor) # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers - 50/push-EAX - 53/push-EBX + 50/push-eax + 53/push-ebx # copy len to _mmap-new-segment->len - 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX - 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX _mmap-new-segment:len/disp32 # copy EAX to *_mmap-new-segment:len + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to eax + 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax _mmap-new-segment:len/disp32 # copy eax to *_mmap-new-segment:len # mmap(_mmap-new-segment) - bb/copy-to-EBX _mmap-new-segment/imm32 - b8/copy-to-EAX 0x5a/imm32/mmap + bb/copy-to-ebx _mmap-new-segment/imm32 + b8/copy-to-eax 0x5a/imm32/mmap cd/syscall 0x80/imm8 - # copy {EAX, EAX+len} to *ad - # . EBX = ad - 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 3/r32/EBX 0xc/disp8 . # copy *(EBP+12) to EBX - # . *EBX = EAX - 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX - # . *(EBX+4) = EAX+len - 03/add 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 8/disp8 . # add *(EBP+8) to EAX - 89/copy 1/mod/*+disp8 3/rm32/EBX . . . 0/r32/EAX 4/disp8 . # copy EAX to *(EBX+4) + # copy {eax, eax+len} to *ad + # . ebx = ad + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 0xc/disp8 . # copy *(ebp+12) to ebx + # . *ebx = eax + 89/copy 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . . # copy eax to *ebx + # . *(ebx+4) = eax+len + 03/add 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 . # add *(ebp+8) to eax + 89/copy 1/mod/*+disp8 3/rm32/ebx . . . 0/r32/eax 4/disp8 . # copy eax to *(ebx+4) $new-segment:end: # . restore registers - 5b/pop-to-EBX - 58/pop-to-EAX + 5b/pop-to-ebx + 58/pop-to-eax # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp c3/return == data |