From: Piotras <piotras@gmail.com>
To: Pierre d'Herbemont <stegefin@free.fr>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support
Date: Wed, 29 Dec 2004 12:43:20 +0100 [thread overview]
Message-ID: <da63183704122903434c73d26@mail.gmail.com> (raw)
In-Reply-To: <4439AAC8-58C2-11D9-9E31-000A2796D230@free.fr>
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 <stegefin@free.fr> 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.
next prev parent reply other threads:[~2004-12-29 11:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-20 17:55 [Qemu-devel] [PATCH] CONFIG_MMU_MAP powerpc host support Magnus Damm
2004-12-20 21:31 ` [Qemu-devel] " Piotras
2004-12-20 22:12 ` Magnus Damm
2004-12-20 22:56 ` Daniel Serpell
2004-12-20 23:11 ` Fabrice Bellard
2004-12-25 0:04 ` [Qemu-devel] " Laurent Amon
2004-12-25 13:48 ` Norikatsu Shigemura
2004-12-27 16:06 ` Laurent Amon
2004-12-27 21:41 ` Pierre d'Herbemont
2004-12-27 23:43 ` Laurent Amon
2004-12-28 9:15 ` Daniel Egger
2004-12-28 9:55 ` Pierre d'Herbemont
2004-12-28 10:04 ` Daniel Egger
2004-12-28 11:18 ` Pierre d'Herbemont
2004-12-29 11:43 ` Piotras [this message]
2005-01-02 18:26 ` Daniel Egger
2005-01-02 20:18 ` Laurent Amon
2005-01-03 10:31 ` Daniel Egger
2005-01-03 12:08 ` Laurent Amon
2005-01-03 12:57 ` Daniel Egger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da63183704122903434c73d26@mail.gmail.com \
--to=piotras@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stegefin@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.