From c88b9e31259d433c7e63fcb19d430daf9b1c723c Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 10 May 2019 16:45:22 -0700 Subject: 5151 - use mmap everywhere we need a heap All tests passing now. Things are very explicit; before a program can `allocate` memory, it has to first obtain a segment from the OS using `new-segment`. --- subx/072slice.subx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'subx/072slice.subx') diff --git a/subx/072slice.subx b/subx/072slice.subx index 9c285097..683c4c7b 100644 --- a/subx/072slice.subx +++ b/subx/072slice.subx @@ -917,14 +917,26 @@ test-slice-to-string: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + # var heap/EDX : (address allocation-descriptor) = {0, 0} + 68/push 0/imm32/limit + 68/push 0/imm32/curr + 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX + # heap = new-segment(512) + # . . push args + 52/push-EDX + 68/push 0x200/imm32 + # . . call + e8/call new-segment/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # var slice/ECX = "Abc" 68/push _test-slice-data-3/imm32/end 68/push _test-slice-data-0/imm32/start 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX - # EAX = slice-to-string(Heap, slice) + # EAX = slice-to-string(heap, slice) # . . push args 51/push-ECX - 68/push Heap/imm32 + 52/push-EDX # . . call e8/call slice-to-string/disp32 # . . discard args -- cgit 1.4.1-2-gfad0