Fix malloc
This commit is contained in:
parent
7839336698
commit
0aaaecf565
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user