Patchwork util/vgabios without own copy of x86emu

login
register
about
Submitter Stefan Reinauer
Date 2010-03-21 22:17:08
Message ID <4BA69AE4.4050905@coresystems.de>
Download mbox | patch
Permalink /patch/1111/
State Accepted
Headers show

Comments

Stefan Reinauer - 2010-03-21 22:17:08
See patch
This patch makes util/vgabios use the coreboot version of x86emu and allows 

svn rm util/vgabios/x86emu

The next step would be to make it use YABEL, too. 

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Stefan Reinauer - 2010-03-21 22:23:59
On 3/21/10 11:17 PM, Stefan Reinauer wrote:
> This patch makes util/vgabios use the coreboot version of x86emu and allows 
>
> svn rm util/vgabios/x86emu
>
> The next step would be to make it use YABEL, too. 
>
>   
The benefit of this first step is that we reduce code duplication by 17k
lines (and get all the x86emu fixes that made it into coreboot's x86emu
but not into vgabios' copy)

Stefan
Joseph Smith - 2010-03-23 13:10:10
On Sun, 21 Mar 2010 23:17:08 +0100, Stefan Reinauer <stepan@coresystems.de>
wrote:
> See patch

Always good to get rid of code duplication.

Acked-by: Joseph Smith <joe@settoplinux.org>

Patch

Index: Makefile
===================================================================
--- Makefile	(revision 5263)
+++ Makefile	(working copy)
@@ -7,29 +7,27 @@ 
 #
 
 CC       =  gcc
-CFLAGS   =  -Wall -Ix86emu/include -O2 -g
+CFLAGS   =  -Wall -Iinclude -I../../src/devices/oprom/include/ -O2 -g
 
-INTOBJS  =  int10.o int15.o int16.o int1a.o inte6.o
-OBJECTS  =  testbios.o helper_exec.o helper_mem.o $(INTOBJS)
+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)
 
-LIBS     =  x86emu/src/x86emu/libx86emu.a
-
 # user space pci is the only option right now.
-OBJECTS += pci-userspace.o
+OBJS += pci-userspace.o
 
+LIBS=-lpci
+
 all: testbios
 
-testbios: $(OBJECTS) $(LIBS)
-	$(CC) -o testbios $(OBJECTS) $(LIBS) -lpci
+testbios: $(OBJS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
  
 helper_exec.o: helper_exec.c test.h
 
-x86emu/src/x86emu/libx86emu.a:
-	$(MAKE) -C x86emu/src/x86emu/ -f makefile.linux
-
 clean:
-	$(MAKE) -C x86emu/src/x86emu/ -f makefile.linux clean
 	rm -f *.o *~ testbios
 
-distclean: clean
-	$(MAKE) -C x86emu/src/x86emu/ -f makefile.linux clean
+%.o: ../../src/devices/oprom/x86emu/%.c
+	$(CC) $(CFLAGS) -c -o $@ $^
+
Index: include/console/console.h
===================================================================
--- include/console/console.h	(revision 0)
+++ include/console/console.h	(revision 0)
@@ -0,0 +1,3 @@ 
+#ifndef _CONSOLE_CONSOLE_H
+#define _CONSOLE_CONSOLE_H
+#endif
Index: include/arch/io.h
===================================================================
--- include/arch/io.h	(revision 0)
+++ include/arch/io.h	(revision 0)
@@ -0,0 +1,4 @@ 
+#ifndef _ASM_IO_H
+#define _ASM_IO_H
+#include <sys/io.h>
+#endif
Index: helper_exec.c
===================================================================
--- helper_exec.c	(revision 5263)
+++ helper_exec.c	(working copy)
@@ -14,7 +14,7 @@ 
  * in xf86EnableIO(). Otherwise we won't trap
  * on PIO.
  */
-#include <x86emu.h>
+#include <x86emu/x86emu.h>
 #include "helper_exec.h"
 #include "test.h"
 #include <sys/io.h>
Index: test.h
===================================================================
--- test.h	(revision 5263)
+++ test.h	(working copy)
@@ -6,7 +6,7 @@ 
  */
 #ifndef XF86X86EMU_H_
 #define XF86X86EMU_H_
-#include <x86emu.h>
+#include <x86emu/x86emu.h>
 
 #define M _X86EMU_env
 
Index: testbios.c
===================================================================
--- testbios.c	(revision 5263)
+++ testbios.c	(working copy)
@@ -10,7 +10,7 @@ 
 #define die(x) { perror(x); exit(1); }
 #define warn(x) { perror(x);  }
 
-#include <x86emu.h>
+#include <x86emu/x86emu.h>
 #include "helper_exec.h"
 #include "test.h"
 #include "pci-userspace.h"
@@ -139,7 +139,6 @@ 
 	unsigned short initialip = 0, initialcs = 0, devfn = 0;
 	X86EMU_intrFuncs intFuncs[256];
 	void X86EMU_setMemBase(void *base, size_t size);
-	void X86EMU_setabseg(void *abseg);
 	void x86emu_dump_xregs(void);
 	int X86EMU_set_debug(int debug);
 	int debugflag = 0;
@@ -277,7 +276,7 @@ 
 
 	current = &p;
 	X86EMU_setMemBase(biosmem, sizeof(biosmem));
-	X86EMU_setabseg(abseg);
+	M.abseg = abseg;
 	X86EMU_setupPioFuncs(&myfuncs);
 	ioperm(0, 0x400, 1);