aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-06-02 16:44:41 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-06-02 16:44:41 -0700
commitbe65e736d7ce7b1961bab7000eb7789c8ba35ef3 (patch)
tree6ed6650767b459a7ad21bd5b06d544b6dde905f0
parent210395ef1babd423194a5c574b491324d567ab6b (diff)
downloadsyslinux-be65e736d7ce7b1961bab7000eb7789c8ba35ef3.tar.gz
syslinux-be65e736d7ce7b1961bab7000eb7789c8ba35ef3.tar.xz
syslinux-be65e736d7ce7b1961bab7000eb7789c8ba35ef3.zip
core: add new __lowmem macro to allocate a static lowmem buffer
Add a new __lowmem macro that can be applied to an uninitialized static (or global) object, which allocates it in a new .lowmem section allocated below the 1 MB boundary. Keep in mind that low memory is precious! Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/include/core.h3
-rw-r--r--core/init.inc5
-rw-r--r--core/layout.inc2
-rw-r--r--core/syslinux.ld21
4 files changed, 25 insertions, 6 deletions
diff --git a/core/include/core.h b/core/include/core.h
index 0975ebf8..e61bf998 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -1,6 +1,7 @@
#ifndef CORE_H
#define CORE_H
+#include <klibc/compiler.h>
#include <com32.h>
extern char core_xfer_buf[65536];
@@ -12,4 +13,6 @@ int __cdecl core_cfarcall(uint32_t, const void *, uint32_t);
void call16(void (*)(void), const com32sys_t *, com32sys_t *);
+#define __lowmem __attribute((nocommon,section(".lowmem")))
+
#endif /* CORE_H */
diff --git a/core/init.inc b/core/init.inc
index 809fa8ee..ec8c7b3b 100644
--- a/core/init.inc
+++ b/core/init.inc
@@ -60,7 +60,6 @@ common_init:
; The code to decompress the PM code and initialize other segments.
;
extern _lzo1x_decompress_asm_fast
- extern __uibss_auxseg_dwords
section .textnr
bits 32
@@ -83,8 +82,8 @@ pm_decompress:
mov edi,__bss16_start
mov ecx,__bss16_dwords
rep stosd
- mov edi,__uibss_start
- mov ecx,__uibss_auxseg_dwords
+ mov edi,__high_clear_start ; .uibss, .auxseg, .lowmem
+ mov ecx,__high_clear_dwords
rep stosd
ret
diff --git a/core/layout.inc b/core/layout.inc
index ec011f35..72236839 100644
--- a/core/layout.inc
+++ b/core/layout.inc
@@ -79,6 +79,8 @@ RBFG_brainfuck: resb 2048 ; Bigger than an Ethernet packet...
SECINFO replacestub
SECINFO pm_code
+ SECINFO high_clear
+
extern __bss_start, __bss_end, __bss_len, __bss_dwords
extern free_high_memory
diff --git a/core/syslinux.ld b/core/syslinux.ld
index eb0e4116..b931ed2e 100644
--- a/core/syslinux.ld
+++ b/core/syslinux.ld
@@ -148,6 +148,8 @@ SECTIONS
. = ALIGN(16);
__pm_code_lma = .;
+ __high_clear_start = .;
+
. = ALIGN(512);
.adv (NOLOAD) : {
__adv_start = .;
@@ -185,9 +187,22 @@ SECTIONS
__auxseg_len = __auxseg_end - __auxseg_start;
__auxseg_dwords = (__auxseg_len + 3) >> 2;
aux_seg = __auxseg_start >> 4;
-
- __uibss_auxseg_len = __auxseg_end - __uibss_start;
- __uibss_auxseg_dwords = (__uibss_auxseg_len + 3) >> 2;
+
+ /*
+ * Used to allocate lowmem buffers from 32-bit code
+ */
+ .lowmem (NOLOAD) : {
+ __lowmem_start = .;
+ *(.lowmem)
+ __lowmem_end = .;
+ }
+ __lowmem_len = __lowmem_end - __lowmem_start;
+ __lowmem_dwords = (__lowmem_len + 3) >> 2;
+
+ __high_clear_end = .;
+
+ __high_clear_len = __high_clear_end - __high_clear_start;
+ __high_clear_dwords = (__high_clear_len + 3) >> 2;
/*
* 32-bit code. This is a hack for the moment due to the