[coreboot-gerrit] New patch to review for coreboot: vgabios: fix compilation after x86emu changes

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Mon Sep 28 20:26:27 CET 2015


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11736

-gerrit

commit aed4d716674819363f660796a3892c27529efed1
Author: Stefan Reinauer <reinauer at chromium.org>
Date:   Mon Sep 28 13:12:04 2015 -0700

    vgabios: fix compilation after x86emu changes
    
    This utility links in coreboot code, and has been broken for a while
    again after removing some hacks from coreboot. I hadn't realized how
    bad it was broken last time, and since most of this stuff is still
    in a pretty bad shape, I decided to throw all of the changes together.
    
    Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
    
    Change-Id: If3e4399b1b0e947433b97caa29962ef66ea2993d
---
 util/vgabios/Makefile                  | 52 ++++++++++++------
 util/vgabios/helper_exec.c             | 22 ++++----
 util/vgabios/helper_exec.h             | 30 +++++++++++
 util/vgabios/include/console/console.h |  2 +
 util/vgabios/int10.c                   |  8 ++-
 util/vgabios/int15.c                   |  7 ++-
 util/vgabios/int16.c                   |  2 +
 util/vgabios/int1a.c                   | 11 ++--
 util/vgabios/inte6.c                   |  4 +-
 util/vgabios/pci-userspace.c           |  3 +-
 util/vgabios/pci-userspace.h           | 13 +++--
 util/vgabios/pci.h                     |  2 -
 util/vgabios/test.h                    | 89 ------------------------------
 util/vgabios/testbios.c                | 56 +++++++++----------
 util/vgabios/testbios.h                | 98 ++++++++++++++++++++++++++++++++++
 15 files changed, 230 insertions(+), 169 deletions(-)

diff --git a/util/vgabios/Makefile b/util/vgabios/Makefile
index 366606c..520779c 100644
--- a/util/vgabios/Makefile
+++ b/util/vgabios/Makefile
@@ -6,35 +6,57 @@
 # /usr/lib/...
 #
 
-CC       =  gcc
-CFLAGS   = -O2 -g -fomit-frame-pointer
+TOP     ?= ../..
+
+CC      ?=  gcc
+CFLAGS  ?= -O2 -g -fomit-frame-pointer
+
 CFLAGS  += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS  += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
-CFLAGS  += -Wstrict-aliasing -Wshadow -Wextra
+CFLAGS  += -Wwrite-strings -Wredundant-decls -Wstrict-aliasing -Wshadow -Wextra
+
+# TODO check host architecture
+CBCFLAGS  = -DCONFIG_ARCH_X86=1 -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unused-parameter
 
-INCLUDES = -Iinclude -I../../src/device/oprom/include/ -I../../src --include include/stdtypes.h
+INCLUDES  = -Iinclude -I$(TOP)/src/device/oprom/include/
+CBINCLUDES = -I$(TOP)/src --include include/stdtypes.h
+CBINCLUDES += --include $(TOP)/src/commonlib/include/commonlib/loglevel.h
+CBINCLUDES += -include stdio.h
 
-INTOBJS  = int10.o int15.o int16.o int1a.o inte6.o
-X86EMUOBJS  = sys.o decode.o ops.o ops2.o prim_ops.o fpu.o debug.o
-OBJS  =  testbios.o helper_exec.o helper_mem.o $(INTOBJS) $(X86EMUOBJS)
+SOURCE  = int10.c int15.c int16.c int1a.c inte6.c testbios.c
+SOURCE += helper_exec.c helper_mem.c pci-userspace.c
 
-# user space pci is the only option right now.
-OBJS += pci-userspace.o
+X86EMU  = sys.c decode.c ops.c ops2.c prim_ops.c fpu.c debug.c
+X86EMU_DIR = $(TOP)/src/device/oprom/x86emu
+X86EMU_SOURCE = $(addprefix $(X86EMU_DIR)/, $(X86EMU))
+OBJECTS:=$(SOURCE:.c=.o) $(X86EMU:.c=.o)
 
 LIBS=-lpci
 
