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.
#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
//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.
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");
}
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
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;
/****************************************************************
}
// 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
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);
}