mirror of
https://github.com/cc65/cc65.git
synced 2025-01-13 09:31:53 +00:00
add extra underscore to heap stuff
This commit is contained in:
parent
df4b6f9d14
commit
b09024aa32
@ -28,8 +28,8 @@ HEAP_MIN_BLOCKSIZE = .sizeof (freeblock) ; Minimum size of an allocated block
|
|||||||
HEAP_ADMIN_SPACE = .sizeof (usedblock) ; Additional space for used bock
|
HEAP_ADMIN_SPACE = .sizeof (usedblock) ; Additional space for used bock
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
.global __heaporg
|
.global ___heaporg
|
||||||
.global __heapptr
|
.global ___heapptr
|
||||||
.global __heapend
|
.global ___heapend
|
||||||
.global __heapfirst
|
.global ___heapfirst
|
||||||
.global __heaplast
|
.global ___heaplast
|
||||||
|
@ -37,11 +37,11 @@ struct freeblock {
|
|||||||
|
|
||||||
|
|
||||||
/* Variables that describe the heap */
|
/* Variables that describe the heap */
|
||||||
extern unsigned* _heaporg; /* Bottom of heap */
|
extern unsigned* __heaporg; /* Bottom of heap */
|
||||||
extern unsigned* _heapptr; /* Current top */
|
extern unsigned* __heapptr; /* Current top */
|
||||||
extern unsigned* _heapend; /* Upper limit */
|
extern unsigned* __heapend; /* Upper limit */
|
||||||
extern struct freeblock* _heapfirst; /* First free block in list */
|
extern struct freeblock* __heapfirst; /* First free block in list */
|
||||||
extern struct freeblock* _heaplast; /* Last free block in list */
|
extern struct freeblock* __heaplast; /* Last free block in list */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,17 +92,33 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size);
|
|||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __fastcall__ _heapadd (void* mem, size_t size);
|
void __fastcall__ __heapadd (void* mem, size_t size);
|
||||||
/* Add a block to the heap */
|
/* Add a block to the heap */
|
||||||
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||||
|
/* define old name with one underscore for backwards compatibility */
|
||||||
|
#define _heapadd __heapadd
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t __fastcall__ _heapblocksize (const void* block);
|
size_t __fastcall__ __heapblocksize (const void* block);
|
||||||
/* Return the size of an allocated block */
|
/* Return the size of an allocated block */
|
||||||
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||||
|
/* define old name with one underscore for backwards compatibility */
|
||||||
|
#define _heapblocksize __heapblocksize
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t _heapmemavail (void);
|
size_t __heapmemavail (void);
|
||||||
/* Return the total free heap space */
|
/* Return the total free heap space */
|
||||||
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||||
|
/* define old name with one underscore for backwards compatibility */
|
||||||
|
#define _heapmemavail __heapmemavail
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t _heapmaxavail (void);
|
size_t __heapmaxavail (void);
|
||||||
/* Return the size of the largest free block on the heap */
|
/* Return the size of the largest free block on the heap */
|
||||||
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||||
|
/* define old name with one underscore for backwards compatibility */
|
||||||
|
#define _heapmaxavail __heapmaxavail
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Random numbers */
|
/* Random numbers */
|
||||||
|
@ -13,15 +13,15 @@
|
|||||||
|
|
||||||
.data
|
.data
|
||||||
|
|
||||||
__heaporg:
|
___heaporg:
|
||||||
.word __BSS_RUN__+__BSS_SIZE__ ; Linker calculates this symbol
|
.word __BSS_RUN__+__BSS_SIZE__ ; Linker calculates this symbol
|
||||||
__heapptr:
|
___heapptr:
|
||||||
.word __BSS_RUN__+__BSS_SIZE__ ; Dito
|
.word __BSS_RUN__+__BSS_SIZE__ ; Dito
|
||||||
__heapend:
|
___heapend:
|
||||||
.word __BSS_RUN__+__BSS_SIZE__
|
.word __BSS_RUN__+__BSS_SIZE__
|
||||||
__heapfirst:
|
___heapfirst:
|
||||||
.word 0
|
.word 0
|
||||||
__heaplast:
|
___heaplast:
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
|
|
||||||
@ -33,10 +33,10 @@ initheap:
|
|||||||
sec
|
sec
|
||||||
lda sp
|
lda sp
|
||||||
sbc #<__STACKSIZE__
|
sbc #<__STACKSIZE__
|
||||||
sta __heapend
|
sta ___heapend
|
||||||
lda sp+1
|
lda sp+1
|
||||||
sbc #>__STACKSIZE__
|
sbc #>__STACKSIZE__
|
||||||
sta __heapend+1
|
sta ___heapend+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
.importzp ptr1, ptr2
|
.importzp ptr1, ptr2
|
||||||
.import popax
|
.import popax
|
||||||
.import heapadd
|
.import heapadd
|
||||||
.export __heapadd
|
.export ___heapadd
|
||||||
|
|
||||||
.include "_heap.inc"
|
.include "_heap.inc"
|
||||||
|
|
||||||
@ -19,7 +19,7 @@
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Code
|
; Code
|
||||||
|
|
||||||
__heapadd:
|
___heapadd:
|
||||||
sta ptr1 ; Store size in ptr1
|
sta ptr1 ; Store size in ptr1
|
||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
jsr popax ; Get the block pointer
|
jsr popax ; Get the block pointer
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.importzp ptr1, ptr2
|
.importzp ptr1, ptr2
|
||||||
.export __heapblocksize
|
.export ___heapblocksize
|
||||||
|
|
||||||
.include "_heap.inc"
|
.include "_heap.inc"
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Code
|
; Code
|
||||||
|
|
||||||
__heapblocksize:
|
___heapblocksize:
|
||||||
|
|
||||||
; Below the user data is a pointer that points to the start of the real
|
; Below the user data is a pointer that points to the start of the real
|
||||||
; (raw) memory block. The first word of this block is the size. To access
|
; (raw) memory block. The first word of this block is the size. To access
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.importzp ptr1, ptr2
|
.importzp ptr1, ptr2
|
||||||
.export __heapmaxavail
|
.export ___heapmaxavail
|
||||||
|
|
||||||
.include "_heap.inc"
|
.include "_heap.inc"
|
||||||
|
|
||||||
@ -17,22 +17,22 @@
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Code
|
; Code
|
||||||
|
|
||||||
__heapmaxavail:
|
___heapmaxavail:
|
||||||
|
|
||||||
; size_t Size = (_heapend - _heapptr) * sizeof (*_heapend);
|
; size_t Size = (_heapend - _heapptr) * sizeof (*_heapend);
|
||||||
|
|
||||||
lda __heapend
|
lda ___heapend
|
||||||
sub __heapptr
|
sub ___heapptr
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda __heapend+1
|
lda ___heapend+1
|
||||||
sbc __heapptr+1
|
sbc ___heapptr+1
|
||||||
sta ptr2+1
|
sta ptr2+1
|
||||||
|
|
||||||
; struct freeblock* F = _heapfirst;
|
; struct freeblock* F = _heapfirst;
|
||||||
|
|
||||||
lda __heapfirst
|
lda ___heapfirst
|
||||||
sta ptr1
|
sta ptr1
|
||||||
lda __heapfirst+1
|
lda ___heapfirst+1
|
||||||
@L1: sta ptr1+1
|
@L1: sta ptr1+1
|
||||||
|
|
||||||
; while (F) {
|
; while (F) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.importzp ptr1, ptr2
|
.importzp ptr1, ptr2
|
||||||
.export __heapmemavail
|
.export ___heapmemavail
|
||||||
|
|
||||||
.include "_heap.inc"
|
.include "_heap.inc"
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Code
|
; Code
|
||||||
|
|
||||||
__heapmemavail:
|
___heapmemavail:
|
||||||
|
|
||||||
; size_t Size = 0;
|
; size_t Size = 0;
|
||||||
|
|
||||||
@ -27,9 +27,9 @@ __heapmemavail:
|
|||||||
|
|
||||||
; struct freeblock* F = _heapfirst;
|
; struct freeblock* F = _heapfirst;
|
||||||
|
|
||||||
lda __heapfirst
|
lda ___heapfirst
|
||||||
sta ptr1
|
sta ptr1
|
||||||
lda __heapfirst+1
|
lda ___heapfirst+1
|
||||||
@L1: sta ptr1+1
|
@L1: sta ptr1+1
|
||||||
|
|
||||||
; while (F) {
|
; while (F) {
|
||||||
@ -61,17 +61,17 @@ __heapmemavail:
|
|||||||
; return Size + (_heapend - _heapptr) * sizeof (*_heapend);
|
; return Size + (_heapend - _heapptr) * sizeof (*_heapend);
|
||||||
|
|
||||||
@L2: lda ptr2
|
@L2: lda ptr2
|
||||||
add __heapend
|
add ___heapend
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda ptr2+1
|
lda ptr2+1
|
||||||
adc __heapend+1
|
adc ___heapend+1
|
||||||
tax
|
tax
|
||||||
|
|
||||||
lda ptr2
|
lda ptr2
|
||||||
sub __heapptr
|
sub ___heapptr
|
||||||
sta ptr2
|
sta ptr2
|
||||||
txa
|
txa
|
||||||
sbc __heapptr+1
|
sbc ___heapptr+1
|
||||||
tax
|
tax
|
||||||
lda ptr2
|
lda ptr2
|
||||||
|
|
||||||
|
@ -105,27 +105,27 @@ _free: sta ptr2
|
|||||||
tay
|
tay
|
||||||
lda ptr2+1
|
lda ptr2+1
|
||||||
adc ptr1+1
|
adc ptr1+1
|
||||||
cpy __heapptr
|
cpy ___heapptr
|
||||||
bne heapadd ; Add to free list
|
bne heapadd ; Add to free list
|
||||||
cmp __heapptr+1
|
cmp ___heapptr+1
|
||||||
bne heapadd
|
bne heapadd
|
||||||
|
|
||||||
; The pointer is located at the heap top. Lower the heap top pointer to
|
; The pointer is located at the heap top. Lower the heap top pointer to
|
||||||
; release the block.
|
; release the block.
|
||||||
|
|
||||||
@L3: lda ptr2
|
@L3: lda ptr2
|
||||||
sta __heapptr
|
sta ___heapptr
|
||||||
lda ptr2+1
|
lda ptr2+1
|
||||||
sta __heapptr+1
|
sta ___heapptr+1
|
||||||
|
|
||||||
; Check if the last block in the freelist is now at heap top. If so, remove
|
; Check if the last block in the freelist is now at heap top. If so, remove
|
||||||
; this block from the freelist.
|
; this block from the freelist.
|
||||||
|
|
||||||
lda __heaplast
|
lda ___heaplast
|
||||||
sta ptr1
|
sta ptr1
|
||||||
ora __heaplast+1
|
ora ___heaplast+1
|
||||||
beq @L9 ; Jump if free list empty
|
beq @L9 ; Jump if free list empty
|
||||||
lda __heaplast+1
|
lda ___heaplast+1
|
||||||
sta ptr1+1 ; Pointer to last block now in ptr1
|
sta ptr1+1 ; Pointer to last block now in ptr1
|
||||||
|
|
||||||
ldy #freeblock::size
|
ldy #freeblock::size
|
||||||
@ -136,35 +136,35 @@ _free: sta ptr2
|
|||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
adc ptr1+1
|
adc ptr1+1
|
||||||
|
|
||||||
cmp __heapptr+1
|
cmp ___heapptr+1
|
||||||
bne @L9 ; Jump if last block not on top of heap
|
bne @L9 ; Jump if last block not on top of heap
|
||||||
cpx __heapptr
|
cpx ___heapptr
|
||||||
bne @L9 ; Jump if last block not on top of heap
|
bne @L9 ; Jump if last block not on top of heap
|
||||||
|
|
||||||
; Remove the last block
|
; Remove the last block
|
||||||
|
|
||||||
lda ptr1
|
lda ptr1
|
||||||
sta __heapptr
|
sta ___heapptr
|
||||||
lda ptr1+1
|
lda ptr1+1
|
||||||
sta __heapptr+1
|
sta ___heapptr+1
|
||||||
|
|
||||||
; Correct the next pointer of the now last block
|
; Correct the next pointer of the now last block
|
||||||
|
|
||||||
ldy #freeblock::prev+1 ; Offset of ->prev field
|
ldy #freeblock::prev+1 ; Offset of ->prev field
|
||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
sta ptr2+1 ; Remember f->prev in ptr2
|
sta ptr2+1 ; Remember f->prev in ptr2
|
||||||
sta __heaplast+1
|
sta ___heaplast+1
|
||||||
dey
|
dey
|
||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
sta ptr2 ; Remember f->prev in ptr2
|
sta ptr2 ; Remember f->prev in ptr2
|
||||||
sta __heaplast
|
sta ___heaplast
|
||||||
ora __heaplast+1 ; -> prev == 0?
|
ora ___heaplast+1 ; -> prev == 0?
|
||||||
bne @L8 ; Jump if free list not empty
|
bne @L8 ; Jump if free list not empty
|
||||||
|
|
||||||
; Free list is now empty (A = 0)
|
; Free list is now empty (A = 0)
|
||||||
|
|
||||||
sta __heapfirst
|
sta ___heapfirst
|
||||||
sta __heapfirst+1
|
sta ___heapfirst+1
|
||||||
|
|
||||||
; Done
|
; Done
|
||||||
|
|
||||||
@ -283,9 +283,9 @@ _free: sta ptr2
|
|||||||
; Check if the free list is empty, storing _hfirst into ptr3 for later
|
; Check if the free list is empty, storing _hfirst into ptr3 for later
|
||||||
|
|
||||||
heapadd:
|
heapadd:
|
||||||
lda __heapfirst
|
lda ___heapfirst
|
||||||
sta ptr3
|
sta ptr3
|
||||||
lda __heapfirst+1
|
lda ___heapfirst+1
|
||||||
sta ptr3+1
|
sta ptr3+1
|
||||||
ora ptr3
|
ora ptr3
|
||||||
bne SearchFreeList
|
bne SearchFreeList
|
||||||
@ -301,10 +301,10 @@ heapadd:
|
|||||||
|
|
||||||
lda ptr2
|
lda ptr2
|
||||||
ldx ptr2+1
|
ldx ptr2+1
|
||||||
sta __heapfirst
|
sta ___heapfirst
|
||||||
stx __heapfirst+1 ; _heapfirst = f;
|
stx ___heapfirst+1 ; _heapfirst = f;
|
||||||
sta __heaplast
|
sta ___heaplast
|
||||||
stx __heaplast+1 ; _heaplast = f;
|
stx ___heaplast+1 ; _heaplast = f;
|
||||||
|
|
||||||
rts ; Done
|
rts ; Done
|
||||||
|
|
||||||
@ -351,9 +351,9 @@ SearchFreeList:
|
|||||||
sta (ptr2),y ; Clear low byte of f->next
|
sta (ptr2),y ; Clear low byte of f->next
|
||||||
|
|
||||||
lda ptr2 ; _heaplast = f;
|
lda ptr2 ; _heaplast = f;
|
||||||
sta __heaplast
|
sta ___heaplast
|
||||||
lda ptr2+1
|
lda ptr2+1
|
||||||
sta __heaplast+1
|
sta ___heaplast+1
|
||||||
|
|
||||||
; Since we have checked the case that the freelist is empty before, if the
|
; Since we have checked the case that the freelist is empty before, if the
|
||||||
; right pointer is NULL, the left *cannot* be NULL here. So skip the
|
; right pointer is NULL, the left *cannot* be NULL here. So skip the
|
||||||
@ -414,9 +414,9 @@ CheckRightMerge:
|
|||||||
; f->next is zero, this is now the last block
|
; f->next is zero, this is now the last block
|
||||||
|
|
||||||
@L1: lda ptr2 ; _heaplast = f;
|
@L1: lda ptr2 ; _heaplast = f;
|
||||||
sta __heaplast
|
sta ___heaplast
|
||||||
lda ptr2+1
|
lda ptr2+1
|
||||||
sta __heaplast+1
|
sta ___heaplast+1
|
||||||
jmp CheckLeftMerge
|
jmp CheckLeftMerge
|
||||||
|
|
||||||
; No right merge, just set the link.
|
; No right merge, just set the link.
|
||||||
@ -451,9 +451,9 @@ CheckLeftMerge:
|
|||||||
sta (ptr2),y
|
sta (ptr2),y
|
||||||
|
|
||||||
lda ptr2 ; _heapfirst = f;
|
lda ptr2 ; _heapfirst = f;
|
||||||
sta __heapfirst
|
sta ___heapfirst
|
||||||
lda ptr2+1
|
lda ptr2+1
|
||||||
sta __heapfirst+1
|
sta ___heapfirst+1
|
||||||
|
|
||||||
rts ; Done
|
rts ; Done
|
||||||
|
|
||||||
@ -510,9 +510,9 @@ CheckLeftMerge2:
|
|||||||
; This is now the last block, do _heaplast = left
|
; This is now the last block, do _heaplast = left
|
||||||
|
|
||||||
@L1: lda ptr4
|
@L1: lda ptr4
|
||||||
sta __heaplast
|
sta ___heaplast
|
||||||
lda ptr4+1
|
lda ptr4+1
|
||||||
sta __heaplast+1
|
sta ___heaplast+1
|
||||||
rts ; Done
|
rts ; Done
|
||||||
|
|
||||||
; No merge of the left block, just set the link. Y points to size+1 if
|
; No merge of the left block, just set the link. Y points to size+1 if
|
||||||
|
@ -140,9 +140,9 @@ _malloc:
|
|||||||
|
|
||||||
; Load a pointer to the freelist into ptr2
|
; Load a pointer to the freelist into ptr2
|
||||||
|
|
||||||
@L2: lda __heapfirst
|
@L2: lda ___heapfirst
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda __heapfirst+1
|
lda ___heapfirst+1
|
||||||
sta ptr2+1
|
sta ptr2+1
|
||||||
|
|
||||||
; Search the freelist for a block that is big enough. We will calculate
|
; Search the freelist for a block that is big enough. We will calculate
|
||||||
@ -173,16 +173,16 @@ _malloc:
|
|||||||
|
|
||||||
; We did not find a block big enough. Try to use new space from the heap top.
|
; We did not find a block big enough. Try to use new space from the heap top.
|
||||||
|
|
||||||
lda __heapptr
|
lda ___heapptr
|
||||||
add ptr1 ; _heapptr + size
|
add ptr1 ; _heapptr + size
|
||||||
tay
|
tay
|
||||||
lda __heapptr+1
|
lda ___heapptr+1
|
||||||
adc ptr1+1
|
adc ptr1+1
|
||||||
bcs OutOfHeapSpace ; On overflow, we're surely out of space
|
bcs OutOfHeapSpace ; On overflow, we're surely out of space
|
||||||
|
|
||||||
cmp __heapend+1
|
cmp ___heapend+1
|
||||||
bne @L5
|
bne @L5
|
||||||
cpy __heapend
|
cpy ___heapend
|
||||||
@L5: bcc TakeFromTop
|
@L5: bcc TakeFromTop
|
||||||
beq TakeFromTop
|
beq TakeFromTop
|
||||||
|
|
||||||
@ -196,13 +196,13 @@ Done: rts
|
|||||||
; There is enough space left, take it from the heap top
|
; There is enough space left, take it from the heap top
|
||||||
|
|
||||||
TakeFromTop:
|
TakeFromTop:
|
||||||
ldx __heapptr ; p = _heapptr;
|
ldx ___heapptr ; p = _heapptr;
|
||||||
stx ptr2
|
stx ptr2
|
||||||
ldx __heapptr+1
|
ldx ___heapptr+1
|
||||||
stx ptr2+1
|
stx ptr2+1
|
||||||
|
|
||||||
sty __heapptr ; _heapptr += size;
|
sty ___heapptr ; _heapptr += size;
|
||||||
sta __heapptr+1
|
sta ___heapptr+1
|
||||||
jmp FillSizeAndRet ; Done
|
jmp FillSizeAndRet ; Done
|
||||||
|
|
||||||
; We found a block big enough. If the block can hold just the
|
; We found a block big enough. If the block can hold just the
|
||||||
@ -245,10 +245,10 @@ BlockFound:
|
|||||||
; Do _hfirst = f->next
|
; Do _hfirst = f->next
|
||||||
|
|
||||||
@L1: lda (ptr2),y ; Load high byte of f->next
|
@L1: lda (ptr2),y ; Load high byte of f->next
|
||||||
sta __heapfirst+1
|
sta ___heapfirst+1
|
||||||
dey ; Points to next
|
dey ; Points to next
|
||||||
lda (ptr2),y ; Load low byte of f->next
|
lda (ptr2),y ; Load low byte of f->next
|
||||||
sta __heapfirst
|
sta ___heapfirst
|
||||||
|
|
||||||
; Check f->next. Y points always to next if we come here
|
; Check f->next. Y points always to next if we come here
|
||||||
|
|
||||||
@ -275,10 +275,10 @@ BlockFound:
|
|||||||
; Do _hlast = f->prev
|
; Do _hlast = f->prev
|
||||||
|
|
||||||
@L3: lda (ptr2),y ; Load low byte of f->prev
|
@L3: lda (ptr2),y ; Load low byte of f->prev
|
||||||
sta __heaplast
|
sta ___heaplast
|
||||||
iny ; Points to prev+1
|
iny ; Points to prev+1
|
||||||
lda (ptr2),y ; Load high byte of f->prev
|
lda (ptr2),y ; Load high byte of f->prev
|
||||||
sta __heaplast+1
|
sta ___heaplast+1
|
||||||
jmp RetUserPtr ; Done
|
jmp RetUserPtr ; Done
|
||||||
|
|
||||||
; We must slice the block found. Cut off space from the upper end, so we
|
; We must slice the block found. Cut off space from the upper end, so we
|
||||||
|
@ -74,12 +74,12 @@ void* __fastcall__ realloc (void* block, register size_t size)
|
|||||||
oldsize = b->size;
|
oldsize = b->size;
|
||||||
|
|
||||||
/* Is the block at the current heap top? */
|
/* Is the block at the current heap top? */
|
||||||
if (((unsigned) b) + oldsize == ((unsigned) _heapptr)) {
|
if (((unsigned) b) + oldsize == ((unsigned) __heapptr)) {
|
||||||
/* Check if we've enough memory at the heap top */
|
/* Check if we've enough memory at the heap top */
|
||||||
newhptr = ((unsigned) _heapptr) - oldsize + size;
|
newhptr = ((unsigned) __heapptr) - oldsize + size;
|
||||||
if (newhptr <= ((unsigned) _heapend)) {
|
if (newhptr <= ((unsigned) __heapend)) {
|
||||||
/* Ok, there's space enough */
|
/* Ok, there's space enough */
|
||||||
_heapptr = (unsigned*) newhptr;
|
__heapptr = (unsigned*) newhptr;
|
||||||
b->size = size;
|
b->size = size;
|
||||||
b->start = b;
|
b->start = b;
|
||||||
return block;
|
return block;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user