x86 realmode: Use x86emu register file + defines

By using the (global) register file as defined by x86emu,
we can use the same register access for YABEL and realmode
interrupt handlers.

- the x86 realmode interrupt handlers changed in signature
- to access registers, use X86_$REGNAME now (eg. X86_EAX)
- x86_exception_handler still uses struct eregs *regs to
  avoid spilling the x86emu register file stuff everywhere

Coccinelle script that handled most of this commit:
  @ inthandler @
  identifier FUNC, regs;
  @@
  int FUNC(
  -struct eregs *regs
  +void
   )
  { ... }

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->eax
  +X86_EAX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->ebx
  +X86_EBX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->ecx
  +X86_ECX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->edx
  +X86_EDX

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->esi
  +X86_ESI

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->edi
  +X86_EDI

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->eflags
  +X86_EFLAGS

  @ depends on inthandler @
  identifier regs;
  @@
  -regs->vector
  +M.x86.intno

Change-Id: I60cc2c36646fe4b7f97457b1e297e3df086daa36
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/1891
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/devices/oprom/realmode/x86.c b/src/devices/oprom/realmode/x86.c
index 2e01617..6a82a69 100644
--- a/src/devices/oprom/realmode/x86.c
+++ b/src/devices/oprom/realmode/x86.c
@@ -31,6 +31,11 @@
 #include "x86.h"
 #include "vbe.h"
 #include <lib/jpeg.h>
+/* we use x86emu's register file representation */
+#include <x86emu/regs.h>
+
+/* to have a common register file for interrupt handlers */
+X86EMU_sysEnv _X86EMU_env;
 
 void (*realmode_call)(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx,
 		u32 esi, u32 edi) __attribute__((regparm(0))) =
@@ -52,10 +57,28 @@
 	write8(0xffffe, 0xfc);
 }
 
-int (*intXX_handler[256])(struct eregs *regs) = { NULL };
+static int (*intXX_handler[256])(void) = { NULL };
 
-static int intXX_exception_handler(struct eregs *regs)
+static int intXX_exception_handler(void)
 {
+	/* compatibility shim */
+	struct eregs reg_info = {
+		.eax=X86_EAX,
+		.ecx=X86_ECX,
+		.edx=X86_EDX,
+		.ebx=X86_EBX,
+		.esp=X86_ESP,
+		.ebp=X86_EBP,
+		.esi=X86_ESI,
+		.edi=X86_EDI,
+		.vector=M.x86.intno,
+		.error_code=0, // FIXME: fill in
+		.eip=X86_EIP,
+		.cs=X86_CS,
+		.eflags=X86_EFLAGS
+	};
+	struct eregs *regs = &reg_info;
+
 	printk(BIOS_INFO, "Oops, exception %d while executing option rom\n",
 			regs->vector);
 	x86_exception(regs);	// Call coreboot exception handler
@@ -63,10 +86,10 @@
 	return 0;		// Never really returns
 }
 
-static int intXX_unknown_handler(struct eregs *regs)
+static int intXX_unknown_handler(void)
 {
 	printk(BIOS_INFO, "Unsupported software interrupt #0x%x eax 0x%x\n",
-			regs->vector, regs->eax);
+			M.x86.intno, X86_EAX);
 
 	return -1;
 }
@@ -403,7 +426,6 @@
 	u32 cs;
 	u32 flags;
 	int ret = 0;
-	struct eregs reg_info;
 
 	ip = cs_ip & 0xffff;
 	cs = cs_ip >> 16;
@@ -419,27 +441,24 @@
 		     ip, cs, flags);
 #endif
 
-	// Fetch arguments from the stack and put them into
-	// a structure that we want to pass on to our sub interrupt
-	// handlers.
-	reg_info = (struct eregs) {
-		.eax=eax,
-		.ecx=ecx,
-		.edx=edx,
-		.ebx=ebx,
-		.esp=esp,
-		.ebp=ebp,
-		.esi=esi,
-		.edi=edi,
-		.vector=intnumber,
-		.error_code=0, // ??
-		.eip=ip,
-		.cs=cs,
-		.eflags=flags // ??
-	};
+	// Fetch arguments from the stack and put them to a place
+	// suitable for the interrupt handlers
+	X86_EAX = eax;
+	X86_ECX = ecx;
+	X86_EDX = edx;
+	X86_EBX = ebx;
+	X86_ESP = esp;
+	X86_EBP = ebp;
+	X86_ESI = esi;
+	X86_EDI = edi;
+	M.x86.intno = intnumber;
+	/* TODO: error_code must be stored somewhere */
+	X86_EIP = ip;
+	X86_CS = cs;
+	X86_EFLAGS = flags;
 
 	// Call the interrupt handler for this int#
-	ret = intXX_handler[intnumber](&reg_info);
+	ret = intXX_handler[intnumber]();
 
 	// Put registers back on the stack. The assembler code
 	// will later pop them.
@@ -447,13 +466,13 @@
 	// the values of the parameters of this function. We do this
 	// because we know that they stay alive on the stack after
 	// we leave this function. Don't say this is bollocks.
-	*(volatile u32 *)&eax = reg_info.eax;
-	*(volatile u32 *)&ecx = reg_info.ecx;
-	*(volatile u32 *)&edx = reg_info.edx;
-	*(volatile u32 *)&ebx = reg_info.ebx;
-	*(volatile u32 *)&esi = reg_info.esi;
-	*(volatile u32 *)&edi = reg_info.edi;
-	flags = reg_info.eflags;
+	*(volatile u32 *)&eax = X86_EAX;
+	*(volatile u32 *)&ecx = X86_ECX;
+	*(volatile u32 *)&edx = X86_EDX;
+	*(volatile u32 *)&ebx = X86_EBX;
+	*(volatile u32 *)&esi = X86_ESI;
+	*(volatile u32 *)&edi = X86_EDI;
+	flags = X86_EFLAGS;
 
 	/* Pass success or error back to our caller via the CARRY flag */
 	if (ret) {
diff --git a/src/devices/oprom/realmode/x86.h b/src/devices/oprom/realmode/x86.h
index 40c5778..7dfa60f 100644
--- a/src/devices/oprom/realmode/x86.h
+++ b/src/devices/oprom/realmode/x86.h
@@ -42,8 +42,8 @@
 #define INITIAL_EBDA_SEGMENT 0xF600
 #define INITIAL_EBDA_SIZE 0x400
 
-int int10_handler(struct eregs *regs);
-int int12_handler(struct eregs *regs);
-int int16_handler(struct eregs *regs);
-int int1a_handler(struct eregs *regs);
+int int10_handler(void);
+int int12_handler(void);
+int int16_handler(void);
+int int1a_handler(void);
 
diff --git a/src/devices/oprom/realmode/x86_interrupts.c b/src/devices/oprom/realmode/x86_interrupts.c
index b4ff135..b3764f9 100644
--- a/src/devices/oprom/realmode/x86_interrupts.c
+++ b/src/devices/oprom/realmode/x86_interrupts.c
@@ -27,6 +27,8 @@
 #include <arch/io.h>
 #include <arch/registers.h>
 #include "x86.h"
+/* we use x86emu's register file representation */
+#include <x86emu/regs.h>
 
 // errors go in AH. Just set these up so that word assigns
 // will work. KISS.
@@ -38,27 +40,27 @@
 	PCIBIOS_BADREG = 0x8700
 };
 
