All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ioemu-x86-64-fixes.patch
@ 2005-03-29 23:09 Arun Sharma
  2005-03-31 17:36 ` David Hopwood
  0 siblings, 1 reply; 2+ messages in thread
From: Arun Sharma @ 2005-03-29 23:09 UTC (permalink / raw)
  To: Ian Pratt, Keir Fraser; +Cc: xen-devel

Make ioemu compile on x86-64.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>

--- xen-unstable/tools/ioemu/iodev/Makefile	2005-03-27 21:20:29.000000000 -0600
+++ xen-unstable.work/tools/ioemu/iodev/Makefile	2005-03-28 13:15:43.000000000 -0600
@@ -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 -Naurpb xen-unstable/tools/ioemu/iodev/cpu.cc xen-unstable.work/tools/ioemu/iodev/cpu.cc
--- xen-unstable/tools/ioemu/iodev/cpu.cc	2005-03-27 21:20:35.000000000 -0600
+++ xen-unstable.work/tools/ioemu/iodev/cpu.cc	2005-03-28 10:56:48.000000000 -0600
@@ -102,20 +102,20 @@ void bx_cpu_c::dispatch_ioreq(ioreq_t *r
 
 				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 @@ void bx_cpu_c::dispatch_ioreq(ioreq_t *r
 				//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 @@ bx_cpu_c::cpu_loop(int max_instr_count)
 	}
 }
 
+#ifdef __i386__
 static __inline__ void set_bit(long nr, volatile void *addr)
 {
 	__asm__ __volatile__( "lock ; "
@@ -254,6 +255,18 @@ static __inline__ void set_bit(long nr, 
 
 	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 -Naurpb xen-unstable/tools/ioemu/iodev/eth_linux.cc xen-unstable.work/tools/ioemu/iodev/eth_linux.cc
--- xen-unstable/tools/ioemu/iodev/eth_linux.cc	2005-03-27 21:20:36.000000000 -0600
+++ xen-unstable.work/tools/ioemu/iodev/eth_linux.cc	2005-03-28 13:18:09.000000000 -0600
@@ -212,7 +212,7 @@ bx_linux_pktmover_c::bx_linux_pktmover_c
   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 -Naurpb xen-unstable/tools/ioemu/memory/memory.cc xen-unstable.work/tools/ioemu/memory/memory.cc
--- xen-unstable/tools/ioemu/memory/memory.cc	2005-03-27 21:20:30.000000000 -0600
+++ xen-unstable.work/tools/ioemu/memory/memory.cc	2005-03-28 10:56:48.000000000 -0600
@@ -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 @@ inc_one:
 
 
   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 -Naurpb xen-unstable/tools/ioemu/memory/memory.h xen-unstable.work/tools/ioemu/memory/memory.h
--- xen-unstable/tools/ioemu/memory/memory.h	2005-03-27 21:20:38.000000000 -0600
+++ xen-unstable.work/tools/ioemu/memory/memory.h	2005-03-28 10:56:48.000000000 -0600
@@ -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 @@ public:
   ~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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ioemu-x86-64-fixes.patch
  2005-03-29 23:09 [PATCH] ioemu-x86-64-fixes.patch Arun Sharma
@ 2005-03-31 17:36 ` David Hopwood
  0 siblings, 0 replies; 2+ messages in thread
From: David Hopwood @ 2005-03-31 17:36 UTC (permalink / raw)
  To: xen-devel

Arun Sharma wrote:
> diff -Naurpb xen-unstable/tools/ioemu/iodev/eth_linux.cc xen-unstable.work/tools/ioemu/iodev/eth_linux.cc
> --- xen-unstable/tools/ioemu/iodev/eth_linux.cc	2005-03-27 21:20:36.000000000 -0600
> +++ xen-unstable.work/tools/ioemu/iodev/eth_linux.cc	2005-03-28 13:18:09.000000000 -0600
> @@ -212,7 +212,7 @@ bx_linux_pktmover_c::bx_linux_pktmover_c
>    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));

      BX_INFO(("eth_linux: fp.len=%d fp.filter=%lx", fp.len, (unsigned long)
fp.filter));

-- 
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-31 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29 23:09 [PATCH] ioemu-x86-64-fixes.patch Arun Sharma
2005-03-31 17:36 ` David Hopwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.