WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] ioemu-x86-64-fixes.patch

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] ioemu-x86-64-fixes.patch
From: Arun Sharma <arun.sharma@xxxxxxxxx>
Date: Tue, 29 Mar 2005 15:09:25 -0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 30 Mar 2005 01:19:47 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Resent-date: Tue, 29 Mar 2005 17:22:51 -0800
Resent-from: adsharma@xxxxxxxxx
Resent-message-id: <20050330012251.B95DDE13D3@xxxxxxxxxxxxxxxxxxxx>
Resent-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
Make ioemu compile on x86-64.

Signed-off-by: Jerone Young <jyoung5@xxxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>

--- 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);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>