-int int10_handler(struct eregs *regs)
+int int10_handler(void)
 {
 	int res=0;
 	static u8 cursor_row=0, cursor_col=0;
-	switch((regs->eax & 0xff00)>>8) {
+	switch((X86_EAX & 0xff00)>>8) {
 	case 0x01: // Set cursor shape
 		res = 1;
 		break;
 	case 0x02: // Set cursor position
-		if (cursor_row != ((regs->edx >> 8) & 0xff) ||
-		    cursor_col >= (regs->edx & 0xff)) {
+		if (cursor_row != ((X86_EDX >> 8) & 0xff) ||
+		    cursor_col >= (X86_EDX & 0xff)) {
 			printk(BIOS_INFO, "\n");
 		}
-		cursor_row = (regs->edx >> 8) & 0xff;
-		cursor_col = regs->edx & 0xff;
+		cursor_row = (X86_EDX >> 8) & 0xff;
+		cursor_col = X86_EDX & 0xff;
 		res = 1;
 		break;
 	case 0x03: // Get cursor position
-		regs->eax &= 0x00ff;
-		regs->ecx = 0x0607;
-		regs->edx = (cursor_row << 8) | cursor_col;
+		X86_EAX &= 0x00ff;
+		X86_ECX = 0x0607;
+		X86_EDX = (cursor_row << 8) | cursor_col;
 		res = 1;
 		break;
 	case 0x06: // Scroll up
@@ -66,48 +68,48 @@
 		res = 1;
 		break;
 	case 0x08: // Get Character and Mode at Cursor Position
-		regs->eax = 0x0f00 | 'A'; // White on black 'A'
+		X86_EAX = 0x0f00 | 'A'; // White on black 'A'
 		res = 1;
 		break;
 	case 0x09: // Write Character and attribute
 	case 0x0e: // Write Character
-		printk(BIOS_INFO, "%c", regs->eax & 0xff);
+		printk(BIOS_INFO, "%c", X86_EAX & 0xff);
 		res = 1;
 		break;
 	case 0x0f: // Get video mode
-		regs->eax = 0x5002; //80x25
-		regs->ebx &= 0x00ff;
+		X86_EAX = 0x5002; //80x25
+		X86_EBX &= 0x00ff;
 		res = 1;
 		break;
         default:
 		printk(BIOS_WARNING, "Unknown INT10 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
 }
 
-int int12_handler(struct eregs *regs)
+int int12_handler(void)
 {
-	regs->eax = 64 * 1024;
+	X86_EAX = 64 * 1024;
 	return 1;
 }
 
-int int16_handler(struct eregs *regs)
+int int16_handler(void)
 {
 	int res=0;
-	switch((regs->eax & 0xff00)>>8) {
+	switch((X86_EAX & 0xff00)>>8) {
 	case 0x00: // Check for Keystroke
-		regs->eax = 0x6120; // Space Bar, Space
+		X86_EAX = 0x6120; // Space Bar, Space
 		res = 1;
 		break;
 	case 0x01: // Check for Keystroke
-		regs->eflags |= 1<<6; // Zero Flag set (no key available)
+		X86_EFLAGS |= 1<<6; // Zero Flag set (no key available)
 		res = 1;
 		break;
         default:
 		printk(BIOS_WARNING, "Unknown INT16 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
@@ -116,9 +118,9 @@
 #define PCI_CONFIG_SPACE_TYPE1	(1 << 0)
 #define PCI_SPECIAL_CYCLE_TYPE1	(1 << 4)
 
-int int1a_handler(struct eregs *regs)
+int int1a_handler(void)
 {
-	unsigned short func = (unsigned short)regs->eax;
+	unsigned short func = (unsigned short)X86_EAX;
 	int retval = 1;
 	unsigned short devid, vendorid, devfn;
 	/* Use short to get rid of gabage in upper half of 32-bit register */
@@ -131,19 +133,19 @@
 
 	switch (func) {
 	case 0xb101: /* PCIBIOS Check */
-		regs->edx = 0x20494350;	/* ' ICP' */
-		regs->eax &= 0xffff0000; /* Clear AH / AL */
-		regs->eax |= PCI_CONFIG_SPACE_TYPE1 | PCI_SPECIAL_CYCLE_TYPE1;
+		X86_EDX = 0x20494350;	/* ' ICP' */
+		X86_EAX &= 0xffff0000; /* Clear AH / AL */
+		X86_EAX |= PCI_CONFIG_SPACE_TYPE1 | PCI_SPECIAL_CYCLE_TYPE1;
 		// last bus in the system. Hard code to 255 for now.
 		// dev_enumerate() does not seem to tell us (publically)
-		regs->ecx = 0xff;
-		regs->edi = 0x00000000;	/* protected mode entry */
+		X86_ECX = 0xff;
+		X86_EDI = 0x00000000;	/* protected mode entry */
 		retval = 1;
 		break;
 	case 0xb102: /* Find Device */
-		devid = regs->ecx;
-		vendorid = regs->edx;
-		devindex = regs->esi;
+		devid = X86_ECX;
+		vendorid = X86_EDX;
+		devindex = X86_ESI;
 		dev = 0;
 		while ((dev = dev_find_device(vendorid, devid, dev))) {
 			if (devindex <= 0)
@@ -152,18 +154,18 @@
 		}
 		if (dev) {
 			unsigned short busdevfn;
-			regs->eax &= 0xffff00ff; /* Clear AH */
-			regs->eax |= PCIBIOS_SUCCESSFUL;
+			X86_EAX &= 0xffff00ff; /* Clear AH */
+			X86_EAX |= PCIBIOS_SUCCESSFUL;
 			// busnum is an unsigned char;
 			// devfn is an int, so we mask it off.
 			busdevfn = (dev->bus->secondary << 8)
 			    | (dev->path.pci.devfn & 0xff);
 			printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn);
-			regs->ebx = busdevfn;
+			X86_EBX = busdevfn;
 			retval = 1;
 		} else {
-			regs->eax &= 0xffff00ff; /* Clear AH */
-			regs->eax |= PCIBIOS_NODEV;
+			X86_EAX &= 0xffff00ff; /* Clear AH */
+			X86_EAX |= PCIBIOS_NODEV;
 			retval = 0;
 		}
 		break;
@@ -173,57 +175,57 @@
 	case 0xb10d: /* Write Config Dword */
 	case 0xb10c: /* Write Config Word */
 	case 0xb10b: /* Write Config Byte */
-		devfn = regs->ebx & 0xff;
-		bus = regs->ebx >> 8;
-		reg = regs->edi;
+		devfn = X86_EBX & 0xff;
+		bus = X86_EBX >> 8;
+		reg = X86_EDI;
 		dev = dev_find_slot(bus, devfn);
 		if (!dev) {
 			printk(BIOS_DEBUG, "0x%x: BAD DEVICE bus %d devfn 0x%x\n", func, bus, devfn);
 			// Or are we supposed to return PCIBIOS_NODEV?
-			regs->eax &= 0xffff00ff; /* Clear AH */
-			regs->eax |= PCIBIOS_BADREG;
+			X86_EAX &= 0xffff00ff; /* Clear AH */
+			X86_EAX |= PCIBIOS_BADREG;
 			retval = 0;
 			return retval;
 		}
 		switch (func) {
 		case 0xb108: /* Read Config Byte */
 			byte = pci_read_config8(dev, reg);
-			regs->ecx = byte;
+			X86_ECX = byte;
 			break;
 		case 0xb109: /* Read Config Word */
 			word = pci_read_config16(dev, reg);
-			regs->ecx = word;
+			X86_ECX = word;
 			break;
 		case 0xb10a: /* Read Config Dword */
 			dword = pci_read_config32(dev, reg);
-			regs->ecx = dword;
+			X86_ECX = dword;
 			break;
 		case 0xb10b: /* Write Config Byte */
-			byte = regs->ecx;
+			byte = X86_ECX;
 			pci_write_config8(dev, reg, byte);
 			break;
 		case 0xb10c: /* Write Config Word */
-			word = regs->ecx;
+			word = X86_ECX;
 			pci_write_config16(dev, reg, word);
 			break;
 		case 0xb10d: /* Write Config Dword */
-			dword = regs->ecx;
+			dword = X86_ECX;
 			pci_write_config32(dev, reg, dword);
 			break;
 		}
 
 #if CONFIG_REALMODE_DEBUG
 		printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%x\n",
-			     func, bus, devfn, reg, regs->ecx);
+			     func, bus, devfn, reg, X86_ECX);
 #endif
-		regs->eax &= 0xffff00ff; /* Clear AH */
-		regs->eax |= PCIBIOS_SUCCESSFUL;
+		X86_EAX &= 0xffff00ff; /* Clear AH */
+		X86_EAX |= PCIBIOS_SUCCESSFUL;
 		retval = 1;
 		break;
 	default:
 		printk(BIOS_ERR, "UNSUPPORTED PCIBIOS FUNCTION 0x%x\n", func);
-		regs->eax &= 0xffff00ff; /* Clear AH */
-		regs->eax |= PCIBIOS_UNSUPPORTED;
+		X86_EAX &= 0xffff00ff; /* Clear AH */
+		X86_EAX |= PCIBIOS_UNSUPPORTED;
 		retval = 0;
 		break;
 	}
diff --git a/src/mainboard/intel/emeraldlake2/mainboard.c b/src/mainboard/intel/emeraldlake2/mainboard.c
index ae7f72a..28dc92e 100644
--- a/src/mainboard/intel/emeraldlake2/mainboard.c
+++ b/src/mainboard/intel/emeraldlake2/mainboard.c
@@ -25,7 +25,7 @@
 #include <device/pci_def.h>
 #include <device/pci_ops.h>
 #include <console/console.h>
-#if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
 #include <x86emu/x86emu.h>
 #endif
 #include <pc80/mc146818rtc.h>
@@ -43,14 +43,14 @@
 }
 
 #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
-static int int15_handler(struct eregs *regs)
+static int int15_handler(void)
 {
 	int res=0;
 
 	printk(BIOS_DEBUG, "%s: INT15 function %04x!\n",
-			__func__, regs->eax & 0xffff);
+			__func__, X86_EAX & 0xffff);
 
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f34:
 		/*
 		 * Set Panel Fitting Hook:
@@ -59,10 +59,10 @@
 		 *  bit 0 = Centering (do not set with bit1 or bit2)
 		 *  0     = video bios default
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffffff00;
-		regs->ecx |= 0x01;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffffff00;
+		X86_ECX |= 0x01;
 		res = 1;
 		break;
 	case 0x5f35:
@@ -77,10 +77,10 @@
 		 *  bit 6 = EFP2 *
 		 *  bit 7 = LFP2
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffff0000;
-		regs->ecx |= 0x0000;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffff0000;
+		X86_ECX |= 0x0000;
 		res = 1;
 		break;
 	case 0x5f51:
@@ -91,49 +91,49 @@
 		 *  02h = SVDO-LVDS, LFP driven by SVDO decoder
 		 *  03h = eDP, LFP Driven by Int-DisplayPort encoder
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffff0000;
-		regs->ecx |= 0x0003;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffff0000;
+		X86_ECX |= 0x0003;
 		res = 1;
 		break;
 	case 0x5f70:
-		switch ((regs->ecx >> 8) & 0xff) {
+		switch ((X86_ECX >> 8) & 0xff) {
 		case 0:
 			/* Get Mux */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		case 1:
 			/* Set Mux */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		case 2:
 			/* Get SG/Non-SG mode */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		default:
 			/* FIXME: Interrupt was not handled, but return success? */
 			printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
-				((regs->ecx >> 8) & 0xff));
+				((X86_ECX >> 8) & 0xff));
 			return 1;
 		}
 		break;
 
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/mainboard/kontron/986lcd-m/mainboard.c b/src/mainboard/kontron/986lcd-m/mainboard.c
index 3951ce6..600058d 100644
--- a/src/mainboard/kontron/986lcd-m/mainboard.c
+++ b/src/mainboard/kontron/986lcd-m/mainboard.c
@@ -20,7 +20,7 @@
 #include <types.h>
 #include <device/device.h>
 #include <console/console.h>
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
 #include <x86emu/x86emu.h>
 #endif
 #include <pc80/mc146818rtc.h>
@@ -64,7 +64,7 @@
 #endif
 
 #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
-static int int15_handler(struct eregs *regs)
+static int int15_handler(void)
 {
 	int res = 0;
 
@@ -73,7 +73,7 @@
 	 * the mainboard or northbridge code.
 	 * TODO: completely move to mainboards / chipsets.
 	 */
-	switch (regs->eax & 0xffff) {
+	switch (X86_EAX & 0xffff) {
 	/* And now Intel IGD code */
 #define BOOT_DISPLAY_DEFAULT    0
 #define BOOT_DISPLAY_CRT        (1 << 0)
@@ -85,19 +85,19 @@
 #define BOOT_DISPLAY_EFP2       (1 << 6)
 #define BOOT_DISPLAY_LCD2       (1 << 7)
 	case 0x5f35:
-		regs->eax = 0x5f;
-		regs->ecx = BOOT_DISPLAY_DEFAULT;
+		X86_EAX = 0x5f;
+		X86_ECX = BOOT_DISPLAY_DEFAULT;
 		res = 1;
 		break;
 	case 0x5f40:
-		regs->eax = 0x5f;
-		regs->ecx = 3; // This is mainboard specific
-		printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx);
+		X86_EAX = 0x5f;
+		X86_ECX = 3; // This is mainboard specific
+		printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
 		res = 1;
 		break;
 	default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 	}
 
 	return res;
diff --git a/src/mainboard/roda/rk886ex/mainboard.c b/src/mainboard/roda/rk886ex/mainboard.c
index f4e43bd..6d46edd 100644
--- a/src/mainboard/roda/rk886ex/mainboard.c
+++ b/src/mainboard/roda/rk886ex/mainboard.c
@@ -24,7 +24,7 @@
 #include <arch/io.h>
 #include <arch/interrupt.h>
 #include <delay.h>
-#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
 #include <x86emu/x86emu.h>
 #endif
 
@@ -91,7 +91,7 @@
 #endif
 
 #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
-static int int15_handler(struct eregs *regs)
+static int int15_handler(void)
 {
 	int res = 0;
 
@@ -100,7 +100,7 @@
 	 * the mainboard or northbridge code.
 	 * TODO: completely move to mainboards / chipsets.
 	 */
-	switch (regs->eax & 0xffff) {
+	switch (X86_EAX & 0xffff) {
 	/* And now Intel IGD code */
 #define BOOT_DISPLAY_DEFAULT    0
 #define BOOT_DISPLAY_CRT        (1 << 0)
@@ -112,19 +112,19 @@
 #define BOOT_DISPLAY_EFP2       (1 << 6)
 #define BOOT_DISPLAY_LCD2       (1 << 7)
 	case 0x5f35:
-		regs->eax = 0x5f;
-		regs->ecx = BOOT_DISPLAY_DEFAULT;
+		X86_EAX = 0x5f;
+		X86_ECX = BOOT_DISPLAY_DEFAULT;
 		res = 1;
 		break;
 	case 0x5f40:
-		regs->eax = 0x5f;
-		regs->ecx = 3; // This is mainboard specific
-		printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx);
+		X86_EAX = 0x5f;
+		X86_ECX = 3; // This is mainboard specific
+		printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
 		res = 1;
 		break;
 	default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 	}
 
 	return res;
diff --git a/src/mainboard/samsung/lumpy/mainboard.c b/src/mainboard/samsung/lumpy/mainboard.c
index 3408248..a3dc2c0 100644
--- a/src/mainboard/samsung/lumpy/mainboard.c
+++ b/src/mainboard/samsung/lumpy/mainboard.c
@@ -24,7 +24,7 @@
 #include <device/pci_def.h>
 #include <device/pci_ops.h>
 #include <console/console.h>
-#if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
 #include <x86emu/x86emu.h>
 #endif
 #include <pc80/mc146818rtc.h>
@@ -50,14 +50,14 @@
 }
 
 #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
-static int int15_handler(struct eregs *regs)
+static int int15_handler(void)
 {
 	int res=0;
 
 	printk(BIOS_DEBUG, "%s: INT15 function %04x!\n",
-			__func__, regs->eax & 0xffff);
+			__func__, X86_EAX & 0xffff);
 
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f34:
 		/*
 		 * Set Panel Fitting Hook:
@@ -66,10 +66,10 @@
 		 *  bit 0 = Centering (do not set with bit1 or bit2)
 		 *  0     = video bios default
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffffff00;
-		regs->ecx |= 0x00;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffffff00;
+		X86_ECX |= 0x00;
 		res = 1;
 		break;
 	case 0x5f35:
@@ -84,10 +84,10 @@
 		 *  bit 6 = EFP2 *
 		 *  bit 7 = LFP2
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffff0000;
-		regs->ecx |= 0x0000;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffff0000;
+		X86_ECX |= 0x0000;
 		res = 1;
 		break;
 	case 0x5f51:
@@ -98,49 +98,49 @@
 		 *  02h = SVDO-LVDS, LFP driven by SVDO decoder
 		 *  03h = eDP, LFP Driven by Int-DisplayPort encoder
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffff0000;
-		regs->ecx |= 0x0001;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffff0000;
+		X86_ECX |= 0x0001;
 		res = 1;
 		break;
 	case 0x5f70:
-		switch ((regs->ecx >> 8) & 0xff) {
+		switch ((X86_ECX >> 8) & 0xff) {
 		case 0:
 			/* Get Mux */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		case 1:
 			/* Set Mux */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		case 2:
 			/* Get SG/Non-SG mode */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		default:
 			/* FIXME: Interrupt was not handled, but return success? */
 			printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
-				((regs->ecx >> 8) & 0xff));
+				((X86_ECX >> 8) & 0xff));
 			return 1;
 		}
 		break;
 
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/mainboard/samsung/stumpy/mainboard.c b/src/mainboard/samsung/stumpy/mainboard.c
index fe70948f..b0981fd 100644
--- a/src/mainboard/samsung/stumpy/mainboard.c
+++ b/src/mainboard/samsung/stumpy/mainboard.c
@@ -25,7 +25,7 @@
 #include <device/pci_def.h>
 #include <device/pci_ops.h>
 #include <console/console.h>