-all: testbios
+all: dep testbios
 
-testbios: $(OBJS)
+testbios: $(OBJECTS)
+	printf "    LINK  $(notdir $@)\n"
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
 
-helper_exec.o: helper_exec.c test.h
+dep: $(SOURCE) $(X86EMU_SOURCE) Makefile
+	$(CC) $(CFLAGS) $(INCLUDES) -MM $(SOURCE) > .dependencies
+	$(CC) $(CFLAGS) $(INCLUDES) $(CBCFLAGS) $(CBINCLUDES) -MM $(X86EMU_SOURCE) >> .dependencies
 
 clean:
 	rm -f *.o *~ testbios
 
-%.o: ../../src/device/oprom/x86emu/%.c
-	$(CC) $(CFLAGS) $(INCLUDES) -include stdio.h -c -o $@ $^
+distclean: clean
+	rm -f .dependencies
+
+%.o: $(X86EMU_DIR)/%.c
+	printf "    CC    (x86emu) $(notdir $<)\n"
+	$(CC) $(CFLAGS) $(CBCFLAGS) $(INCLUDES) $(CBINCLUDES) -c -o $@ $<
 
 %.o: %.c
+	printf "    CC    $(notdir $<)\n"
 	$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
+
+.PHONY: all clean distclean
+.SILENT:
+
+-include .dependencies
diff --git a/util/vgabios/helper_exec.c b/util/vgabios/helper_exec.c
index 73100d9..4d6aae5 100644
--- a/util/vgabios/helper_exec.c
+++ b/util/vgabios/helper_exec.c
@@ -14,21 +14,13 @@
  * in xf86EnableIO(). Otherwise we won't trap
  * on PIO.
  */
-#include <x86emu/x86emu.h>
-#include "helper_exec.h"
-#include "test.h"
 #include <sys/io.h>
 #include <sys/time.h>
 #include <stdio.h>
-
-
-int port_rep_inb(u16 port, u32 base, int d_f, u32 count);
-u8 x_inb(u16 port);
-u16 x_inw(u16 port);
-void x_outb(u16 port, u8 val);
-void x_outw(u16 port, u16 val);
-u32 x_inl(u16 port);
-void x_outl(u16 port, u32 val);
+#include <stdtypes.h>
+#include <x86emu/x86emu.h>
+#include "helper_exec.h"
+#include "testbios.h"
 
 /* general software interrupt handler */
 u32 getIntVect(int num)
@@ -59,6 +51,8 @@ int run_bios_int(int num)
 	return 1;
 }
 
+#if 0
+
 int port_rep_inb(u16 port, u32 base, int d_f, u32 count)
 {
 	register int inc = d_f ? -1 : 1;
@@ -125,6 +119,8 @@ int port_rep_outl(u16 port, u32 base, int d_f, u32 count)
 	return dst - base;
 }
 
+#endif
+
 u8 x_inb(u16 port)
 {
 	u8 val;
@@ -175,6 +171,7 @@ void x_outl(u16 port, u32 val)
 	outl(val, port);
 }
 
