qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support


From: Pierre d'Herbemont
Subject: Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support
Date: Mon, 27 Dec 2004 22:41:33 +0100


On 27 déc. 04, at 17:06, Laurent Amon wrote:
However, I have a lot of assembly error when compiling op.c, and I suspect it may be caused by the asm code Magnus added in his ppc patch. I'm even more out of my depth than usual here. Magnus, for which PowerPC did you write the code? I have a 7410 G4(TiBook/400).

Mac OS X's assembler expects a slightly different syntax.
Basically you'll have to change the register name from x to rx, and word selector from address@hidden to s16(mem), for example:

lis 9, (import+32)@ha ; on Linux, will become :
lis r9,ha16(import+32) ; on Mac OS X.

So you'll have to write asm code which is platform independent. I think the best way to do that is simply to use the C Preprocessor, and define constant string for registers names, for instance :

#ifdef __powerpc__
# ifdef __APPLE__
# define ppc_high(mem) "ha16(" mem ")"
# define ppc_low(mem) "lo16(" mem ")"
# define ppc_r0 "r0"
# define ppc_r1 "r1"
/* ... */

# else /* __APPLE__ */
# define ppc_high(mem) "(" mem ")@hi"
# define ppc_low(mem) "(" mem ")@l"
# define ppc_r0 "0"
# define ppc_r1 "1"
/* ... */

# endif /* __APPLE__ */
#define stringify(x) #x
#define ppc_asm_1(instr, param1) stringify(instr) " " param1
#define ppc_asm_2(instr, param1, param2) ppc_asm_1(instr, param1) "," param2
#define ppc_asm_3(instr, param1, param2 , param3) ppc_asm_2(instr, param1, param2) "," param3
#define ppc_asm_4(instr, param1, param2 , param3, param4) ppc_asm_3(instr, param1, param2, param3) "," param4
#endif /* __powerpc__ */

#ifdef __powerpc__
/* asm("addis r4, %3, ha16(%4)"); */
asm (ppc_asm_4(addis, ppc_r4, "%3", ppc_high("%4")) "\n");
#endif

Hope it helps.

Pierre.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]