-#if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN
 #include <x86emu/x86emu.h>
 #endif
 #include <pc80/mc146818rtc.h>
@@ -43,14 +43,14 @@
 }
 
 #if defined(CONFIG_PCI_OPTION_ROM_RUN_REALMODE) && CONFIG_PCI_OPTION_ROM_RUN_REALMODE
-static int int15_handler(struct eregs *regs)
+static int int15_handler(void)
 {
 	int res=0;
 
 	printk(BIOS_DEBUG, "%s: INT15 function %04x!\n",
-			__func__, regs->eax & 0xffff);
+			__func__, X86_EAX & 0xffff);
 
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f34:
 		/*
 		 * Set Panel Fitting Hook:
@@ -59,10 +59,10 @@
 		 *  bit 0 = Centering (do not set with bit1 or bit2)
 		 *  0     = video bios default
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffffff00;
-		regs->ecx |= 0x01;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffffff00;
+		X86_ECX |= 0x01;
 		res = 1;
 		break;
 	case 0x5f35:
@@ -77,10 +77,10 @@
 		 *  bit 6 = EFP2 *
 		 *  bit 7 = LFP2
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffff0000;
-		regs->ecx |= 0x0000;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffff0000;
+		X86_ECX |= 0x0000;
 		res = 1;
 		break;
 	case 0x5f51:
@@ -91,49 +91,49 @@
 		 *  02h = SVDO-LVDS, LFP driven by SVDO decoder
 		 *  03h = eDP, LFP Driven by Int-DisplayPort encoder
 		 */
