From: Ulrich Hecht <uli@suse.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] *-user fixes
Date: Wed, 2 Mar 2005 14:27:12 +0100 [thread overview]
Message-ID: <200503021427.13142.uli@suse.de> (raw)
In-Reply-To: <200502231250.22518.uli@suse.de>
[-- Attachment #1: Type: text/plain, Size: 686 bytes --]
Hi!
On Wednesday 23 February 2005 12:50, Ulrich Hecht wrote:
> qemu-sigfpe.patch:
> send SIGFPE in case of ARM FPA exceptions. No idea if this is 100%
> correct, but it's good enough to convince the glibc test suite.
Not the python test suite, though. Here's a better fix that, as an added
bonus, may actually be correct.
> qemu-syscalls.patch:
> some trivial syscall implementations; I only needed (and tested)
> madvise, but while I was there I noticed a number of other syscalls
> that can be implemented without much effort.
>
> qemu-jobsignals.patch:
> proper SIGTSTP/SIGCONT default handling; makes suspending/resuming my
> editor work.
So what about those, Fabrice?
CU
Uli
[-- Attachment #2: qemu-arm-sigfpe.patch --]
[-- Type: text/x-diff, Size: 3496 bytes --]
Index: linux-user/main.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/main.c,v
retrieving revision 1.61
diff -u -r1.61 main.c
--- linux-user/main.c 19 Feb 2005 17:25:31 -0000 1.61
+++ linux-user/main.c 2 Mar 2005 12:37:49 -0000
@@ -325,18 +325,45 @@
{
TaskState *ts = env->opaque;
uint32_t opcode;
+ int rc;
/* we handle the FPU emulation here, as Linux */
/* we get the opcode */
opcode = ldl_raw((uint8_t *)env->regs[15]);
- if (EmulateAll(opcode, &ts->fpa, env->regs) == 0) {
+ if ((rc=EmulateAll(opcode, &ts->fpa, env->regs)) == 0) { /* illegal instruction */
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(info.si_signo, &info);
- } else {
+ } else if (rc < 0) { /* FP exception */
+ FPSR fpsr = ts->fpa.fpsr;
+ //printf("fpsr 0x%x, -rc 0x%x\n",fpsr,-rc);
+ if(fpsr & (-rc << 16)) /* exception enabled? */
+ {
+ info.si_signo = SIGFPE;
+ info.si_errno = 0;
+ /* ordered by priority, least first */
+ if(-rc & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
+ if(-rc & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
+ if(-rc & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
+ if(-rc & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
+ if(-rc & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
+ info._sifields._sigfault._addr = env->regs[15];
+ queue_signal(info.si_signo, &info);
+ }
+ else
+ env->regs[15] += 4;
+
+ /* accumulate unenabled exceptions */
+ if((!(fpsr & BIT_IXE)) && (-rc & BIT_IXC)) fpsr |= BIT_IXC;
+ if((!(fpsr & BIT_UFE)) && (-rc & BIT_UFC)) fpsr |= BIT_UFC;
+ if((!(fpsr & BIT_OFE)) && (-rc & BIT_OFC)) fpsr |= BIT_OFC;
+ if((!(fpsr & BIT_DZE)) && (-rc & BIT_DZC)) fpsr |= BIT_DZC;
+ if((!(fpsr & BIT_IOE)) && (-rc & BIT_IOC)) fpsr |= BIT_IOC;
+ ts->fpa.fpsr=fpsr;
+ } else { /* everything OK */
/* increment PC */
env->regs[15] += 4;
}
Index: target-arm/nwfpe/fpa11.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-arm/nwfpe/fpa11.c,v
retrieving revision 1.1
diff -u -r1.1 fpa11.c
--- target-arm/nwfpe/fpa11.c 16 Feb 2004 21:43:58 -0000 1.1
+++ target-arm/nwfpe/fpa11.c 2 Mar 2005 12:37:50 -0000
@@ -155,6 +155,8 @@
SetRoundingPrecision(ROUND_EXTENDED);
fpa11->initflag = 1;
}
+
+ float_exception_flags = 0;
if (TEST_OPCODE(opcode,MASK_CPRT))
{
@@ -185,6 +187,11 @@
}
// restore_flags(flags);
+ if(nRc == 1 && float_exception_flags)
+ {
+ //printf("fef 0x%x\n",float_exception_flags);
+ nRc=-float_exception_flags;
+ }
//printf("returning %d\n",nRc);
return(nRc);
prev parent reply other threads:[~2005-03-02 13:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-23 11:50 [Qemu-devel] *-user fixes Ulrich Hecht
2005-02-23 12:34 ` Jim Hawkins
2005-03-02 13:27 ` Ulrich Hecht [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=200503021427.13142.uli@suse.de \
--to=uli@suse.de \
--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).