#include <string.h>
#include <types.h>
-#ifndef CONFIG_COREBOOT_V2
-#include <cpu.h>
-#endif
#include "debug.h"
#include <x86emu/x86emu.h>
#include <x86emu/regs.h>
-#ifdef CONFIG_COREBOOT_V2
#include "../x86emu/prim_ops.h"
-#else
-#include <x86emu/prim_ops.h> // for push_word
-#endif
#include "biosemu.h"
#include "io.h"
#include "device.h"
#include "pmm.h"
-#ifdef CONFIG_COREBOOT_V2
#include "compat/rtas.h"
-#else
-#include <rtas.h>
-#endif
#include <device/device.h>
/* interrupt function override array (see biosemu.h) */
yabel_handleIntFunc yabel_intFuncArray[256];
-void dump(u8 * addr, u32 len);
-
/* main entry into YABEL biosemu, arguments are:
* *biosmem = pointer to virtual memory
* biosmem_size = size of the virtual memory
{
u8 *rom_image;
int i = 0;
-#ifdef CONFIG_DEBUG
+#ifdef DEBUG
debug_flags = 0;//DEBUG_PRINT_INT10 | DEBUG_PNP | DEBUG_INTR | DEBUG_CHECK_VMEM_ACCESS | DEBUG_MEM | DEBUG_IO;
// | DEBUG_CHECK_VMEM_ACCESS | DEBUG_MEM | DEBUG_IO;
// | DEBUG_TRACE_X86EMU | DEBUG_JMP;
// in case we jump somewhere unexpected, or execution is finished,
// fill the biosmem with hlt instructions (0xf4)
- memset(biosmem, 0xf4, biosmem_size);
+ // But we have to be careful: If biosmem is 0x00000000 we're running
+ // in the lower 1MB and we must not wipe memory like that.
+ if (biosmem) {
+ DEBUG_PRINTF("Clearing biosmem\n");
+ memset(biosmem, 0xf4, biosmem_size);
+ }
+
+ X86EMU_setMemBase(biosmem, biosmem_size);
- M.mem_base = (long) biosmem;
- M.mem_size = biosmem_size;
DEBUG_PRINTF("membase set: %08x, size: %08x\n", (int) M.mem_base,
(int) M.mem_size);
CHECK_DBG(DEBUG_TRACE_X86EMU) {
X86EMU_trace_on();
} else {
-#ifdef CONFIG_DEBUG
+#ifdef DEBUG
M.x86.debug |= DEBUG_SAVE_IP_CS_F;
M.x86.debug |= DEBUG_DECODE_F;
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
* some boot device status in AX (see PNP BIOS Spec Section 3.3
*/
DEBUG_PRINTF_CS_IP("Option ROM Exit Status: %04x\n", M.x86.R_AX);
-#ifdef CONFIG_DEBUG
+#ifdef DEBUG
DEBUG_PRINTF("Exit Status Decode:\n");
if (M.x86.R_AX & 0x100) { // bit 8
DEBUG_PRINTF