+#if 0
 u8 Mem_rb(int addr)
 {
 	return (*current->mem->rb) (current, addr);
@@ -204,6 +201,7 @@ void Mem_wl(int addr, u32 val)
 {
 	(*current->mem->wl) (current, addr, val);
 }
+#endif
 
 void getsecs(unsigned long *sec, unsigned long *usec)
 {
diff --git a/util/vgabios/helper_exec.h b/util/vgabios/helper_exec.h
index 2657b6e..7115ffb 100644
--- a/util/vgabios/helper_exec.h
+++ b/util/vgabios/helper_exec.h
@@ -1,2 +1,32 @@
+#ifndef __HELPER_EXEC_H__
+#define __HELPER_EXEC_H__
+
 u32 getIntVect(int num);
 int run_bios_int(int num);
+void pushw(u16 val);
+
+int port_rep_inb(u16 port, u32 base, int d_f, u32 count);
+int port_rep_inw(u16 port, u32 base, int d_f, u32 count);
+int port_rep_inl(u16 port, u32 base, int d_f, u32 count);
+int port_rep_outb(u16 port, u32 base, int d_f, u32 count);
+int port_rep_outw(u16 port, u32 base, int d_f, u32 count);
+int port_rep_outl(u16 port, u32 base, int d_f, u32 count);
+
+u8 x_inb(u16 port);
+u16 x_inw(u16 port);
+void x_outb(u16 port, u8 val);
+void x_outw(u16 port, u16 val);
+u32 x_inl(u16 port);
+void x_outl(u16 port, u32 val);
+
+u8 Mem_rb(int addr);
+u16 Mem_rw(int addr);
+u32 Mem_rl(int addr);
+
+void Mem_wb(int addr, u8 val);
+void Mem_ww(int addr, u16 val);
+void Mem_wl(int addr, u32 val);
+void getsecs(unsigned long *sec, unsigned long *usec);
+u8 bios_checksum(u8 * start, int size);
+
+#endif
diff --git a/util/vgabios/include/console/console.h b/util/vgabios/include/console/console.h
index e74cbb3..e52dbf7 100644
--- a/util/vgabios/include/console/console.h
+++ b/util/vgabios/include/console/console.h
@@ -1,4 +1,6 @@
 #ifndef _CONSOLE_CONSOLE_H
 #define _CONSOLE_CONSOLE_H
 #define CONFIG_X86EMU_DEBUG 1
+
+int printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 #endif
diff --git a/util/vgabios/int10.c b/util/vgabios/int10.c
index bccb3d9..21ba7fb 100644
--- a/util/vgabios/int10.c
+++ b/util/vgabios/int10.c
@@ -1,9 +1,7 @@
 #include <stdio.h>
-#include "test.h"
-#include "pci.h"
+#include <stdtypes.h>
+#include "testbios.h"
 
-void x86emu_dump_xregs(void);
-extern ptr current;
 extern int verbose;
 
 
@@ -16,7 +14,7 @@ extern int verbose;
  * arise.  What are "Not Implemented" throughout are video memory accesses.
  * Also, very little input validity checking is done here.
  */
-int int42_handler()
+int int42_handler(void)
 {
 #if 0
 	if (verbose && X86_AH != 0x0e) {
diff --git a/util/vgabios/int15.c b/util/vgabios/int15.c
index 239b6be..a1235bb 100644
--- a/util/vgabios/int15.c
+++ b/util/vgabios/int15.c
@@ -1,12 +1,11 @@
 #include <stdio.h>
-#include "test.h"
-
-void x86emu_dump_xregs();
+#include <stdtypes.h>
+#include "testbios.h"
 
 int int15_handler(void)
 {
 	printf("\nint15 encountered.\n");
-	//x86emu_dump_xregs();
+	x86emu_dump_xregs();
 	X86_EAX = 0;
 	return 1;
 }
diff --git a/util/vgabios/int16.c b/util/vgabios/int16.c
index f3a9719..06df826 100644
--- a/util/vgabios/int16.c
+++ b/util/vgabios/int16.c
@@ -1,7 +1,9 @@
 #include <stdio.h>
+#include "testbios.h"
 
 int int16_handler(void)
 {
 	printf("\nint16: keyboard not supported right now.\n");
+	x86emu_dump_xregs();
 	return 1;
 }
diff --git a/util/vgabios/int1a.c b/util/vgabios/int1a.c
index bd9a24c..9fcff8a 100644
--- a/util/vgabios/int1a.c
+++ b/util/vgabios/int1a.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
-#include "test.h"
+#include <stdtypes.h>
+#include "testbios.h"
 #include "pci-userspace.h"
 
 #define DEBUG_INT1A
@@ -8,13 +9,11 @@
 #define DEVICE_NOT_FOUND        0x86
 #define BAD_REGISTER_NUMBER     0x87
 
-void x86emu_dump_xregs(void);
 extern int verbose;
 
-
-int int1A_handler()
+int int1A_handler(void)
 {
-	PCITAG tag;
+	PCITAG tag = NULL;
 	pciVideoPtr pvp = NULL;
 
 	if (verbose) {
@@ -40,7 +39,7 @@ int int1A_handler()
 		if (X86_DX == pvp->vendor_id && X86_CX == pvp->device_id && X86_ESI == 0) {
 			X86_EAX = X86_AL | (SUCCESSFUL << 8);
 			X86_EFLAGS &= ~((unsigned long) 0x01);	/* clear carry flag */
-			X86_EBX = pciSlotBX(pvp);
+			X86_EBX = pciSlotBX(tag); // XXX used to be pvp, but both are NULL
 		}
 #ifdef SHOW_ALL_DEVICES
 		else if ((pvp = xf86FindPciDeviceVendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
diff --git a/util/vgabios/inte6.c b/util/vgabios/inte6.c
index 0f6a578..19b6110 100644
--- a/util/vgabios/inte6.c
+++ b/util/vgabios/inte6.c
@@ -1,6 +1,7 @@
 #include <stdio.h>
+#include "testbios.h"
 
-int intE6_handler()
+int intE6_handler(void)
 {
 #if 0
 	pciVideoPtr pvp;
@@ -14,5 +15,6 @@ int intE6_handler()
 	X86_ES = 0;		/* standard pc es */
 #endif
 	printf("intE6 not supported right now.\n");
+	x86emu_dump_xregs();
 	return 1;
 }
diff --git a/util/vgabios/pci-userspace.c b/util/vgabios/pci-userspace.c
index bc71a61..796933e 100644
--- a/util/vgabios/pci-userspace.c
+++ b/util/vgabios/pci-userspace.c
@@ -1,6 +1,5 @@
 #include <stdio.h>
-#include <pci/pci.h>
-#include "pci.h"
+#include "pci-userspace.h"
 
 #ifdef PCI_LIB_VERSION
 #define LIBPCI_CHECK_VERSION(major,minor,micro) \
diff --git a/util/vgabios/pci-userspace.h b/util/vgabios/pci-userspace.h
index 0944330..103a9ef 100644
--- a/util/vgabios/pci-userspace.h
+++ b/util/vgabios/pci-userspace.h
@@ -1,9 +1,13 @@
-#include "pci.h"
+#ifndef __PCI_USERSPACE_H__
+#define __PCI_USERSPACE_H__
+
+#include <pci/pci.h>
 
 typedef unsigned long pciaddr_t;
 typedef u8 byte;
 typedef u16 word;
 
+#if 0
 struct pci_dev {
 	struct pci_dev *next;	/* Next device in the chain */
 	word bus;		/* Higher byte can select host bridges */
@@ -32,7 +36,7 @@ struct pci_filter {
 	int bus, slot, func;	/* -1 = ANY */
 	int vendor, device;
 };
-
+#endif
 
 #define PCITAG struct pci_filter *
 #define pciVideoPtr struct pci_dev *
@@ -44,7 +48,8 @@ int pciExit(void);
 
 
 PCITAG findPci(unsigned short bx);
-u32 pciSlotBX(pciVideoPtr pvp);
+//u32 pciSlotBX(pciVideoPtr pvp);
+u32 pciSlotBX(PCITAG tag);
 
 void pciWriteLong(PCITAG tag, u32 idx, u32 data);
 void pciWriteWord(PCITAG tag, u32 idx, u16 data);
@@ -53,3 +58,5 @@ void pciWriteByte(PCITAG tag, u32 idx, u8 data);
 u32 pciReadLong(PCITAG tag, u32 idx);
 u16 pciReadWord(PCITAG tag, u32 idx);
 u8 pciReadByte(PCITAG tag, u32 idx);
+
+#endif
diff --git a/util/vgabios/pci.h b/util/vgabios/pci.h
deleted file mode 100644
index e51ebe4..0000000
--- a/util/vgabios/pci.h
+++ /dev/null
@@ -1,2 +0,0 @@
-void x_outb(u16 port, u8 val);
-#define outb x_outb
diff --git a/util/vgabios/test.h b/util/vgabios/test.h
deleted file mode 100644
index 7804ac2..0000000
--- a/util/vgabios/test.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.2 2001/01/06 20:19:13 tsi Exp $ */
-/*
- *                   XFree86 int10 module
- *   execute BIOS int 10h calls in x86 real mode environment
- *                 Copyright 1999 Egbert Eich
- */
-#ifndef XF86X86EMU_H_
-#define XF86X86EMU_H_
-#include <x86emu/x86emu.h>
-
-#define M _X86EMU_env
-
-#define X86_EAX M.x86.R_EAX
-#define X86_EBX M.x86.R_EBX
-#define X86_ECX M.x86.R_ECX
-#define X86_EDX M.x86.R_EDX
-#define X86_ESI M.x86.R_ESI
-#define X86_EDI M.x86.R_EDI
-#define X86_EBP M.x86.R_EBP
-#define X86_EIP M.x86.R_EIP
-#define X86_ESP M.x86.R_ESP
-#define X86_EFLAGS M.x86.R_EFLG
-
-#define X86_FLAGS M.x86.R_FLG
-#define X86_AX M.x86.R_AX
-#define X86_BX M.x86.R_BX
-#define X86_CX M.x86.R_CX
-#define X86_DX M.x86.R_DX
-#define X86_SI M.x86.R_SI
-#define X86_DI M.x86.R_DI
-#define X86_BP M.x86.R_BP
-#define X86_IP M.x86.R_IP
-#define X86_SP M.x86.R_SP
-#define X86_CS M.x86.R_CS
-#define X86_DS M.x86.R_DS
-#define X86_ES M.x86.R_ES
-#define X86_SS M.x86.R_SS
-#define X86_FS M.x86.R_FS
-#define X86_GS M.x86.R_GS
-
-#define X86_AL M.x86.R_AL
-#define X86_BL M.x86.R_BL
-#define X86_CL M.x86.R_CL
-#define X86_DL M.x86.R_DL
-
-#define X86_AH M.x86.R_AH
-#define X86_BH M.x86.R_BH
-#define X86_CH M.x86.R_CH
-#define X86_DH M.x86.R_DH
-
-
-/* int10 info structure */
-typedef struct {
-	u16 BIOSseg;
-	u16 inb40time;
-	struct _mem *mem;
-	int num;
-	int ax;
-	int bx;
-	int cx;
-	int dx;
-	int si;
-	int di;
-	int es;
-	int bp;
-	int flags;
-	int stackseg;
-} _ptr, *ptr;
-
-typedef struct _mem {
-	u8(*rb) (ptr, int);
-	u16(*rw) (ptr, int);
-	u32(*rl) (ptr, int);
-	void (*wb) (ptr, int, u8);
-	void (*ww) (ptr, int, u16);
-	void (*wl) (ptr, int, u32);
-} mem;
-
-#define MEM_WB(where, what) wrb(where,what)
-#define MEM_WW(where, what) wrw(where, what)
-#define MEM_WL(where, what) wrl(where, what)
-
-#define MEM_RB(where) rdb(where)
-#define MEM_RW(where) rdw(where)
-#define MEM_RL(where) rdl(where)
-
-extern ptr current;
-
-#endif
diff --git a/util/vgabios/testbios.c b/util/vgabios/testbios.c
index a6e121e..8c9783f 100644
--- a/util/vgabios/testbios.c
+++ b/util/vgabios/testbios.c
@@ -6,26 +6,18 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <string.h>
+#include <stdarg.h>
 
+#include <stdtypes.h>
 #define die(x) { perror(x); exit(1); }
 #define warn(x) { perror(x);  }
 
 #include <x86emu/x86emu.h>
+#include <console/console.h>
 #include "helper_exec.h"
-#include "test.h"
+#include "testbios.h"
 #include "pci-userspace.h"
-
-void x86emu_dump_xregs(void);
-int int15_handler(void);
-int int16_handler(void);
-int int1A_handler(void);
-#ifndef _PC
-int int42_handler(void);
-#endif
-int intE6_handler(void);
-
-void pushw(u16 val);
-
+int X86EMU_set_debug(int debug);
 unsigned short get_device(char *arg_val);
 
 extern int teststart, testend;
@@ -39,7 +31,7 @@ int verbose = 0;
 
 /* Interrupt multiplexer */
 
-void do_int(int num)
+static void do_int(int num)
 {
 	int ret = 0;
 
@@ -84,7 +76,7 @@ void do_int(int num)
 	}
 }
 
-unsigned char *mapitin(char *file, off_t where, size_t size)
+static unsigned char *mapitin(char *file, off_t where, size_t size)
 {
 	void *z;
 
@@ -101,21 +93,13 @@ unsigned char *mapitin(char *file, off_t where, size_t size)
 
 }
 
-u8 x_inb(u16 port);
-u16 x_inw(u16 port);
-void x_outb(u16 port, u8 val);
-void x_outw(u16 port, u16 val);
-u32 x_inl(u16 port);
-void x_outl(u16 port, u32 val);
-
-
 X86EMU_pioFuncs myfuncs = {
 	x_inb, x_inw, x_inl,
 	x_outb, x_outw, x_outl
 };
 
 
-void usage(char *name)
+static void usage(char *name)
 {
 	printf
 	    ("Usage: %s [-c codesegment] [-s size] [-b base] [-i ip] [-t] <filename> ... \n",
@@ -129,7 +113,7 @@ int main(int argc, char **argv)
 	int i, c, trace = 0;
 	unsigned char *cp;
 	char *filename;
-	size_t size = 0;
+	ssize_t size = 0;
 	int base = 0;
 	int have_size = 0, have_base = 0, have_ip = 0, have_cs = 0;
 	int have_devfn = 0;
@@ -138,9 +122,6 @@ int main(int argc, char **argv)
 	unsigned char *fsegptr;
 	unsigned short initialip = 0, initialcs = 0, devfn = 0;
 	X86EMU_intrFuncs intFuncs[256];
-	void X86EMU_setMemBase(void *base, size_t size);
-	void x86emu_dump_xregs(void);
-	int X86EMU_set_debug(int debug);
 	int debugflag = 0;
 
 	const char *optstring = "vh?b:i:c:s:tpd:";
@@ -192,7 +173,6 @@ int main(int argc, char **argv)
 			have_size = 1;
 			break;
 		case 'p':
-			printf("Parsing rom images not implemented.\n");
 			parse_rom = 1;
 			break;
 		case 'f':
@@ -250,6 +230,9 @@ int main(int argc, char **argv)
 		initialip = 0x0003;
 	}
 
+	if (parse_rom)
+		printf("Parsing rom images not implemented.\n");
+
 	//printf("Point 1 int%x vector at %x\n", 0x42, getIntVect(0x42));
 
 	if (initialip == 0x0003) {
@@ -314,7 +297,7 @@ int main(int argc, char **argv)
 		for (i = 0; i < 0x10000; i++)
 			wrb(0xf0000 + i, fsegptr[i]);
 	} else {
-		char *date = "01/01/99";
+		const char *date = "01/01/99";
 		for (i = i; date[i]; i++)
 			wrb(0xffff5 + i, date[i]);
 		wrb(0xffff7, '/');
@@ -391,3 +374,16 @@ unsigned short get_device(char *arg_val)
 
 	return devfn;
 }
+
+int printk(int msg_level, const char *fmt, ...)
+{
+	va_list args;
+	int i;
+
+	printf ("<%d> ", msg_level);
+	va_start(args, fmt);
+	i = vprintf(fmt, args);
+	va_end(args);
+
+	return i;
+}
diff --git a/util/vgabios/testbios.h b/util/vgabios/testbios.h
new file mode 100644
index 0000000..a5a8b0d
--- /dev/null
+++ b/util/vgabios/testbios.h
@@ -0,0 +1,98 @@
+/* Derived from:
+ *                   XFree86 int10 module
+ *   execute BIOS int 10h calls in x86 real mode environment
+ *                 Copyright 1999 Egbert Eich
+ */
+
+#ifndef __TESTBIOS_H__
+#define __TESTBIOS_H__
+
+void x86emu_dump_xregs(void);
+int int15_handler(void);
+int int16_handler(void);
+int int1A_handler(void);
+int int42_handler(void);
+int intE6_handler(void);
+
+#include <stdtypes.h>
+#include <x86emu/x86emu.h>
+
+#define M _X86EMU_env
+
+#define X86_EAX M.x86.R_EAX
+#define X86_EBX M.x86.R_EBX
+#define X86_ECX M.x86.R_ECX
+#define X86_EDX M.x86.R_EDX
+#define X86_ESI M.x86.R_ESI
+#define X86_EDI M.x86.R_EDI
+#define X86_EBP M.x86.R_EBP
+#define X86_EIP M.x86.R_EIP
+#define X86_ESP M.x86.R_ESP
+#define X86_EFLAGS M.x86.R_EFLG
+
+#define X86_FLAGS M.x86.R_FLG
+#define X86_AX M.x86.R_AX
+#define X86_BX M.x86.R_BX
+#define X86_CX M.x86.R_CX
+#define X86_DX M.x86.R_DX
+#define X86_SI M.x86.R_SI
+#define X86_DI M.x86.R_DI
+#define X86_BP M.x86.R_BP
+#define X86_IP M.x86.R_IP
+#define X86_SP M.x86.R_SP
+#define X86_CS M.x86.R_CS
+#define X86_DS M.x86.R_DS
+#define X86_ES M.x86.R_ES
+#define X86_SS M.x86.R_SS
+#define X86_FS M.x86.R_FS
+#define X86_GS M.x86.R_GS
+
+#define X86_AL M.x86.R_AL
+#define X86_BL M.x86.R_BL
+#define X86_CL M.x86.R_CL
+#define X86_DL M.x86.R_DL
+
+#define X86_AH M.x86.R_AH
+#define X86_BH M.x86.R_BH
+#define X86_CH M.x86.R_CH
+#define X86_DH M.x86.R_DH
+
+
+/* int10 info structure */
+typedef struct {
+	u16 BIOSseg;
+	u16 inb40time;
+	struct _mem *mem;
+	int num;
+	int ax;
+	int bx;
+	int cx;
+	int dx;
+	int si;
+	int di;
+	int es;
+	int bp;
+	int flags;
+	int stackseg;
+} _ptr, *ptr;
+
+typedef struct _mem {
+	u8(*rb) (ptr, int);
+	u16(*rw) (ptr, int);
+	u32(*rl) (ptr, int);
+	void (*wb) (ptr, int, u8);
+	void (*ww) (ptr, int, u16);
+	void (*wl) (ptr, int, u32);
+} mem;
+
+#define MEM_WB(where, what) wrb(where,what)
+#define MEM_WW(where, what) wrw(where, what)
+#define MEM_WL(where, what) wrl(where, what)
+
+#define MEM_RB(where) rdb(where)
+#define MEM_RW(where) rdw(where)
+#define MEM_RL(where) rdl(where)
+
+extern ptr current;
+
+#endif



More information about the coreboot-gerrit mailing list