5924
This commit is contained in:
parent
1a65c3af0f
commit
71eb22a5bf
|
@ -21,12 +21,12 @@ _write: # fd : int, s : (addr array byte)
|
|||
52/push-edx
|
||||
53/push-ebx
|
||||
# syscall(write, fd, (data) s+4, (size) *s)
|
||||
# . fd : ebx
|
||||
# . ebx = fd
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 8/disp8 . # copy *(ebp+8) to ebx
|
||||
# . data : ecx = s+4
|
||||
# . var data/ecx: (addr byte) = s+4
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0xc/disp8 . # copy *(ebp+12) to ecx
|
||||
81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32 # add to ecx
|
||||
# . size : edx = *s
|
||||
# . var size/edx: int = *s
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx
|
||||
8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx
|
||||
# . syscall
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1303,7 +1303,7 @@ test-function-header-with-arg:
|
|||
# setup
|
||||
(clear-stream _test-input-stream)
|
||||
(write _test-input-stream "foo n : int {\n")
|
||||
# result/ecx : function
|
||||
# var result/ecx: function
|
||||
2b/subtract-> *Function-size 4/r32/esp
|
||||
89/<- %ecx 4/r32/esp
|
||||
(zero-out %ecx *Function-size)
|
||||
|
|
|
@ -1395,8 +1395,8 @@ compute-addresses: # segments : (addr stream {string, segment-info}), labels :
|
|||
# max = &labels->data[labels->write]
|
||||
# while true
|
||||
# if (lrow >= max) break
|
||||
# seg-name : (addr string) = lrow->segment-name
|
||||
# label-seg : (addr segment-info) = get(segments, seg-name)
|
||||
# var seg-name: (addr string) = lrow->segment-name
|
||||
# var label-seg: (addr segment-info) = get(segments, seg-name)
|
||||
# lrow->address = label-seg->address + lrow->segment-offset
|
||||
# trace-sssns("label " lrow->key " is at address " lrow->address)
|
||||
# lrow += 16 # row-size
|
||||
|
@ -1522,7 +1522,7 @@ $compute-addresses:label-loop:
|
|||
#? # . . discard args
|
||||
#? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
#? # }}}
|
||||
# seg-name/edx = lrow->segment-name
|
||||
# var seg-name/edx: (addr array byte) = lrow->segment-name
|
||||
8b/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 . # copy *eax to edx
|
||||
#? # dump seg-name {{{
|
||||
#? # . write(2/stderr, "compute-addresses: seg-name: ")
|
||||
|
@ -1550,7 +1550,7 @@ $compute-addresses:label-loop:
|
|||
#? # . . discard args
|
||||
#? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
|
||||
#? # }}}
|
||||
# label-seg/edx : (addr segment-info) = get(segments, seg-name, row-size=16, "segment table")
|
||||
# var label-seg/edx: (addr segment-info) = get(segments, seg-name, row-size=16, "segment table")
|
||||
# . save eax
|
||||
50/push-eax
|
||||
# . eax = get(segments, seg-name, row-size=16)
|
||||
|
|
Loading…
Reference in New Issue