🎉 simple allocator init in the code
This commit is contained in:
@@ -18,12 +18,13 @@ arena_init:
|
|||||||
mov di, ax
|
mov di, ax
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov word [di + ArenaStateStruc_t.mark], eax
|
mov word [di + ArenaStateStruc_t.mark], ax
|
||||||
mov word [di + ArenaStateStruc_t.end], word (__ARENA_HEAP_START + __ARENA_HEAP_SIZE)
|
mov word [di + ArenaStateStruc_t.end], word (__ARENA_HEAP_START + __ARENA_HEAP_SIZE)
|
||||||
mov word [di + ArenaStateStruc_t.start], __ARENA_HEAP_START
|
mov word [di + ArenaStateStruc_t.start], __ARENA_HEAP_START
|
||||||
|
|
||||||
; zero out heap area on init
|
; zero out heap area on init
|
||||||
; void* kmemset_byte(void* dst, uint8_t val, uint16_t len);
|
; void* kmemset_byte(void* dst, uint8_t val, uint16_t len);
|
||||||
|
; TODO: use word or qword spacing at least to speed this up
|
||||||
mov ax, __ARENA_HEAP_SIZE
|
mov ax, __ARENA_HEAP_SIZE
|
||||||
push ax ; len
|
push ax ; len
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
|
|||||||
@@ -158,8 +158,10 @@ main:
|
|||||||
print_string HelloPrompt_info
|
print_string HelloPrompt_info
|
||||||
|
|
||||||
; setup the early heap
|
; setup the early heap
|
||||||
push area
|
mov ax, early_heap_state
|
||||||
|
push ax ; address in bss of state structure
|
||||||
call arena_init
|
call arena_init
|
||||||
|
add sp, 0x2
|
||||||
|
|
||||||
; enable A20 gate
|
; enable A20 gate
|
||||||
call EnableA20
|
call EnableA20
|
||||||
|
|||||||
Reference in New Issue
Block a user