From: Vladimir Prus <vladimir@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: Re: SH4: Implement FD bit
Date: Wed, 10 Dec 2008 14:04:27 +0300 [thread overview]
Message-ID: <gho7nr$unc$1@ger.gmane.org> (raw)
In-Reply-To: 20081210091526.GA19379@volta.aurel32.net
[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]
Aurelien Jarno wrote:
> On Tue, Dec 09, 2008 at 07:36:19PM +0300, Vladimir Prus wrote:
>> Aurelien Jarno wrote:
>>
>> >>
>> >> SH4 manual say that if a floating point instruction is executed while
>> >> FD bit in the status register is 1, an exception should be raised. QEMU
>> >> presently does not do that, so the kernel does not initialize FP state
>> >> for any thread, nor does it save/restore FP state. The most apparent
>> >> consequence is that while recent gcc/libc expect double-precision mode
>> >> to be set by kernel, they run in single-precision mode, and all FP code
>> >> produces wrong values.
>> >>
>> >> This patch fixes this. It also fixes a couple of places where PC was
>> >> not updated before handling an exception, although both those places
>> >> deal with invalid instruction and don't lead to any user-visible bugs.
>> >>
>> >> - Volodya
>> >
>> > Thanks, applied.
>>
>> Thanks, but it looks like one bit of the patch somehow did not
>> make it into SVN. Specifically, this:
>>
>> @@ -504,6 +523,13 @@ static void _decode_opc(DisasContext * ctx)
>> }
>> }
>>
>> + /* The 0xfffd instruction is underfined, so we don't want to
>> + raise fpu disable exception on it. */
>> + if (((ctx->opcode & 0xf000) == 0xf000)
>> + && (ctx->opcode != 0xfffd))
>> + {
>> + CHECK_FPU_ENABLED
>> + }
>>
>> Is present in my post, and is not present in:
>>
>> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5937
>>
>> Maybe some merge issue?
>
> Yes I haven't seen that one hunk of the patch has been rejected, so I
> missed this part. I have just tried to merge it by hand, but it is not
> possible to apply it. It looks like the patch was not done against the
> current SVN.
>
> Care to resend it against the current SVN?
Attached is the remaining bit of the patch, against fresh SVN.
Thanks,
Volodya
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fd_remaining.diff --]
[-- Type: text/x-diff; name="fd_remaining.diff", Size: 1293 bytes --]
commit ffcb0cc661325b87995ae62dcdefa448e0b7296a
Author: Vladimir Prus <vladimir@codesourcery.com>
Date: Mon Dec 1 19:28:32 2008 +0300
SH: Implement FD bit
* target-sh4/cpu.h (cpu_get_tb_cpu_state): Include SR's FD bit in
the flags.
* target-sh4/helper.h (raise_fpu_disable, raise_slot_fpu_disable):
New helpers.
* targets-sh4/op_helper.c (helper_raise_fpu_disable)
(helper_raise_slot_fpu_disable): New.
* target-sh4/translate.c (CHECK_NOT_DELAY_SLOT, CHECK_PRIVILEGED):
Set PC to the right value.
(CHECK_FPU_ENABLED): New.
(_decode_opc): Use CHECK_FPU_ENABLED for FP instructions.
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index d6cfb7c..23a5d34 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -481,6 +481,15 @@ static void _decode_opc(DisasContext * ctx)
#if 0
fprintf(stderr, "Translating opcode 0x%04x\n", ctx->opcode);
#endif
+
+ /* The 0xfffd instruction is underfined, so we don't want to
+ raise fpu disable exception on it. */
+ if (((ctx->opcode & 0xf000) == 0xf000)
+ && (ctx->opcode != 0xfffd))
+ {
+ CHECK_FPU_ENABLED
+ }
+
switch (ctx->opcode) {
case 0x0019: /* div0u */
tcg_gen_andi_i32(cpu_sr, cpu_sr, ~(SR_M | SR_Q | SR_T));
next prev parent reply other threads:[~2008-12-10 12:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 17:22 [Qemu-devel] SH4: Implement FD bit Vladimir Prus
2008-12-07 22:47 ` Aurelien Jarno
2008-12-09 16:36 ` [Qemu-devel] " Vladimir Prus
2008-12-10 9:15 ` Aurelien Jarno
2008-12-10 11:04 ` Vladimir Prus [this message]
2008-12-10 17:31 ` [Qemu-devel] " Aurelien Jarno
2008-12-11 20:12 ` [Qemu-devel] " Lionel Landwerlin
2008-12-11 20:57 ` Laurent Desnogues
2008-12-11 22:02 ` Lionel Landwerlin
2008-12-11 22:21 ` Laurent Desnogues
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='gho7nr$unc$1@ger.gmane.org' \
--to=vladimir@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/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).