From: malc <av1474@comtv.ru>
To: Thiemo Seufer <ths@networkno.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [4691] PPC TCG Fixes
Date: Mon, 9 Jun 2008 00:09:25 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.64.0806082356120.4134@linmac.oyster.ru> (raw)
In-Reply-To: <20080608083142.GB11233@networkno.de>
On Sun, 8 Jun 2008, Thiemo Seufer wrote:
> malc wrote:
>> Revision: 4691
>> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4691
>> Author: malc
>> Date: 2008-06-07 20:31:33 +0000 (Sat, 07 Jun 2008)
>>
>> Log Message:
>> -----------
>> PPC TCG Fixes
>>
>> * Fix typo in aliased div2
>> * "Optimize" aliased div2/divu2
>> * Fix two remaining branch retranslation problems
>> (Kudos to Andrzej Zaborowski)
>> * Rework goto_tb and set_jmp_target1
>> * Use correct size when flushing icache
>> * Use correct register selection for ORI
>> (Was harmless since in both cases srcreg was equal to dstreg)
>
> FYI, the mips system emulation still crashes when executing the very
> first TB, apparently due to stack corruption. (This commit didn't
> change the behaviour.)
It's not a stack corruption it's a relocation problem, dyngen
relocates one of the calls inside (non tcged) op_mtc0_status as
R_PPC_REL24 but the signed displacement does not fit in 26 bits after
the code is placed into mmapped code_gen_buffer. Compiling op.o with
-mlongcall makes the emulation proceed much further, but then it still
crashes:
<transcript>
...
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 26964k/32768k available (2102k kernel code, 5804k reserved, 450k
data, 132k init, 0k highmem)
Break instruction in kernel code[#1]:
...
Call Trace:
[<802a1788>] kmem_cache_init+0x160/0x434
[<8028f7f0>] start_kernel+0x1b8/0x2c0
Code: 26100001 1611fff4 00000000 <0200000d> 8e42002c 8fa80018 00031880
0102001b 004001f4
Kernel panic - not syncing: Attempted to kill the idle task!
Perhaps something like this ought to be added to dyngen.c:
</transcript>
diff --git a/dyngen.c b/dyngen.c
index c38d123..69f4105 100644
--- a/dyngen.c
+++ b/dyngen.c
@@ -1963,6 +1963,11 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
break;
case R_PPC_REL24:
/* warning: must be at 32 MB distancy */
+ fprintf(outfile, "{\n"
+ " long disp = (%s - (long)(gen_code_ptr + %d) + %d);\n"
+ " if ((disp << 6) >> 6 != disp) abort ();\n"
+ "}\n",
+ relname, reloc_offset, addend);
fprintf(outfile, " *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((%s - (long)(gen_code_ptr + %d) + %d) & 0x03fffffc);\n",
reloc_offset, reloc_offset, relname, reloc_offset, addend);
break;
--
mailto:av1474@comtv.ru
prev parent reply other threads:[~2008-06-08 20:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-07 20:31 [Qemu-devel] [4691] PPC TCG Fixes malc
2008-06-08 8:31 ` Thiemo Seufer
2008-06-08 20:09 ` malc [this message]
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=Pine.LNX.4.64.0806082356120.4134@linmac.oyster.ru \
--to=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
--cc=ths@networkno.de \
/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 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).