* [Qemu-devel] [PATCH] Darwin asm fix
@ 2004-01-20 19:27 Pierre d'Herbemont
2004-01-20 19:49 ` Jocelyn Mayer
2004-01-20 20:18 ` Gwenole Beauchesne
0 siblings, 2 replies; 7+ messages in thread
From: Pierre d'Herbemont @ 2004-01-20 19:27 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 300 bytes --]
Hi!
This other patch fix the compilation of op.c under darwin. The changed
line is in exec-all.h, and it is related to the different syntax used
in linux and darwin's ld. In this case Darwin's ld wants '.data'
whereas Linux's ld expects '.section ".data"'.
Thanks for your work on qemu!
Pierre
[-- Attachment #2: qemuasm.diff.txt --]
[-- Type: text/plain, Size: 1545 bytes --]
Index: exec-all.h
===================================================================
RCS file: /cvsroot/qemu/qemu/exec-all.h,v
retrieving revision 1.9
diff -u -r1.9 exec-all.h
--- exec-all.h 18 Jan 2004 22:44:01 -0000 1.9
+++ exec-all.h 20 Jan 2004 19:23:10 -0000
@@ -295,10 +295,16 @@
#if defined(__powerpc__)
+# ifdef __APPLE__
+# define DATA_SECTION ".data\n"
+# else /* __APPLE__ */
+# define DATA_SECTION ".section \".data\"\n"
+# endif /* __APPLE__ */
+
/* we patch the jump instruction directly */
#define JUMP_TB(opname, tbparam, n, eip)\
do {\
- asm volatile (".section \".data\"\n"\
+ asm volatile ( DATA_SECTION \
"__op_label" #n "." stringify(opname) ":\n"\
".long 1f\n"\
".previous\n"\
@@ -319,7 +325,7 @@
/* we patch the jump instruction directly */
#define JUMP_TB(opname, tbparam, n, eip)\
do {\
- asm volatile (".section \".data\"\n"\
+ asm volatile ( DATA_SECTION \
"__op_label" #n "." stringify(opname) ":\n"\
".long 1f\n"\
".previous\n"\
@@ -335,7 +341,8 @@
asm volatile ("jmp __op_jmp" #n "\n");\
} while (0)
-#else
+# undef DATA_SECTION
+#else /* __powerpc__ */
/* jump to next block operations (more portable code, does not need
cache flushing, but slower because of indirect jump) */
@@ -357,7 +364,7 @@
goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n - 2]);\
} while (0)
-#endif
+#endif /* __powerpc__ */
extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Darwin asm fix
2004-01-20 19:27 [Qemu-devel] [PATCH] Darwin asm fix Pierre d'Herbemont
@ 2004-01-20 19:49 ` Jocelyn Mayer
2004-01-20 20:11 ` Daniel Jacobowitz
2004-01-20 20:18 ` Gwenole Beauchesne
1 sibling, 1 reply; 7+ messages in thread
From: Jocelyn Mayer @ 2004-01-20 19:49 UTC (permalink / raw)
To: qemu mailing list
On Tue, 2004-01-20 at 20:27, Pierre d'Herbemont wrote:
> Hi!
>
> This other patch fix the compilation of op.c under darwin. The changed
> line is in exec-all.h, and it is related to the different syntax used
> in linux and darwin's ld. In this case Darwin's ld wants '.data'
> whereas Linux's ld expects '.section ".data"'.
Darwin's ld is supposed to be GNU ld, the same that's user under Linux.
There may be some options to make it act the same. Don't this may be an
issue with as instead ?
--
Jocelyn Mayer <jma@netgem.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Darwin asm fix
2004-01-20 19:49 ` Jocelyn Mayer
@ 2004-01-20 20:11 ` Daniel Jacobowitz
2004-01-20 20:45 ` Jocelyn Mayer
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-01-20 20:11 UTC (permalink / raw)
To: qemu-devel
On Tue, Jan 20, 2004 at 08:49:37PM +0100, Jocelyn Mayer wrote:
> On Tue, 2004-01-20 at 20:27, Pierre d'Herbemont wrote:
> > Hi!
> >
> > This other patch fix the compilation of op.c under darwin. The changed
> > line is in exec-all.h, and it is related to the different syntax used
> > in linux and darwin's ld. In this case Darwin's ld wants '.data'
> > whereas Linux's ld expects '.section ".data"'.
>
> Darwin's ld is supposed to be GNU ld, the same that's user under Linux.
> There may be some options to make it act the same. Don't this may be an
> issue with as instead ?
Darwin's ld is based on binutils 1.x, and is not ELF, so it's
completely different from what Linux uses.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Darwin asm fix
2004-01-20 19:27 [Qemu-devel] [PATCH] Darwin asm fix Pierre d'Herbemont
2004-01-20 19:49 ` Jocelyn Mayer
@ 2004-01-20 20:18 ` Gwenole Beauchesne
1 sibling, 0 replies; 7+ messages in thread
From: Gwenole Beauchesne @ 2004-01-20 20:18 UTC (permalink / raw)
To: qemu-devel
Hi,
> This other patch fix the compilation of op.c under darwin. The changed
> line is in exec-all.h, and it is related to the different syntax used
> in linux and darwin's ld. In this case Darwin's ld wants '.data'
> whereas Linux's ld expects '.section ".data"'.
I would also like to point out another perticularity of Apple
assembler. Contrary to the documentation, multiple statements on the
same line separated by ';' does not work on Darwin/PPC (e.g. MacOS X
10.2) because ';' is also the comment delimiter there. This was a point
of frustration when I ported SheepShaver to Darwin/X11.
In practise, and since you appear to forcibly define __powerpc__
(though __ppc__ exists), this means that you will have to arrange
testandset() asm statements to use \n instead of ';' as the instruction
separator.
Bye,
Gwenole.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Darwin asm fix
2004-01-20 20:11 ` Daniel Jacobowitz
@ 2004-01-20 20:45 ` Jocelyn Mayer
2004-01-20 22:53 ` Michael L Torrie
0 siblings, 1 reply; 7+ messages in thread
From: Jocelyn Mayer @ 2004-01-20 20:45 UTC (permalink / raw)
To: qemu mailing list
On Tue, 2004-01-20 at 21:11, Daniel Jacobowitz wrote:
> On Tue, Jan 20, 2004 at 08:49:37PM +0100, Jocelyn Mayer wrote:
> > On Tue, 2004-01-20 at 20:27, Pierre d'Herbemont wrote:
> > > Hi!
> > >
> > > This other patch fix the compilation of op.c under darwin. The changed
> > > line is in exec-all.h, and it is related to the different syntax used
> > > in linux and darwin's ld. In this case Darwin's ld wants '.data'
> > > whereas Linux's ld expects '.section ".data"'.
> >
> > Darwin's ld is supposed to be GNU ld, the same that's user under Linux.
> > There may be some options to make it act the same. Don't this may be an
> > issue with as instead ?
>
> Darwin's ld is based on binutils 1.x, and is not ELF, so it's
> completely different from what Linux uses.
All right. Sorry. In the mirrored Apple CVS from open-Darwin,
there's ld v2.10 in binutils. I did think this one was used.
I just checked, it's not anymore in recent Apple sources (10.3.2).
I don't see any reason why sections should have another syntax
in Mach-O file, but...
--
Jocelyn Mayer <l_indien@magic.fr>
Never organized
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Darwin asm fix
2004-01-20 20:45 ` Jocelyn Mayer
@ 2004-01-20 22:53 ` Michael L Torrie
0 siblings, 0 replies; 7+ messages in thread
From: Michael L Torrie @ 2004-01-20 22:53 UTC (permalink / raw)
To: qemu-devel
On Tue, 2004-01-20 at 13:45, Jocelyn Mayer wrote:
> All right. Sorry. In the mirrored Apple CVS from open-Darwin,
> there's ld v2.10 in binutils. I did think this one was used.
> I just checked, it's not anymore in recent Apple sources (10.3.2).
>
> I don't see any reason why sections should have another syntax
> in Mach-O file, but...
This is off topic a bit, but where can I find information on this darwin
port? Having the qemu (the full emulator, not the linux loader part
obviously) running would be just wonderful. Bochs is nice, but I think
qemu is much faster.
Michael
--
Michael L Torrie <torriem@chem.byu.edu>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH] Darwin asm fix
[not found] <C80BF812-4C4D-11D8-89C1-000A2796D230@free.fr>
@ 2004-01-21 20:30 ` Pierre d'Herbemont
0 siblings, 0 replies; 7+ messages in thread
From: Pierre d'Herbemont @ 2004-01-21 20:30 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1.1: Type: text/plain, Size: 932 bytes --]
On 21 janv. 04, at 21:09, Gwenole Beauchesne wrote:
> In practise, and since you appear to forcibly define __powerpc__
> (though __ppc__ exists), this means that you will have to arrange
> testandset() asm statements to use \n instead of ';' as the
> instruction separator.
>
Thanks! I didn't notice this one, here is the correction. I prefer to
define __powerpc__ because I think it is better to have the same asm
instruction base (or C functions) between ppc platforms, and fix the
assembly if it needs to be done, than having long code dupplication, or
double #if defined(__ppc__) || defined(__powerpc__).
Also regarding an eventual Mac OS X port, I have nothing functional...
But I did an old dyngen (from qemu 0.4.3) mach-o port which should be
mostly working, so it will be easier to do the full-port on darwin
since it won't require a cross elf compiler - as soon as I get it
working in latest qemu.
Pierre
[-- Attachment #1.2: Type: text/enriched, Size: 1017 bytes --]
On 21 janv. 04, at 21:09, Gwenole Beauchesne wrote:
<excerpt><fontfamily><param>Times</param><bigger><bigger>In practise,
and since you appear to forcibly define __powerpc__ (though __ppc__
exists), this means that you will have to arrange testandset() asm
statements to use \n instead of ';' as the instruction separator.
</bigger></bigger></fontfamily></excerpt>
Thanks! I didn't notice this one, here is the correction. I prefer to
define __powerpc__ because I think it is better to have the same asm
instruction base (or C functions) between ppc platforms, and fix the
assembly if it needs to be done, than having long code dupplication,
or double #if defined(__ppc__) || defined(__powerpc__).
Also regarding an eventual Mac OS X port, I have nothing functional...
But I did an old dyngen (from qemu 0.4.3) mach-o port which should be
mostly working, so it will be easier to do the full-port on darwin
since it won't require a cross elf compiler - as soon as I get it
working in latest qemu.
Pierre
[-- Attachment #2: qemuasm2.diff.txt --]
[-- Type: text/plain, Size: 2226 bytes --]
Index: exec-all.h
===================================================================
RCS file: /cvsroot/qemu/qemu/exec-all.h,v
retrieving revision 1.9
diff -u -r1.9 exec-all.h
--- exec-all.h 18 Jan 2004 22:44:01 -0000 1.9
+++ exec-all.h 21 Jan 2004 20:11:34 -0000
@@ -295,10 +295,16 @@
#if defined(__powerpc__)
+# ifdef __APPLE__
+# define DATA_SECTION ".data\n"
+# else /* __APPLE__ */
+# define DATA_SECTION ".section \".data\"\n"
+# endif /* __APPLE__ */
+
/* we patch the jump instruction directly */
#define JUMP_TB(opname, tbparam, n, eip)\
do {\
- asm volatile (".section \".data\"\n"\
+ asm volatile ( DATA_SECTION \
"__op_label" #n "." stringify(opname) ":\n"\
".long 1f\n"\
".previous\n"\
@@ -319,7 +325,7 @@
/* we patch the jump instruction directly */
#define JUMP_TB(opname, tbparam, n, eip)\
do {\
- asm volatile (".section \".data\"\n"\
+ asm volatile ( DATA_SECTION \
"__op_label" #n "." stringify(opname) ":\n"\
".long 1f\n"\
".previous\n"\
@@ -335,7 +341,8 @@
asm volatile ("jmp __op_jmp" #n "\n");\
} while (0)
-#else
+# undef DATA_SECTION
+#else /* __powerpc__ */
/* jump to next block operations (more portable code, does not need
cache flushing, but slower because of indirect jump) */
@@ -357,7 +364,7 @@
goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n - 2]);\
} while (0)
-#endif
+#endif /* __powerpc__ */
extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
@@ -367,11 +374,11 @@
{
int ret;
__asm__ __volatile__ (
- "0: lwarx %0,0,%1 ;"
- " xor. %0,%3,%0;"
- " bne 1f;"
- " stwcx. %2,0,%1;"
- " bne- 0b;"
+ "0: lwarx %0,0,%1\n"
+ " xor. %0,%3,%0\n"
+ " bne 1f\n"
+ " stwcx. %2,0,%1\n"
+ " bne- 0b\n"
"1: "
: "=&r" (ret)
: "r" (p), "r" (1), "r" (0)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-01-21 20:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-20 19:27 [Qemu-devel] [PATCH] Darwin asm fix Pierre d'Herbemont
2004-01-20 19:49 ` Jocelyn Mayer
2004-01-20 20:11 ` Daniel Jacobowitz
2004-01-20 20:45 ` Jocelyn Mayer
2004-01-20 22:53 ` Michael L Torrie
2004-01-20 20:18 ` Gwenole Beauchesne
[not found] <C80BF812-4C4D-11D8-89C1-000A2796D230@free.fr>
2004-01-21 20:30 ` Pierre d'Herbemont
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).