ChangeSet 1.1393, 2005/03/30 08:57:13+01:00, arun.sharma@xxxxxxxxx
[PATCH] ioemu-x86-64-fixes.patch
Make ioemu compile on x86-64.
Signed-off-by: Jerone Young <jyoung5@xxxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>
iodev/Makefile | 5 ++++-
iodev/cpu.cc | 25 +++++++++++++++++++------
iodev/eth_linux.cc | 2 +-
memory/memory.cc | 4 ++--
memory/memory.h | 10 ++++++++--
5 files changed, 34 insertions(+), 12 deletions(-)
diff -Nru a/tools/ioemu/iodev/Makefile b/tools/ioemu/iodev/Makefile
--- a/tools/ioemu/iodev/Makefile 2005-03-30 03:03:13 -05:00
+++ b/tools/ioemu/iodev/Makefile 2005-03-30 03:03:13 -05:00
@@ -1,8 +1,11 @@
+XEN_ROOT= ../../../
+include $(XEN_ROOT)/tools/Rules.mk
+
TOPDIR= ..
CXXFLAGS=-I. -I../include -I..
OBJS=$(patsubst %.cc,%.o,$(wildcard *.cc))
BXLIBS = ../gui/libgui.a ../memory/libmemory.a
-LDLIBS= $(BXLIBS) -L/usr/X11R6/lib -lX11 -lXpm -lstdc++ -L
../../../tools/libxc -L ../../../tools/libxutil -lxc -lxutil -lpthread -lncurses
+LDLIBS= $(BXLIBS) $(X11_LDPATH) -lX11 -lXpm -lstdc++ -L../../../tools/libxc
-L../../../tools/libxutil -lxc -lxutil -lpthread -lncurses
all: device-model
diff -Nru a/tools/ioemu/iodev/cpu.cc b/tools/ioemu/iodev/cpu.cc
--- a/tools/ioemu/iodev/cpu.cc 2005-03-30 03:03:13 -05:00
+++ b/tools/ioemu/iodev/cpu.cc 2005-03-30 03:03:13 -05:00
@@ -102,20 +102,20 @@
for (i = 0; i < req->count; i++) {
tmp = BX_INP(req->addr, req->size);
- BX_MEM_WRITE_PHYSICAL((Bit32u)
req->u.pdata + (sign * i * req->size),
+ BX_MEM_WRITE_PHYSICAL((dma_addr_t)
req->u.pdata + (sign * i * req->size),
req->size, &tmp);
}
}
} else if(req->dir == IOREQ_WRITE) {
if (!req->pdata_valid) {
- BX_OUTP(req->addr, (Bit32u) req->u.data,
req->size);
+ BX_OUTP(req->addr, (dma_addr_t) req->u.data,
req->size);
} else {
for (i = 0; i < req->count; i++) {
unsigned long tmp;
- BX_MEM_READ_PHYSICAL((Bit32u)
req->u.pdata + (sign * i * req->size), req->size,
+ BX_MEM_READ_PHYSICAL((dma_addr_t)
req->u.pdata + (sign * i * req->size), req->size,
&tmp);
- BX_OUTP(req->addr, (Bit32u) tmp,
req->size);
+ BX_OUTP(req->addr, (dma_addr_t) tmp,
req->size);
}
}
@@ -133,12 +133,12 @@
//BX_INFO(("<READ>addr:%llx, pdata:%llx, size:
%x, count: %x\n", req->addr, req->u.pdata, req->size, req->count));
for (i = 0; i < req->count; i++) {
BX_MEM_READ_PHYSICAL(req->addr + (sign
* i * req->size), req->size, &tmp);
- BX_MEM_WRITE_PHYSICAL((Bit32u)
req->u.pdata + (sign * i * req->size), req->size, &tmp);
+ BX_MEM_WRITE_PHYSICAL((dma_addr_t)
req->u.pdata + (sign * i * req->size), req->size, &tmp);
}
} else if (req->dir == IOREQ_WRITE) {
//BX_INFO(("<WRITE>addr:%llx, pdata:%llx, size:
%x, count: %x\n", req->addr, req->u.pdata, req->size, req->count));
for (i = 0; i < req->count; i++) {
-
BX_MEM_READ_PHYSICAL((Bit32u)req->u.pdata + (sign * i * req->size), req->size,
&tmp);
+
BX_MEM_READ_PHYSICAL((dma_addr_t)req->u.pdata + (sign * i * req->size),
req->size, &tmp);
BX_MEM_WRITE_PHYSICAL(req->addr + (sign
* i * req->size), req->size, &tmp);
}
}
@@ -245,6 +245,7 @@
}
}
+#ifdef __i386__
static __inline__ void set_bit(long nr, volatile void *addr)
{
__asm__ __volatile__( "lock ; "
@@ -254,6 +255,18 @@
return;
}
+#else
+/* XXX: clean for IPF */
+static __inline__ void set_bit(long nr, volatile void *addr)
+{
+ __asm__ __volatile__( "lock ; "
+ "btsq %1,%0"
+ :"=m" ((*(volatile long *)addr))
+ :"Ir" (nr));
+
+ return;
+}
+#endif
void
bx_cpu_c::interrupt(Bit8u vector)
diff -Nru a/tools/ioemu/iodev/eth_linux.cc b/tools/ioemu/iodev/eth_linux.cc
--- a/tools/ioemu/iodev/eth_linux.cc 2005-03-30 03:03:13 -05:00
+++ b/tools/ioemu/iodev/eth_linux.cc 2005-03-30 03:03:13 -05:00
@@ -212,7 +212,7 @@
this->filter[3].k = (macaddr[0] & 0xff) << 8 | (macaddr[1] & 0xff);
fp.len = BX_LSF_ICNT;
fp.filter = this->filter;
- BX_INFO(("eth_linux: fp.len=%d fp.filter=%x", fp.len, (unsigned) fp.filter));
+ BX_INFO(("eth_linux: fp.len=%d fp.filter=%x", fp.len, (unsigned long)
fp.filter));
if (setsockopt(this->fd, SOL_SOCKET, SO_ATTACH_FILTER, &fp, sizeof(fp)) < 0)
{
BX_PANIC(("eth_linux: could not set socket filter: %s", strerror(errno)));
close(this->fd);
diff -Nru a/tools/ioemu/memory/memory.cc b/tools/ioemu/memory/memory.cc
--- a/tools/ioemu/memory/memory.cc 2005-03-30 03:03:13 -05:00
+++ b/tools/ioemu/memory/memory.cc 2005-03-30 03:03:13 -05:00
@@ -36,7 +36,7 @@
#if BX_PROVIDE_CPU_MEMORY
void BX_CPP_AttrRegparmN(3)
-BX_MEM_C::writePhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void
*data)
+BX_MEM_C::writePhysicalPage(BX_CPU_C *cpu, dma_addr_t addr, unsigned len, void
*data)
{
Bit8u *data_ptr;
Bit32u a20addr;
@@ -235,7 +235,7 @@
void BX_CPP_AttrRegparmN(3)
-BX_MEM_C::readPhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void
*data)
+BX_MEM_C::readPhysicalPage(BX_CPU_C *cpu, dma_addr_t addr, unsigned len, void
*data)
{
Bit8u *data_ptr;
Bit32u a20addr;
diff -Nru a/tools/ioemu/memory/memory.h b/tools/ioemu/memory/memory.h
--- a/tools/ioemu/memory/memory.h 2005-03-30 03:03:13 -05:00
+++ b/tools/ioemu/memory/memory.h 2005-03-30 03:03:13 -05:00
@@ -37,6 +37,12 @@
# define BX_MEM_THIS this->
#endif
+#if defined(__i386__)
+typedef Bit32u dma_addr_t;
+#elif defined(__x86_64__)
+typedef Bit64u dma_addr_t;
+#endif
+
// alignment of memory vector, must be a power of 2
#define BX_MEM_VECTOR_ALIGN 4096
@@ -64,9 +70,9 @@
~BX_MEM_C(void);
BX_MEM_SMF void alloc_vector_aligned (size_t bytes, size_t alignment)
BX_CPP_AttrRegparmN(2);
BX_MEM_SMF void init_memory(int memsize);
- BX_MEM_SMF void readPhysicalPage(BX_CPU_C *cpu, Bit32u addr,
+ BX_MEM_SMF void readPhysicalPage(BX_CPU_C *cpu, dma_addr_t addr,
unsigned len, void *data)
BX_CPP_AttrRegparmN(3);
- BX_MEM_SMF void writePhysicalPage(BX_CPU_C *cpu, Bit32u addr,
+ BX_MEM_SMF void writePhysicalPage(BX_CPU_C *cpu, dma_addr_t addr,
unsigned len, void *data)
BX_CPP_AttrRegparmN(3);
BX_MEM_SMF void load_ROM(const char *path, Bit32u romaddress, Bit8u type);
BX_MEM_SMF Bit32u get_memory_in_k(void);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|