changes from stefan
This commit is contained in:
parent
588760c029
commit
febc4a83b1
5 changed files with 141 additions and 72 deletions
|
|
@ -1,12 +1,15 @@
|
|||
CFLAGS=-Ix86emu/include -O2 -g
|
||||
all: testme testbios
|
||||
CFLAGS = -Ix86emu/include -O2 -g
|
||||
|
||||
testbios: testbios.o helper_exec.o x86emu/src/x86emu/libx86emu.a
|
||||
cc -o testbios testbios.o helper_exec.o x86emu/src/x86emu/libx86emu.a
|
||||
testme: test.o helper_exec.o x86emu/src/x86emu/libx86emu.a
|
||||
cc -o testme test.o helper_exec.o x86emu/src/x86emu/libx86emu.a
|
||||
test.o: test.c test.h
|
||||
OBJECTS = testbios.o helper_exec.o inthandler.o pci-userspace.o
|
||||
LIBS = x86emu/src/x86emu/libx86emu.a
|
||||
LIBS += /usr/lib/libpci.a
|
||||
|
||||
all: testbios
|
||||
|
||||
testbios: $(OBJECTS) $(LIBS)
|
||||
cc -o testbios $(OBJECTS) $(LIBS)
|
||||
|
||||
helper_exec.o: helper_exec.c test.h
|
||||
|
||||
clean:
|
||||
rm -f *.o testme *~ testbios
|
||||
rm -f *.o *~ testbios
|
||||
|
|
|
|||
|
|
@ -29,50 +29,6 @@ void x_outw(u16 port, u16 val);
|
|||
u32 x_inl(u16 port);
|
||||
void x_outl(u16 port, u32 val);
|
||||
|
||||
int
|
||||
setup_int(ptr pInt)
|
||||
{
|
||||
/*
|
||||
if (pInt != current) {
|
||||
if (!MapCurrentInt10(pInt))
|
||||
return -1;
|
||||
current = pInt;
|
||||
}
|
||||
*/
|
||||
X86_EAX = (u32) pInt->ax;
|
||||
X86_EBX = (u32) pInt->bx;
|
||||
X86_ECX = (u32) pInt->cx;
|
||||
X86_EDX = (u32) pInt->dx;
|
||||
X86_ESI = (u32) pInt->si;
|
||||
X86_EDI = (u32) pInt->di;
|
||||
X86_EBP = (u32) pInt->bp;
|
||||
X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4;
|
||||
X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */
|
||||
X86_DS = 0x40; /* standard pc ds */
|
||||
X86_ES = pInt->es;
|
||||
X86_FS = 0;
|
||||
X86_GS = 0;
|
||||
printf("FIX ME FIX ME FIXME NO IOPL\n");
|
||||
//X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK;
|
||||
|
||||
/* blocks sigio here */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
finish_int(ptr pInt, int sig)
|
||||
{
|
||||
pInt->ax = (u16) X86_EAX;
|
||||
pInt->bx = (u16) X86_EBX;
|
||||
pInt->cx = (u16) X86_ECX;
|
||||
pInt->dx = (u16) X86_EDX;
|
||||
pInt->si = (u16) X86_ESI;
|
||||
pInt->di = (u16) X86_EDI;
|
||||
pInt->es = (u16) X86_ES;
|
||||
pInt->bp = (u16) X86_EBP;
|
||||
pInt->flags = (u16) X86_FLAGS;
|
||||
}
|
||||
|
||||
/* general software interrupt handler */
|
||||
u32
|
||||
getIntVect(ptr pInt,int num)
|
||||
|
|
|
|||
90
util/vgabios/pci-userspace.c
Normal file
90
util/vgabios/pci-userspace.c
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
#include <stdio.h>
|
||||
#include "pci-userspace.h"
|
||||
|
||||
struct pci_access *pacc;
|
||||
struct pci_dev *dev;
|
||||
|
||||
struct pci_filter ltag;
|
||||
|
||||
|
||||
int pciNumBuses=0;
|
||||
|
||||
int pciInit(void)
|
||||
{
|
||||
pacc = pci_alloc();
|
||||
|
||||
pci_init(pacc);
|
||||
pci_scan_bus(pacc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pciExit(void)
|
||||
{
|
||||
pci_cleanup(pacc);
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
pciReadLong()
|
||||
{
|
||||
int c;
|
||||
pci_get_dev(struct pci_access *acc, int bus, int dev, int func);
|
||||
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES);
|
||||
c=pci_read_dword(dev, regnum);
|
||||
}
|
||||
#endif
|
||||
|
||||
PCITAG findPci(unsigned short bx)
|
||||
{
|
||||
PCITAG tag=<ag;
|
||||
pciVideoPtr dev;
|
||||
|
||||
int bus = (bx >> 8) & 0xFF;
|
||||
int slot = (bx >> 3) & 0x1F;
|
||||
int func = bx & 0x7;
|
||||
|
||||
tag->bus=bus; tag->slot=slot; tag->func=func;
|
||||
|
||||
if (pci_get_dev(pacc, bus, slot, func))
|
||||
return tag;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CARD32 pciSlotBX(pciVideoPtr pvp)
|
||||
{
|
||||
return (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func);
|
||||
}
|
||||
|
||||
CARD8 pciReadByte(PCITAG tag, CARD32 idx)
|
||||
{
|
||||
printf("pciReadByte: idx=%x\n",idx);
|
||||
}
|
||||
|
||||
CARD16 pciReadWord(PCITAG tag, CARD32 idx)
|
||||
{
|
||||
printf("pciReadWord: idx=%x\n",idx);
|
||||
}
|
||||
|
||||
CARD32 pciReadLong(PCITAG tag, CARD32 idx)
|
||||
{
|
||||
printf("pciReadWord: idx=%x\n",idx);
|
||||
}
|
||||
|
||||
|
||||
void pciWriteLong(PCITAG tag, CARD32 idx, CARD32 data)
|
||||
{
|
||||
printf("pciWriteLong: idx=%x, data=%x\n",idx,data);
|
||||
}
|
||||
|
||||
void pciWriteWord(PCITAG tag, CARD32 idx, CARD16 data)
|
||||
{
|
||||
printf("pciWriteWord: idx=%x, data=%x\n",idx,data);
|
||||
}
|
||||
|
||||
|
||||
void pciWriteByte(PCITAG tag, CARD32 idx, CARD8 data)
|
||||
{
|
||||
printf("pciWriteByte: idx=%x, data=%x\n",idx,data);
|
||||
}
|
||||
|
||||
27
util/vgabios/pci-userspace.h
Normal file
27
util/vgabios/pci-userspace.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include <pci/pci.h>
|
||||
|
||||
#define CARD8 unsigned char
|
||||
#define CARD16 unsigned short
|
||||
#define CARD32 unsigned long
|
||||
|
||||
#define PCITAG struct pci_filter *
|
||||
#define pciVideoPtr struct pci_dev *
|
||||
|
||||
extern int pciNumBuses;
|
||||
|
||||
int pciInit(void);
|
||||
int pciExit(void);
|
||||
|
||||
|
||||
PCITAG findPci(unsigned short bx);
|
||||
CARD32 pciSlotBX(pciVideoPtr pvp);
|
||||
|
||||
void pciWriteLong(PCITAG tag, CARD32 idx, CARD32 data);
|
||||
void pciWriteWord(PCITAG tag, CARD32 idx, CARD16 data);
|
||||
void pciWriteByte(PCITAG tag, CARD32 idx, CARD8 data);
|
||||
|
||||
CARD32 pciReadLong(PCITAG tag, CARD32 idx);
|
||||
CARD16 pciReadWord(PCITAG tag, CARD32 idx);
|
||||
CARD8 pciReadByte(PCITAG tag, CARD32 idx);
|
||||
|
||||
|
||||
|
|
@ -11,24 +11,20 @@
|
|||
_ptr p;
|
||||
ptr current = 0;
|
||||
extern int teststart, testend;
|
||||
#if 0
|
||||
void
|
||||
test()
|
||||
{
|
||||
__asm__ __volatile__(".code16\nteststart:movb $4, %al\n outb %al, $0x80\n.code32\nhlt\ntestend:");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_int(int num)
|
||||
{
|
||||
setup_int(current);
|
||||
// if(int_handler(current))
|
||||
; //X86EMU_Exec();
|
||||
finish_int(current);
|
||||
}
|
||||
void do_int(int num);
|
||||
void setup_int(void);
|
||||
void exit_int(void);
|
||||
|
||||
unsigned char biosmem[1024*1024];
|
||||
|
||||
|
||||
unsigned char *mapitin(char *file, size_t size)
|
||||
{
|
||||
void * z;
|
||||
|
|
@ -91,11 +87,12 @@ main(int argc, char **argv)
|
|||
if (iopl(3) < 0)
|
||||
die("iopl");
|
||||
|
||||
setup_int();
|
||||
sync();
|
||||
sync();
|
||||
// for (i=0;i<256;i++)
|
||||
// intFuncs[i] = do_int;
|
||||
// X86EMU_setupIntrFuncs(intFuncs);
|
||||
for (i=0;i<256;i++)
|
||||
intFuncs[i] = do_int;
|
||||
X86EMU_setupIntrFuncs(intFuncs);
|
||||
cp = mapitin(filename, size);
|
||||
|
||||
current->ax = 0xff;
|
||||
|
|
@ -107,15 +104,11 @@ main(int argc, char **argv)
|
|||
X86_CS = initialcs;
|
||||
// M.x86.saved_cs = 0;
|
||||
// M.x86.saved_ip = 0;
|
||||
X86EMU_trace_on();
|
||||
// x86emu_single_step ();
|
||||
X86EMU_exec();
|
||||
// x86emu_single_step ();
|
||||
//x86emu_single_step ();
|
||||
//x86emu_single_step ();
|
||||
//x86emu_single_step ();
|
||||
|
||||
// X86EMU_trace_on();
|
||||
|
||||
X86EMU_exec();
|
||||
|
||||
exit_int();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue