Signed-off-by: Luc Verhaegen libv@skynet.be --- util/vgabios/Makefile | 9 ++------- util/vgabios/helper_exec.c | 5 ++++- util/vgabios/helper_exec.h | 2 ++ util/vgabios/helper_mem.c | 6 ++++-- util/vgabios/pci-userspace.c | 5 +++++ util/vgabios/testbios.c | 1 + util/vgabios/x86emu/include/x86emu/regs.h | 6 +++--- util/vgabios/x86emu/src/x86emu/sys.c | 7 ++++--- 8 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 util/vgabios/helper_exec.h
diff --git a/util/vgabios/Makefile b/util/vgabios/Makefile index 5fadba6..c1359bb 100644 --- a/util/vgabios/Makefile +++ b/util/vgabios/Makefile @@ -7,11 +7,7 @@ #
CC = gcc -CFLAGS = -Wall -Ix86emu/include -O2 -g \ - -DLIBPCI_MAJOR_VERSION=2 \ - -DLIBPCI_MINOR_VERSION=1 \ - -DLIBPCI_MICRO_VERSION=11 - +CFLAGS = -Wall -Ix86emu/include -O2 -g
INTOBJS = int10.o int15.o int16.o int1a.o inte6.o OBJECTS = testbios.o helper_exec.o helper_mem.o $(INTOBJS) @@ -20,12 +16,11 @@ LIBS = x86emu/src/x86emu/libx86emu.a
# user space pci is the only option right now. OBJECTS += pci-userspace.o -LIBS += /usr/lib/libpci.a
all: testbios
testbios: $(OBJECTS) $(LIBS) - $(CC) -o testbios $(OBJECTS) $(LIBS) + $(CC) -o testbios $(OBJECTS) $(LIBS) -lpci
helper_exec.o: helper_exec.c test.h
diff --git a/util/vgabios/helper_exec.c b/util/vgabios/helper_exec.c index 8d18798..3ec2c23 100644 --- a/util/vgabios/helper_exec.c +++ b/util/vgabios/helper_exec.c @@ -15,9 +15,12 @@ * on PIO. */ #include <x86emu.h> +#include "helper_exec.h" #include "test.h" -#include <asm/io.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); diff --git a/util/vgabios/helper_exec.h b/util/vgabios/helper_exec.h new file mode 100644 index 0000000..2657b6e --- /dev/null +++ b/util/vgabios/helper_exec.h @@ -0,0 +1,2 @@ +u32 getIntVect(int num); +int run_bios_int(int num); diff --git a/util/vgabios/helper_mem.c b/util/vgabios/helper_mem.c index be53598..50a303b 100644 --- a/util/vgabios/helper_mem.c +++ b/util/vgabios/helper_mem.c @@ -4,6 +4,8 @@ * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ +#include <stdio.h> + #define _INT10_PRIVATE
#define REG pInt @@ -35,7 +37,7 @@ void dprint(unsigned long start, unsigned long size) printf("%2.2x ", (unsigned char) (*(c++))); c = d; for (i = 0; i < 16; i++) { - printf("%c", ((((u8) (*c)) > 32) && (((u8) (*c)) < 128)) ? + printf("%c", ((((unsigned char) (*c)) > 32) && (((unsigned char) (*c)) < 128)) ? (unsigned char) (*(c)) : '.'); c++; } @@ -122,7 +124,7 @@ void reset_int_vect(void) * 64kB. Note that because this data doesn't survive POST, int 0x42 should * only be used during EGA/VGA BIOS initialisation. */ - static const u8 VideoParms[] = { + static const unsigned char VideoParms[] = { /* Timing for modes 0x00 & 0x01 */ 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c, 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, diff --git a/util/vgabios/pci-userspace.c b/util/vgabios/pci-userspace.c index 7578e6f..bc71a61 100644 --- a/util/vgabios/pci-userspace.c +++ b/util/vgabios/pci-userspace.c @@ -2,11 +2,16 @@ #include <pci/pci.h> #include "pci.h"
+#ifdef PCI_LIB_VERSION +#define LIBPCI_CHECK_VERSION(major,minor,micro) \ + ((((major) << 16) | ((minor) << 8) | (micro)) <= PCI_LIB_VERSION) +#else #define LIBPCI_CHECK_VERSION(major,minor,micro) \ ( (LIBPCI_MAJOR_VERSION > (major)) || \ (LIBPCI_MAJOR_VERSION == (major) && LIBPCI_MINOR_VERSION > (minor)) || \ (LIBPCI_MAJOR_VERSION == (major) && LIBPCI_MINOR_VERSION == (minor)) && \ LIBPCI_MICRO_VERSION >= (micro) ) +#endif
#define PCITAG struct pci_filter *
diff --git a/util/vgabios/testbios.c b/util/vgabios/testbios.c index 06f6109..e38315a 100644 --- a/util/vgabios/testbios.c +++ b/util/vgabios/testbios.c @@ -11,6 +11,7 @@ #define warn(x) { perror(x); }
#include <x86emu.h> +#include "helper_exec.h" #include "test.h" #include "pci-userspace.h"
diff --git a/util/vgabios/x86emu/include/x86emu/regs.h b/util/vgabios/x86emu/include/x86emu/regs.h index 726b7ac..e77c564 100755 --- a/util/vgabios/x86emu/include/x86emu/regs.h +++ b/util/vgabios/x86emu/include/x86emu/regs.h @@ -300,9 +300,9 @@ private - private data pointer x86 - X86 registers ****************************************************************************/ typedef struct { - unsigned long mem_base; - unsigned long mem_size; - unsigned long abseg; + void * mem_base; + unsigned int mem_size; + void * abseg; void* private; X86EMU_regs x86; } X86EMU_sysEnv; diff --git a/util/vgabios/x86emu/src/x86emu/sys.c b/util/vgabios/x86emu/src/x86emu/sys.c index ae4c5da..695c87a 100644 --- a/util/vgabios/x86emu/src/x86emu/sys.c +++ b/util/vgabios/x86emu/src/x86emu/sys.c @@ -50,6 +50,7 @@ #include "xf86_ansic.h" #else #include <string.h> +#include <stdio.h> #endif /*------------------------- Global Variables ------------------------------*/
@@ -186,7 +187,7 @@ u8 *mem_ptr(u32 addr, int size) u8 *retaddr = 0;
if (addr > M.mem_size - size) { - DB(printk("mem_ptr: address %#lx out of range!\n", addr); + DB(printk("mem_ptr: address %#x out of range!\n", addr); ) HALT_SYS(); } @@ -596,11 +597,11 @@ void X86EMU_prepareForInt(int num)
void X86EMU_setMemBase(void *base, size_t size) { - M.mem_base = (int) base; + M.mem_base = base; M.mem_size = size; }
void X86EMU_setabseg(void *abseg) { - M.abseg = (unsigned long) abseg; + M.abseg = abseg; }