hex2: Use a single allocate_pool call.
This commit is contained in:
parent
62ba4ba253
commit
ce5f77ddc5
|
@ -25,12 +25,6 @@ _start:
|
||||||
mov r14, [rdx+96] # system->boot
|
mov r14, [rdx+96] # system->boot
|
||||||
mov [rip+SystemBoot], r14 # save system->boot
|
mov [rip+SystemBoot], r14 # save system->boot
|
||||||
|
|
||||||
# Allocate pool for scratch area
|
|
||||||
xor edx, edx # zero rdx
|
|
||||||
mov dh, 0x8 # arg2 = 256 * 8 = 2048 = 0x800
|
|
||||||
call allocate_pool
|
|
||||||
mov [rip+scratch], rax # save scratch
|
|
||||||
|
|
||||||
# Open Loaded Image protocol
|
# Open Loaded Image protocol
|
||||||
push rax # allocate stack for image
|
push rax # allocate stack for image
|
||||||
mov r8, rsp # arg3 = &image
|
mov r8, rsp # arg3 = &image
|
||||||
|
@ -122,10 +116,12 @@ loop_options2: # Skip argv[1]
|
||||||
call [rcx+8] # rootdir->open()
|
call [rcx+8] # rootdir->open()
|
||||||
mov r10, [rsp+40] # get fout
|
mov r10, [rsp+40] # get fout
|
||||||
|
|
||||||
# Allocate pool for structs
|
# Allocate ourselves 16 MiB of memory
|
||||||
mov rdx, 0x1000000 # allocate 16 MiB of memory
|
mov rdx, 0x1000000 # allocate 16 MiB of memory
|
||||||
call allocate_pool
|
call allocate_pool
|
||||||
mov r12, rax # get structs
|
mov [rip+scratch], rax # Allocate space for scratch area
|
||||||
|
add rax, 0x800 # 2 KiB of scratch
|
||||||
|
mov r12, rax # save structs pointer
|
||||||
|
|
||||||
call ClearScratch # Zero scratch
|
call ClearScratch # Zero scratch
|
||||||
mov r15, -1 # Our flag for byte processing
|
mov r15, -1 # Our flag for byte processing
|
||||||
|
@ -618,9 +614,6 @@ terminate:
|
||||||
mov rcx, [rip+scratch] # arg1 = scratch
|
mov rcx, [rip+scratch] # arg1 = scratch
|
||||||
call [r14+72] # system->boot->free_pool(scratch)
|
call [r14+72] # system->boot->free_pool(scratch)
|
||||||
|
|
||||||
mov rcx, r12 # arg1 = structs
|
|
||||||
call [r14+72] # system->boot->free_pool(structs)
|
|
||||||
|
|
||||||
mov rcx, [rip+fin] # arg1 = fin
|
mov rcx, [rip+fin] # arg1 = fin
|
||||||
call [rcx+16] # fin->close(fin)
|
call [rcx+16] # fin->close(fin)
|
||||||
pop rax # deallocate stack
|
pop rax # deallocate stack
|
||||||
|
|
Loading…
Reference in New Issue