Skip to contentSkip to conversation

tools top level makefile cleanup

PATCH Jerone Young 1 participant 1 message Mar 23, 2005 2 messages not in the archive

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Hmmm.. one cheap way to get around this and keep things nice for cross compiling is to to include thek Rules.mk file at the top level of the tools directory and have something like

ifeq ($(XEN_TARGET_ARCH),x86_32)
LDLIBS= $(BXLIBS) -L/usr/X11R6/lib -lX11 -lXpm -lstdc++ -
L ../../../tools/libxc -L ../../../tools/libxutil -lxc -lxutil -lpthread -lncurses_32)
endif

ifeq ($(XEN_TARGET_ARCH),x86_64)
DLIBS= $(BXLIBS) -L/usr/X11R6/lib64 -lX11 -lXpm -lstdc++ -
L ../../../tools/libxc -L ../../../tools/libxutil -lxc -lxutil -lpthread -lncurses
endif

This is cheap and easy way to get around the problem.

Quoted 141 lines · Arun Sharma
Quoted 4 lines · Jerone Young

I cleaned up the top level makefile in the tools directory. No major changes. Except I have it so that ioemmu is compiled only with x86_32.

We've been using the attached patch internally. The patch breaks x86_32. I'd appreciate help from someone who groks makefiles better than I do in fixing up the lib vs lib64 part.

-Arun
plain text document attachment (ioemu-x86-64.patch) ===== tools/ioemu/iodev/Makefile 1.4 vs edited =====

tools/ioemu/iodev/Makefile +1 -1
@@ -2,7 +2,7 @@
 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) -L/usr/X11R6/lib64 -lX11 -lXpm -lstdc++ -L ../../../tools/libxc -L ../../../tools/libxutil -lxc -lxutil -lpthread -lncurses
 
 all: device-model
 

===== tools/ioemu/iodev/cpu.cc 1.6 vs edited =====

tools/ioemu/iodev/cpu.cc +19 -6
@@ -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)

===== tools/ioemu/memory/memory.cc 1.1 vs edited =====

tools/ioemu/memory/memory.cc +2 -2
@@ -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;

===== tools/ioemu/memory/memory.h 1.1 vs edited =====

tools/ioemu/memory/memory.h +8 -2
@@ -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);
Signature · 12 lines
Jerone Young
IBM Linux Technology Center
[email protected]
512-838-1157 (T/L: 678-1157)



-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click