* [Qemu-devel] [PATCH] Fix Alpha ret instruction
@ 2008-11-05 22:07 Vince Weaver
2008-11-06 10:41 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Vince Weaver @ 2008-11-05 22:07 UTC (permalink / raw)
To: qemu-devel
Hopefully pine doesn't corrupt this patch, I've had problems recently.
For an alpha "ret" instruction, of the type
ret $26
The return was being ignored. This is because in translate.c
register $26 (the return address) was being over-written with the current
PC before it could be jumped to. Thus the ret was ignored.
This patch just re-orders things so the return address is processed before
it is over-written with the current PC.
Index: target-alpha/translate.c
===================================================================
--- target-alpha/translate.c (revision 5636)
+++ target-alpha/translate.c (working copy)
@@ -1634,12 +1634,13 @@
break;
#endif
case 0x1A:
- if (ra != 31)
- tcg_gen_movi_i64(cpu_ir[ra], ctx->pc);
if (rb != 31)
tcg_gen_andi_i64(cpu_pc, cpu_ir[rb], ~3);
else
tcg_gen_movi_i64(cpu_pc, 0);
+ if (ra != 31)
+ tcg_gen_movi_i64(cpu_ir[ra], ctx->pc);
+
/* Those four jumps only differ by the branch prediction hint */
switch (fn2) {
case 0x0:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix Alpha ret instruction
2008-11-05 22:07 [Qemu-devel] [PATCH] Fix Alpha ret instruction Vince Weaver
@ 2008-11-06 10:41 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2008-11-06 10:41 UTC (permalink / raw)
To: qemu-devel
On Wed, Nov 05, 2008 at 05:07:41PM -0500, Vince Weaver wrote:
>
> Hopefully pine doesn't corrupt this patch, I've had problems recently.
>
> For an alpha "ret" instruction, of the type
> ret $26
>
> The return was being ignored. This is because in translate.c
> register $26 (the return address) was being over-written with the current
> PC before it could be jumped to. Thus the ret was ignored.
>
> This patch just re-orders things so the return address is processed
> before it is over-written with the current PC.
>
Thanks, applied.
> Index: target-alpha/translate.c
> ===================================================================
> --- target-alpha/translate.c (revision 5636)
> +++ target-alpha/translate.c (working copy)
> @@ -1634,12 +1634,13 @@
> break;
> #endif
> case 0x1A:
> - if (ra != 31)
> - tcg_gen_movi_i64(cpu_ir[ra], ctx->pc);
> if (rb != 31)
> tcg_gen_andi_i64(cpu_pc, cpu_ir[rb], ~3);
> else
> tcg_gen_movi_i64(cpu_pc, 0);
> + if (ra != 31)
> + tcg_gen_movi_i64(cpu_ir[ra], ctx->pc);
> +
> /* Those four jumps only differ by the branch prediction hint */
> switch (fn2) {
> case 0x0:
>
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-06 15:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-05 22:07 [Qemu-devel] [PATCH] Fix Alpha ret instruction Vince Weaver
2008-11-06 10:41 ` Aurelien Jarno
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).