-		regs->eax &= 0xffff0000;
-		regs->eax |= 0x005f;
-		regs->ecx &= 0xffff0000;
-		regs->ecx |= 0x0003;
+		X86_EAX &= 0xffff0000;
+		X86_EAX |= 0x005f;
+		X86_ECX &= 0xffff0000;
+		X86_ECX |= 0x0003;
 		res = 1;
 		break;
 	case 0x5f70:
-		switch ((regs->ecx >> 8) & 0xff) {
+		switch ((X86_ECX >> 8) & 0xff) {
 		case 0:
 			/* Get Mux */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		case 1:
 			/* Set Mux */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		case 2:
 			/* Get SG/Non-SG mode */
-			regs->eax &= 0xffff0000;
-			regs->eax |= 0x005f;
-			regs->ecx &= 0xffff0000;
-			regs->ecx |= 0x0000;
+			X86_EAX &= 0xffff0000;
+			X86_EAX |= 0x005f;
+			X86_ECX &= 0xffff0000;
+			X86_ECX |= 0x0000;
 			res = 1;
 			break;
 		default:
 			/* FIXME: Interrupt was not handled, but return sucess? */
 			printk(BIOS_DEBUG, "Unknown INT15 5f70 function: 0x%02x\n",
-				((regs->ecx >> 8) & 0xff));
+				((X86_ECX >> 8) & 0xff));
 			return 1;
 		}
 		break;
 
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/mainboard/siemens/sitemp_g1p1/int15_func.c b/src/mainboard/siemens/sitemp_g1p1/int15_func.c
index c653191..9740262 100644
--- a/src/mainboard/siemens/sitemp_g1p1/int15_func.c
+++ b/src/mainboard/siemens/sitemp_g1p1/int15_func.c
@@ -25,21 +25,22 @@
 #include <stdlib.h>
 #include <console/console.h>
 #include <arch/interrupt.h>
+#include <x86emu/regs.h>
 #include "int15_func.h"
 
-int sbios_INT15_handler(struct eregs *);
+int sbios_INT15_handler(void);
 /*extern*/ unsigned long vgainfo_addr;
 
 static INT15_function_extensions __int15_func;
 
 /* System BIOS int15 function */
