[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libx86 for armhf (and armel)



On Mon, Feb 20, 2012 at 02:47:12AM +0200, Philippe De Swert wrote:
>Hi,
>
>Does anybody know how to test if libx86 works on armhf/armel?
>As I have used a slightly different approach to get this to compile.
>Turns out the offending assembly in
>http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597000 is just a
>macro which generates the bog standard inx (where x is b, w or l) and
>similar for outx functions in assembly.
>Looking at the libc code for x86 it is indentical and it seems to
>offer some similar functionality for arm, but I could not immediately
>locate the asm for it.
>Anyhow going on the hunch that such basic functionality probably works
>and the inx and outx functions are nicely defined in <sys/io.h> I just
>tried some ugly refdefinition when we use the x86emu to compile (as is
>the case on non-x86 platforms) (see patch attached). And it built fine
>after that.
>I am actually wondering if there is a reason to use asm instructions
>there... so that could actually been cleaned up totally.
>
>So does anybody know how to test this thing? And confirm if my hunch
>actually delivers a working solution?
>
>Thanks,
>
>Philippe

[The attached file is Philippe's patch.]

Please read http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570676#29
diff -Naur libx86-1.1+ds1.orig/Makefile libx86-1.1+ds1/Makefile
--- libx86-1.1+ds1.orig/Makefile	2008-05-19 12:28:59.000000000 +0300
+++ libx86-1.1+ds1/Makefile	2012-02-20 01:32:03.750068423 +0200
@@ -5,6 +5,7 @@
 ifeq ($(BACKEND),x86emu)
 	OBJECTS += thunk.o x86emu/decode.o x86emu/debug.o x86emu/fpu.o \
 	x86emu/ops.o x86emu/ops2.o x86emu/prim_ops.o x86emu/sys.o
+	CFLAGS += -DX86EMU
 else
 	OBJECTS += lrmi.o
 endif
diff -Naur libx86-1.1+ds1.orig/debian/control libx86-1.1+ds1/debian/control
--- libx86-1.1+ds1.orig/debian/control	2012-02-20 01:31:17.000000000 +0200
+++ libx86-1.1+ds1/debian/control	2012-02-20 01:20:22.211012761 +0200
@@ -31,7 +31,7 @@
 Architecture: any
 Priority: extra
 Section: debug
-Depends: libx86-1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends: libx86-1 (= ${binary:Version}), ${misc:Depends}
 Description: x86 real-mode library - debugging symbols
  A library to provide support for making real-mode calls x86 calls. On x86
  hardware, vm86 mode is used. On other platforms, x86 emulation is provided.
diff -Naur libx86-1.1+ds1.orig/thunk.c libx86-1.1+ds1/thunk.c
--- libx86-1.1+ds1.orig/thunk.c	2008-04-03 03:48:00.000000000 +0300
+++ libx86-1.1+ds1/thunk.c	2012-02-20 01:12:56.468820192 +0200
@@ -32,6 +32,7 @@
 #define TRUE 1
 #define FALSE 0
 
+#ifndef X86EMU
 #define __BUILDIO(bwl,bw,type) \
 static inline void out##bwl##_local(unsigned long port, unsigned type value) {        __asm__ __volatile__("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \
 }\
@@ -44,6 +45,15 @@
 __BUILDIO(b,b,char)
 __BUILDIO(w,w,short)
 __BUILDIO(l,,int)
+#else
+/* use libc functions */
+#define inb_local inb
+#define inw_local inw
+#define inl_local inl
+#define outb_local outb
+#define outw_local outw
+#define outl_local outl
+#endif /* X86EMU */
 
 
 char *mmap_addr = SHMERRORPTR;

Reply to: