Fix malloc

This commit is contained in:
pjht 2024-03-20 08:09:22 -05:00
parent 7839336698
commit 0aaaecf565
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -6,7 +6,6 @@
public free
free:
move.l -(a0), d0 ; Read the allocatuon size and get the true hole pointer
free_w_size:
move.l (free_list), a1 ; Get the head of the free list in a0
cmpa.l #0, a1 ; Check if the free list is empty
bne.b free_list_not_empty ; If not, find the right position and insert the hole
@ -97,7 +96,7 @@ malloc_block_exact_size:
adda.l #4, a0
rts
malloc_too_small:
move.l ($8,a0), a0
move.l ($4,a0), a0
bra.b malloc_find_loop
malloc_found_end:
move.l d0, -(a7)
@ -124,7 +123,8 @@ malloc_found_end:
move.l d0, (a1)+
move.l d1, d0
move.l a1, -(a7)
bsr.w free_w_size
move.l d0, (a0)+
bsr.w free
move.l (a7)+, a0
rts