-int sbios_INT15_handler(struct eregs *regs)
+int sbios_INT15_handler(void)
 {
     int res = -1;
 
     printk(BIOS_DEBUG, "System BIOS INT 15h\n");
 
-    switch (regs->eax & 0xffff) {
+    switch (X86_EAX & 0xffff) {
 #define BOOT_DISPLAY_DEFAULT    0
 #define BOOT_DISPLAY_CRT        (1 << 0)
 #define BOOT_DISPLAY_TV         (1 << 1)
@@ -50,42 +51,42 @@
 #define BOOT_DISPLAY_EFP2       (1 << 6)
 #define BOOT_DISPLAY_LCD2       (1 << 7)
 	case 0x5f35:
-		regs->eax = 0x5f;
-		regs->ecx = BOOT_DISPLAY_DEFAULT;
+		X86_EAX = 0x5f;
+		X86_ECX = BOOT_DISPLAY_DEFAULT;
 		res = 0;
 		break;
 	case 0x5f40:
-		regs->eax = 0x5f;
-		regs->ecx = 3; // This is mainboard specific
-		printk(BIOS_DEBUG, "DISPLAY=%x\n", regs->ecx);
+		X86_EAX = 0x5f;
+		X86_ECX = 3; // This is mainboard specific
+		printk(BIOS_DEBUG, "DISPLAY=%x\n", X86_ECX);
 		res = 0;
 		break;
     case 0x4e08:
-        switch (regs->ebx & 0xff) {
+        switch (X86_EBX & 0xff) {
         case 0x00:
-            regs->eax &= ~(0xff);
-            regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id;
-			printk(BIOS_DEBUG, "DISPLAY = %x\n", regs->ebx & 0xff);
+            X86_EAX &= ~(0xff);
+            X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func00_LCD_panel_id;
+			printk(BIOS_DEBUG, "DISPLAY = %x\n", X86_EBX & 0xff);
             res = 0;
 			break;
 		case 0x02:
 			break;
         case 0x05:
-            regs->eax &= ~(0xff);
-            regs->ebx = (regs->ebx & ~(0xff)) | __int15_func.regs.func05_TV_standard;
-			printk(BIOS_DEBUG, "TV = %x\n", regs->ebx & 0xff);
+            X86_EAX &= ~(0xff);
+            X86_EBX = (X86_EBX & ~(0xff)) | __int15_func.regs.func05_TV_standard;
+			printk(BIOS_DEBUG, "TV = %x\n", X86_EBX & 0xff);
             res = 0;
 			break;
 		case 0x80:
-			regs->eax &= ~(0xff);
-			regs->ebx &= ~(0xff);
-			printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", regs->edx, regs->edi);
-			vgainfo_addr = (regs->edx * 16) + regs->edi;
+			X86_EAX &= ~(0xff);
+			X86_EBX &= ~(0xff);
+			printk(BIOS_DEBUG, "Integrated System Information = %x:%x\n", X86_EDX, X86_EDI);
+			vgainfo_addr = (X86_EDX * 16) + X86_EDI;
 			res = 0;
 			break;
 		case 0x89:
-			regs->eax &= ~(0xff);
-			regs->ebx &= ~(0xff);
+			X86_EAX &= ~(0xff);
+			X86_EBX &= ~(0xff);
 			printk(BIOS_DEBUG, "Get supported display device information\n");
 			res = 0;
 			break;
@@ -94,7 +95,7 @@
         }
         break;
 	default:
-        printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", regs->eax & 0xffff);
+        printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n", X86_EAX & 0xffff);
 		break;
     }
 
diff --git a/src/mainboard/technexion/tim5690/vgabios.c b/src/mainboard/technexion/tim5690/vgabios.c
index 6c9b45e..46a9b58 100644
--- a/src/mainboard/technexion/tim5690/vgabios.c
+++ b/src/mainboard/technexion/tim5690/vgabios.c
@@ -24,9 +24,10 @@
 #include <console/console.h>
 #include <arch/interrupt.h>
 #include "vgabios.h"
+#include <x86emu/regs.h>
 
 
-int tim5690_int15_handler(struct eregs *regs);
+int tim5690_int15_handler(void);
 
 static rs690_vbios_regs vbios_regs_local;
 
@@ -38,30 +39,30 @@
 }
 
 /* BIOS int15 function */
-int tim5690_int15_handler(struct eregs *regs)
+int tim5690_int15_handler(void)
 {
         int res = 0;
 
         printk(BIOS_DEBUG, "tim5690_int15_handler\n");
 
-        switch (regs->eax & 0xffff) {
+        switch (X86_EAX & 0xffff) {
         case AMD_RS690_INT15:
-                switch (regs->ebx & 0xff) {
+                switch (X86_EBX & 0xff) {
                 case 0x00:
-                        regs->eax &= ~(0xff);
-                        regs->ebx = (regs->ebx & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id;
+                        X86_EAX &= ~(0xff);
+                        X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun00_panel_id;
                         res = 1;
                         break;
                 case 0x05:
-                        regs->eax &= ~(0xff);
-                        regs->ebx = (regs->ebx & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard;
+                        X86_EAX &= ~(0xff);
+                        X86_EBX = (X86_EBX & ~(0xff)) | vbios_regs_local.int15_regs.fun05_tv_standard;
                         res = 1;
                         break;
                 }
                 break;
         default:
                 printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-                                regs->eax & 0xffff);
+                                X86_EAX & 0xffff);
 		break;
         }
 
diff --git a/src/northbridge/via/cn400/vga.c b/src/northbridge/via/cn400/vga.c
index fa598aa..d8c921a 100644
--- a/src/northbridge/via/cn400/vga.c
+++ b/src/northbridge/via/cn400/vga.c
@@ -36,41 +36,42 @@
 #include <arch/interrupt.h>
 #include "northbridge.h"
 #include "cn400.h"
+#include <x86emu/regs.h>
 
-static int via_cn400_int15_handler(struct eregs *regs)
+static int via_cn400_int15_handler(void)
 {
 	int res=0;
 	printk(BIOS_DEBUG, "via_cn400_int15_handler\n");
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f19:
 		break;
 	case 0x5f18:
-		regs->eax=0x5f;
-		regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
-		regs->ecx=0x060;
+		X86_EAX=0x5f;
+		X86_EBX=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
+		X86_ECX=0x060;
 		res=1;
 		break;
 	case 0x5f00:
-		regs->eax = 0x8600;
+		X86_EAX = 0x8600;
 		break;
 	case 0x5f01:
-		regs->eax = 0x5f;
-		regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
+		X86_EAX = 0x5f;
+		X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
 		res = 1;
 		break;
 	case 0x5f02:
-		regs->eax=0x5f;
-		regs->ebx= (regs->ebx & 0xffff0000) | 2;
-		regs->ecx= (regs->ecx & 0xffff0000) | 0x401;  // PAL + crt only
-		regs->edx= (regs->edx & 0xffff0000) | 0;  // TV Layout - default
+		X86_EAX=0x5f;
+		X86_EBX= (X86_EBX & 0xffff0000) | 2;
+		X86_ECX= (X86_ECX & 0xffff0000) | 0x401;  // PAL + crt only
+		X86_EDX= (X86_EDX & 0xffff0000) | 0;  // TV Layout - default
 		res=1;
 		break;
 	case 0x5f0f:
-		regs->eax=0x860f;
+		X86_EAX=0x860f;
 		break;
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/northbridge/via/cn700/vga.c b/src/northbridge/via/cn700/vga.c
index c231459..0f96b2c 100644
--- a/src/northbridge/via/cn700/vga.c
+++ b/src/northbridge/via/cn700/vga.c
@@ -36,41 +36,42 @@
 #include <arch/interrupt.h>
 #include "northbridge.h"
 #include "cn700.h"
+#include <x86emu/regs.h>
 
-static int via_cn700_int15_handler(struct eregs *regs)
+static int via_cn700_int15_handler(void)
 {
 	int res=0;
 	printk(BIOS_DEBUG, "via_cn700_int15_handler\n");
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f19:
 		break;
 	case 0x5f18:
-		regs->eax=0x5f;
-		regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
-		regs->ecx=0x060;
+		X86_EAX=0x5f;
+		X86_EBX=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
+		X86_ECX=0x060;
 		res=1;
 		break;
 	case 0x5f00:
-		regs->eax = 0x8600;
+		X86_EAX = 0x8600;
 		break;
 	case 0x5f01:
-		regs->eax = 0x5f;
-		regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
+		X86_EAX = 0x5f;
+		X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
 		res = 1;
 		break;
 	case 0x5f02:
-		regs->eax=0x5f;
-		regs->ebx= (regs->ebx & 0xffff0000) | 2;
-		regs->ecx= (regs->ecx & 0xffff0000) | 0x401;  // PAL + crt only
-		regs->edx= (regs->edx & 0xffff0000) | 0;  // TV Layout - default
+		X86_EAX=0x5f;
+		X86_EBX= (X86_EBX & 0xffff0000) | 2;
+		X86_ECX= (X86_ECX & 0xffff0000) | 0x401;  // PAL + crt only
+		X86_EDX= (X86_EDX & 0xffff0000) | 0;  // TV Layout - default
 		res=1;
 		break;
 	case 0x5f0f:
-		regs->eax=0x860f;
+		X86_EAX=0x860f;
 		break;
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/northbridge/via/cx700/vga.c b/src/northbridge/via/cx700/vga.c
index 658535d..6b60354 100644
--- a/src/northbridge/via/cx700/vga.c
+++ b/src/northbridge/via/cx700/vga.c
@@ -31,6 +31,7 @@
 #include <cpu/x86/msr.h>
 #include <arch/interrupt.h>
 #include "registers.h"
+#include <x86emu/regs.h>
 #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
 #include <devices/oprom/realmode/x86.h>
 #endif
@@ -44,7 +45,7 @@
 #define CRTC_INDEX	0x3d4
 #define CRTC_DATA	0x3d5
 
-static int via_cx700_int15_handler(struct eregs *regs)
+static int via_cx700_int15_handler(void)
 {
 	int res=0;
 	u8 mem_speed;
@@ -67,62 +68,62 @@
 
 	printk(BIOS_DEBUG, "via_cx700_int15_handler\n");
 
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f00:	/* VGA POST Initialization Signal */
-		regs->eax = (regs->eax & 0xffff0000 ) | 0x5f;
+		X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
 		res = 1;
 		break;
 
 	case 0x5f01:	/* Software Panel Type Configuration */
-		regs->eax = (regs->eax & 0xffff0000 ) | 0x5f;
+		X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
 		// panel type =  2 = 1024 * 768
-		regs->ecx = (regs->ecx & 0xffffff00 ) | 2;
+		X86_ECX = (X86_ECX & 0xffffff00 ) | 2;
 		res = 1;
 		break;
 
 	case 0x5f27:	/* Boot Device Selection */
-		regs->eax = (regs->eax & 0xffff0000 ) | 0x5f;
+		X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
 
-		regs->ebx = 0x00000000; // 0 -> default
-		regs->ecx = 0x00000000; // 0 -> default
+		X86_EBX = 0x00000000; // 0 -> default
+		X86_ECX = 0x00000000; // 0 -> default
 		// TV Layout - default
-		regs->edx = (regs->edx & 0xffffff00) | 0;
+		X86_EDX = (X86_EDX & 0xffffff00) | 0;
 		res=1;
 		break;
 
 	case 0x5f0b:	/* Get Expansion Setting */
-		regs->eax = (regs->eax & 0xffff0000 ) | 0x5f;
+		X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
 
-		regs->ecx = regs->ecx & 0xffffff00; // non-expansion
+		X86_ECX = X86_ECX & 0xffffff00; // non-expansion
 		// regs->ecx = regs->ecx & 0xffffff00 | 1; // expansion
 		res=1;
 		break;
 
 	case 0x5f0f:	/* VGA Post Completion */
-		regs->eax = (regs->eax & 0xffff0000 ) | 0x5f;
+		X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
 		res=1;
 		break;
 
 	case 0x5f18:
-		regs->eax = (regs->eax & 0xffff0000 ) | 0x5f;
+		X86_EAX = (X86_EAX & 0xffff0000 ) | 0x5f;
 #define UMA_SIZE_8MB		(3 << 0)
 #define UMA_SIZE_16MB		(4 << 0)
 #define UMA_SIZE_32MB		(5 << 0)
 
-		regs->ebx = (regs->ebx & 0xffff0000 ) | MEMORY_SPEED_533MHZ | UMA_SIZE_32MB;
+		X86_EBX = (X86_EBX & 0xffff0000 ) | MEMORY_SPEED_533MHZ | UMA_SIZE_32MB;
 
 		mem_speed = pci_read_config8(dev_find_slot(0, PCI_DEVFN(0, 4)), SCRATCH_DRAM_FREQ);
 		if (mem_speed > 5)
 			mem_speed = 5;
 
-		regs->ebx |= memory_mapping[mem_speed];
+		X86_EBX |= memory_mapping[mem_speed];
 
 		res=1;
 		break;
 
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/northbridge/via/vt8623/vga.c b/src/northbridge/via/vt8623/vga.c
index 8e9bd6d..954ff47 100644
--- a/src/northbridge/via/vt8623/vga.c
+++ b/src/northbridge/via/vt8623/vga.c
@@ -30,44 +30,45 @@
 #include <cpu/x86/mtrr.h>
 #include <cpu/x86/msr.h>
 #include <arch/interrupt.h>
+#include <x86emu/regs.h>
 #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
 #include <devices/oprom/realmode/x86.h>
 #endif
 
-static int via_vt8623_int15_handler(struct eregs *regs)
+static int via_vt8623_int15_handler(void)
 {
 	int res=0;
 	printk(BIOS_DEBUG, "via_vt8623_int15_handler\n");
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f19:
 		break;
 	case 0x5f18:
-		regs->eax=0x5f;
-		regs->ebx=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
-		regs->ecx=0x060;
+		X86_EAX=0x5f;
+		X86_EBX=0x545; // MCLK = 133, 32M frame buffer, 256 M main memory
+		X86_ECX=0x060;
 		res=1;
 		break;
 	case 0x5f00:
-		regs->eax = 0x8600;
+		X86_EAX = 0x8600;
 		break;
 	case 0x5f01:
-		regs->eax = 0x5f;
-		regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
+		X86_EAX = 0x5f;
+		X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
 		res = 1;
 		break;
 	case 0x5f02:
-		regs->eax=0x5f;
-		regs->ebx= (regs->ebx & 0xffff0000) | 2;
-		regs->ecx= (regs->ecx & 0xffff0000) | 0x401;  // PAL + crt only
-		regs->edx= (regs->edx & 0xffff0000) | 0;  // TV Layout - default
+		X86_EAX=0x5f;
+		X86_EBX= (X86_EBX & 0xffff0000) | 2;
+		X86_ECX= (X86_ECX & 0xffff0000) | 0x401;  // PAL + crt only
+		X86_EDX= (X86_EDX & 0xffff0000) | 0;  // TV Layout - default
 		res=1;
 		break;
 	case 0x5f0f:
-		regs->eax=0x860f;
+		X86_EAX=0x860f;
 		break;
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
+				X86_EAX & 0xffff);
 		break;
 	}
 	return res;
diff --git a/src/northbridge/via/vx800/vga.c b/src/northbridge/via/vx800/vga.c
index be522f8..319dbda 100644
--- a/src/northbridge/via/vx800/vga.c
+++ b/src/northbridge/via/vx800/vga.c
@@ -33,6 +33,7 @@
 #include <cpu/x86/mtrr.h>
 #include <cpu/x86/msr.h>
 #include <arch/interrupt.h>
+#include <x86emu/regs.h>
 #if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
 #include <devices/oprom/realmode/x86.h>
 #endif
@@ -50,14 +51,14 @@
 #define VIACONFIG_VGA_PCI_10 0xf8000008
 #define VIACONFIG_VGA_PCI_14 0xfc000000
 
-static int via_vx800_int15_handler(struct eregs *regs)
+static int via_vx800_int15_handler(void)
 {
 	int res=0;
 	printk(BIOS_DEBUG, "via_vx800_int15_handler\n");
-	switch(regs->eax & 0xffff) {
+	switch(X86_EAX & 0xffff) {
 	case 0x5f19:
-		regs->eax=0x5f;
-		regs->ecx=0x03;
+		X86_EAX=0x5f;
+		X86_ECX=0x03;
 		res=1;
 		break;
 	case 0x5f18:
@@ -84,44 +85,44 @@
 		i = (i & 0x70);
 		i = i >> 4;
 		if (i == 0) {
-			regs->eax = 0x00;	//not support 5f18
+			X86_EAX = 0x00;	//not support 5f18
 			break;
 		}
 		i = i + 2;
-		regs->ebx = (u32) i;
+		X86_EBX = (u32) i;
 		i = pci_read_config8(dev, 0x90);
 		i = (i & 0x07);
 		i = i + 3;
 		i = i << 4;
-		regs->ebx = regs->ebx + ((u32) i);
-		regs->eax = 0x5f;
+		X86_EBX = X86_EBX + ((u32) i);
+		X86_EAX = 0x5f;
 		res = 1;
 		break;
 	}
 	case 0x5f00:
-		regs->eax = 0x005f;
+		X86_EAX = 0x005f;
 		res = 1;
 		break;
 	case 0x5f01:
-		regs->eax = 0x5f;
-		regs->ecx = (regs->ecx & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
+		X86_EAX = 0x5f;
+		X86_ECX = (X86_ECX & 0xffffff00 ) | 2; // panel type =  2 = 1024 * 768
 		res = 1;
 		break;
 	case 0x5f02:
-		regs->eax=0x5f;
-		regs->ebx= (regs->ebx & 0xffff0000) | 2;
-		regs->ecx= (regs->ecx & 0xffff0000) | 0x401;  // PAL + crt only
-		regs->edx= (regs->edx & 0xffff0000) | 0;  // TV Layout - default
+		X86_EAX=0x5f;
+		X86_EBX= (X86_EBX & 0xffff0000) | 2;
+		X86_ECX= (X86_ECX & 0xffff0000) | 0x401;  // PAL + crt only
+		X86_EDX= (X86_EDX & 0xffff0000) | 0;  // TV Layout - default
 		res=1;
 		break;
 	case 0x5f0f:
-		regs->eax = 0x005f;
+		X86_EAX = 0x005f;
 		res = 1;
 		break;
         default:
 		printk(BIOS_DEBUG, "Unknown INT15 function %04x!\n",
-				regs->eax & 0xffff);
-		regs->eax = 0;
+				X86_EAX & 0xffff);
+		X86_EAX = 0;
 		break;
 	}
 	return res;