[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support
From: |
Piotras |
Subject: |
Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support |
Date: |
Wed, 29 Dec 2004 12:43:20 +0100 |
Hi!
The problem can be avoided by replacing some of asm with C.
The gcc seems to generate equally-efficient code in this case.
I don't have a ppc machine to test it, but something like this may
work:
RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(void *ptr)
{
target_ulong addr;
register target_phys_addr_t add asm ("r3");
RES_TYPE val;
addr = (target_ulong)ptr;
add = env->mmu_map[CPU_MEM_INDEX].add_read[addr >> TARGET_PAGE_BITS];
asm volatile (
#if (DATA_SIZE == 1)
"lbzx %0, %1, %2\n"
#elif (DATA_SIZE == 2) && defined(BSWAP_NEEDED)
"lhbrx %0, %1, %2\n"
#elif (DATA_SIZE == 2)
"lhzx %0, %1, %2\n"
#elif (DATA_SIZE == 4) && defined(BSWAP_NEEDED)
"lwbrx %0, %1, %2\n"
#elif (DATA_SIZE == 4)
"lwzx %0, %1, %2\n"
#else
#error unsupported size
#endif
: "=r" (val)
: "r" (addr),
"r" (add)
: "memory");
return val;
}
You will have to modify lds and st as well (make sure to replace
"add_read" with "add_write" for st). It is critical to use a specific
register as %2 (Magnus decided to use r3).
Regards,
Piotrek
On Tue, 28 Dec 2004 12:18:57 +0100, Pierre d'Herbemont <address@hidden> wrote:
>
> [...]
>
> > Actually I'm a bit unsure about the displacement syntax but
> > I know that register names are accepted by GNU binutils and
> > cctools because I've written quite a lot of AltiVec code
> > which works on both Linux and MacOSX without any tricks.
>
> Hum, seems to be a good trick... Google search returns the "-mregnames"
> option. But it seems that it doesn't deal with ha16() or lo16(), so
> we'll have to deal with it. However I think it is still better than
> duplicating the PowerPC code.
>
> Pierre.
- Re: [Qemu-devel] Re: [PATCH] CONFIG_MMU_MAP powerpc host support, (continued)
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Laurent Amon, 2004/12/24
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Norikatsu Shigemura, 2004/12/25
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Laurent Amon, 2004/12/27
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Pierre d'Herbemont, 2004/12/27
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Laurent Amon, 2004/12/27
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Daniel Egger, 2004/12/28
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Pierre d'Herbemont, 2004/12/28
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Daniel Egger, 2004/12/28
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support, Pierre d'Herbemont, 2004/12/28
- Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support,
Piotras <=