diff options
Diffstat (limited to '053new-segment.subx')
-rw-r--r-- | 053new-segment.subx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/053new-segment.subx b/053new-segment.subx index 480035df..a400eeed 100644 --- a/053new-segment.subx +++ b/053new-segment.subx @@ -5,8 +5,8 @@ # Currently an allocation descriptor consists of just the bounds of the pool of # available memory: # -# curr : address -# end : address +# curr: address +# end: address # # This isn't enough information to reclaim individual allocations. We can't # support arbitrary reclamation yet. @@ -17,7 +17,7 @@ # . 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 : allocation-descriptor + # var ad/ecx: allocation-descriptor 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 @@ -29,7 +29,7 @@ Entry: # manual test e8/call new-segment/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # var eax : (addr _) = ad->curr + # var eax: (addr _) = 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 @@ -38,7 +38,7 @@ Entry: # manual test b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -new-segment: # len : int, ad : allocation-descriptor +new-segment: # len: int, ad: (addr allocation-descriptor) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -55,9 +55,9 @@ new-segment: # len : int, ad : allocation-descriptor # 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 + # . ad->curr = eax 89/copy 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . . # copy eax to *ebx - # . *(ebx+4) = eax+len + # . ad->end = 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: |