diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-24 14:16:15 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-24 14:16:15 -0800 |
commit | 3ae1da98a68d2f719ce17766550f7e9682ba8ae7 (patch) | |
tree | 84bede612442051a4f0cdf8d90e6a8913705dd61 | |
parent | 4a7384712116be8b1888b470a4126c193cb5e80b (diff) | |
download | syslinux-3ae1da98a68d2f719ce17766550f7e9682ba8ae7.tar.gz |
core: fix lowmem malloc
a) initialize *all* the head nodes
b) the lowmem heap needs to be paragraph (16 byte) aligned
c) use a dedicated tag value for headnodes. The type code should be
removed and replaced with special tag values for head node and
free.
d) for libcom32 code called from the core, do NOT present a
usable bounce buffer; we should only ever use lmalloc/lfree.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | core/com32.inc | 5 | ||||
-rw-r--r-- | core/mem/init.c | 2 | ||||
-rw-r--r-- | core/mem/malloc.h | 1 | ||||
-rw-r--r-- | core/syslinux.ld | 1 |
4 files changed, 6 insertions, 3 deletions
diff --git a/core/com32.inc b/core/com32.inc index 5d5cac78..6ef07840 100644 --- a/core/com32.inc +++ b/core/com32.inc @@ -126,10 +126,9 @@ __com32: dd 8 ; Argument count dd 0 ; No command line dd core_intcall ; Intcall entry point - dd core_xfer_buf ; Bounce buffer address - dd 1 << 16 ; 64K bounce buffer + dd 0 ; Bounce buffer address + dd 0 ; 64K bounce buffer dd core_farcall ; Farcall entry point dd core_cfarcall ; Cfarcall entry point HighMemSize dd 0 ; End of memory pointer (bytes) dd pm_api_vector ; Protected mode functions - diff --git a/core/mem/init.c b/core/mem/init.c index 03f15099..0fb53770 100644 --- a/core/mem/init.c +++ b/core/mem/init.c @@ -20,6 +20,8 @@ void mem_init(void) for (i = 0 ; i < NHEAP ; i++) { fp->a.next = fp->a.prev = fp->next_free = fp->prev_free = fp; fp->a.attrs = ARENA_TYPE_HEAD | (i << ARENA_HEAP_POS); + fp->a.tag = MALLOC_HEAD; + fp++; } /* Initialize the main heap */ diff --git a/core/mem/malloc.h b/core/mem/malloc.h index 889dfc5c..b8ec44d7 100644 --- a/core/mem/malloc.h +++ b/core/mem/malloc.h @@ -15,6 +15,7 @@ typedef size_t malloc_tag_t; enum malloc_owner { MALLOC_FREE, + MALLOC_HEAD, MALLOC_CORE, MALLOC_MODULE, }; diff --git a/core/syslinux.ld b/core/syslinux.ld index fd5c5fe6..07bd8d42 100644 --- a/core/syslinux.ld +++ b/core/syslinux.ld @@ -243,6 +243,7 @@ SECTIONS __high_clear_dwords = (__high_clear_len + 3) >> 2; /* Start of the lowmem heap */ + . = ALIGN(16); __lowmem_heap = .; /* |