diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-01-17 20:07:09 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-01-17 20:07:09 -0500 |
commit | df2c19ab31b5b9e52f30452d82f0bdd9b89db111 (patch) | |
tree | 2779c468f3411412b0df0381c9494904c08616ba /src | |
parent | f5d025a7e139c865f322c8565008187a553ec1a6 (diff) | |
download | seabios-hppa-df2c19ab31b5b9e52f30452d82f0bdd9b89db111.zip seabios-hppa-df2c19ab31b5b9e52f30452d82f0bdd9b89db111.tar.gz seabios-hppa-df2c19ab31b5b9e52f30452d82f0bdd9b89db111.tar.bz2 |
Reserve space for buffers in f-segment; don't allocate from freespace.
Define the e820list as a regular array.
Define a buffer for run-time built bios tables.
Reserving the space in advance should help prevent run-time errors
when space becomes tight.
Diffstat (limited to 'src')
-rw-r--r-- | src/config.h | 2 | ||||
-rw-r--r-- | src/memmap.c | 21 | ||||
-rw-r--r-- | src/memmap.h | 5 | ||||
-rw-r--r-- | src/misc.c | 3 | ||||
-rw-r--r-- | src/system.c | 9 |
5 files changed, 17 insertions, 23 deletions
diff --git a/src/config.h b/src/config.h index d573726..044e110 100644 --- a/src/config.h +++ b/src/config.h @@ -76,6 +76,8 @@ #define CONFIG_VGAHOOKS 0 // Maximum number of map entries in the e820 map #define CONFIG_MAX_E820 32 +// Space to reserve in f-segment for run-time built bios tables. +#define CONFIG_MAX_BIOSTABLE 512 /* define it if the (emulated) hardware supports SMM mode */ #define CONFIG_USE_SMM 1 diff --git a/src/memmap.c b/src/memmap.c index 01b00d8..3d03248 100644 --- a/src/memmap.c +++ b/src/memmap.c @@ -122,29 +122,16 @@ add_e820(u64 start, u64 size, u32 type) //dump_map(); } -// Symbols defined in romlayout.S -extern char freespace1_start, freespace1_end; - -u32 bios_table_cur_addr, bios_table_end_addr; - // Prep for memmap stuff - init bios table locations. void memmap_setup() { - bios_table_cur_addr = (u32)&freespace1_start; - bios_table_end_addr = (u32)&freespace1_end; + bios_table_cur_addr = (u32)BiosTableSpace; + bios_table_end_addr = bios_table_cur_addr + CONFIG_MAX_BIOSTABLE; dprintf(1, "bios_table_addr: 0x%08x end=0x%08x\n", bios_table_cur_addr, bios_table_end_addr); - bios_table_cur_addr = ALIGN(bios_table_cur_addr, 4); - u32 msize = CONFIG_MAX_E820 * sizeof(e820_list[0]); - if (bios_table_cur_addr + msize > bios_table_end_addr) { - dprintf(1, "No room for e820 map!\n"); - return; - } e820_count = 0; - e820_list = (void*)bios_table_cur_addr; - bios_table_cur_addr += msize; } // Report on final memory locations. @@ -155,8 +142,8 @@ memmap_finalize() dprintf(1, "final bios_table_addr: 0x%08x (used %d%%)\n" , bios_table_cur_addr - , (100 * (bios_table_cur_addr - (u32)&freespace1_start) - / ((u32)&freespace1_end - (u32)&freespace1_start))); + , (100 * (bios_table_cur_addr - (u32)&BiosTableSpace) + / CONFIG_MAX_BIOSTABLE)); if (bios_table_cur_addr > bios_table_end_addr) BX_PANIC("bios_table_end_addr overflow!\n"); } diff --git a/src/memmap.h b/src/memmap.h index 8a6bd79..8338c43 100644 --- a/src/memmap.h +++ b/src/memmap.h @@ -21,10 +21,11 @@ void memmap_setup(); void memmap_finalize(); // e820 map storage (defined in system.c) -extern struct e820entry *e820_list; +extern struct e820entry e820_list[]; extern int e820_count; -// Space for exported bios tables. +// Space for exported bios tables (defined in misc.c) extern u32 bios_table_cur_addr, bios_table_end_addr; +extern char BiosTableSpace[]; #endif // e820map.h @@ -14,6 +14,9 @@ u32 RamSize VAR16_32; // Amount of continuous ram >4Gig u64 RamSizeOver4G; +// Space for bios tables built an run-time. +u32 bios_table_cur_addr, bios_table_end_addr; +char BiosTableSpace[CONFIG_MAX_BIOSTABLE] VAR16_32; /**************************************************************** diff --git a/src/system.c b/src/system.c index ebb8d41..1d0b23b 100644 --- a/src/system.c +++ b/src/system.c @@ -267,7 +267,7 @@ handle_15e801(struct bregs *regs) } // Info on e820 map location and size. -struct e820entry *e820_list VAR16_32; +struct e820entry e820_list[CONFIG_MAX_E820] VAR16_32; int e820_count VAR16_32; static void @@ -279,14 +279,15 @@ handle_15e820(struct bregs *regs) return; } - struct e820entry *l = GET_GLOBAL(e820_list); - memcpy_far(MAKE_FARPTR(regs->es, regs->di), &l[regs->bx], sizeof(l[0])); + memcpy_far(MAKE_FARPTR(regs->es, regs->di) + , MAKE_FARPTR(SEG_BIOS, &e820_list[regs->bx]) + , sizeof(e820_list[0])); if (regs->bx == count-1) regs->ebx = 0; else regs->ebx++; regs->eax = 0x534D4150; - regs->ecx = sizeof(l[0]); + regs->ecx = sizeof(e820_list[0]); set_success(regs); } |