From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Libo Zhou <zhlb29@foxmail.com>, Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Subject: Re: illegal hardware instruction during MIPS-I ELF linux useremulation
Date: Tue, 24 Sep 2019 15:42:59 +0200 [thread overview]
Message-ID: <b4bc1f35-817d-79a0-df4d-07eaa2fdffe5@redhat.com> (raw)
In-Reply-To: <tencent_6DB0EBDC4C098868592B8A79@qq.com>
On 9/24/19 3:31 PM, Libo Zhou wrote:
>>> I would start by using the QEMU gdbstub to connect a
>>> MIPS-aware gdb. Then when the SIGILL arrives you can see
>>> what instruction the guest program was trying to execute.
>
>> Just tried it and found something interesting.
>> I connected gdb-multiarch to QEMU gdbstub. gdb-multiarch's architecture was set to mips:3000 automatically (and Wikipedia says r3k uses MIPS-I).
>
>> When I did 'layout asm', and compared the instructions displayed against test.s generated by my mipsel-linux-unknown-gcc, they appeared to be a little bit different.
>
>> The 'store word' instruction in test.s is shown as a hex '0x7f......(don't remember the rest)';
>> 'load word' is shown as '0x5f......';
>> 'load immediate' is seen as 'addi';
>> 'j' as 'jr';
>
>> When I single-stepped the instructions, the SIGILL was thrown immediately after the first unrecognized 0x7f......, which is supposed to be a store word (sw).
>
>> Hence, can I conclude that MIPS-I is not implemented in QEMU out of the box? Or is it possible that my compiler doesn't implement MIPS-I correctly?
>
> More updates about this. I just disassembled the unrecognized hex by hand, and figured out that the store word and load word opcodes are not the same as specified in translate.c. While the remaining fields of those unrecognized instructions do match with the source and destination registers.
What is your compiler/assembler versions (on both machines you used)?
next prev parent reply other threads:[~2019-09-24 14:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-23 16:25 illegal hardware instruction during MIPS-I ELF linux useremulation Libo Zhou
2019-09-23 16:41 ` Peter Maydell
2019-09-24 1:05 ` Libo Zhou
2019-09-24 2:32 ` Libo Zhou
2019-09-24 13:31 ` Libo Zhou
2019-09-24 13:42 ` Philippe Mathieu-Daudé [this message]
2019-09-24 14:14 ` illegal hardware instruction during MIPS-I ELF linuxuseremulation Libo Zhou
2019-09-24 9:36 ` illegal hardware instruction during MIPS-I ELF linux useremulation Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2019-09-23 8:15 illegal hardware instruction during MIPS-I ELF linux user emulation Libo Zhou
2019-09-23 12:04 ` Libo Zhou
2019-09-23 12:19 ` illegal " Peter Maydell
2019-09-24 2:10 ` illegal hardware instruction during MIPS-I ELF linux useremulation Libo Zhou
2019-09-24 2:23 ` Libo Zhou
2019-09-23 14:38 ` illegal hardware instruction during MIPS-I ELF linux user emulation Philippe Mathieu-Daudé
2019-09-26 14:31 ` illegal hardware instruction during MIPS-I ELF linux useremulation Libo Zhou
2019-09-26 15:46 ` Philippe Mathieu-Daudé
2019-09-27 8:59 ` Libo Zhou
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=b4bc1f35-817d-79a0-df4d-07eaa2fdffe5@redhat.com \
--to=philmd@redhat.com \
--cc=aleksandar.m.mail@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhlb29@foxmail.com \
/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).