All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: jim.hull@hp.com, parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] Re: floating point exception error
Date: Sun, 12 Jan 2003 00:37:33 -0800	[thread overview]
Message-ID: <20030112083733.GE1177@tausq.org> (raw)
In-Reply-To: <200301111831.h0BIVwZS006398@hiauly1.hia.nrc.ca>

> I think that you probably should always use a 3-bit extract.  If the
> value is greater than 3 on a PA 1.1 FPU, then the operation is undefined.
> 4 is also undefined for PA 2.0.

I guess that'll work, altho there are also some paths that are pcx-s and
pcx-t specific, so we probably still need to determine what processor we
are running on

> The above assumes that the kernel doesn't provide PA 2.0 emulation
> on PA 1.1 machines.

yup, that should be a reasonable assumption.

anyway, here's what i'm considering to commit to our kernel tree. it 
has been tested to work with the fcnv code posted earlier. haven't 
tested the other cases yet. it's very much a hack. comments?

Index: arch/parisc/math-emu/driver.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/math-emu/driver.c,v
retrieving revision 1.1
diff -u -p -r1.1 driver.c
--- arch/parisc/math-emu/driver.c	20 Jul 2002 16:32:35 -0000	1.1
+++ arch/parisc/math-emu/driver.c	12 Jan 2003 08:39:10 -0000
@@ -86,8 +86,12 @@ handle_fpe(struct pt_regs *regs)
 	int signalcode;
 	/* need an intermediate copy of float regs because FPU emulation
 	 * code expects an artificial last entry which contains zero
+	 *
+	 * also, the passed in fr registers contain one word that defines
+	 * the fpu type. the fpu type information is constructed 
+	 * inside the emulation code
 	 */
-	__u64 frcopy[33];
+	__u64 frcopy[36];
 
 	memcpy(frcopy, regs->fr, sizeof regs->fr);
 	frcopy[32] = 0;
Index: arch/parisc/math-emu/fpudispatch.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/math-emu/fpudispatch.c,v
retrieving revision 1.1
diff -u -p -r1.1 fpudispatch.c
--- arch/parisc/math-emu/fpudispatch.c	20 Jul 2002 16:32:35 -0000	1.1
+++ arch/parisc/math-emu/fpudispatch.c	12 Jan 2003 08:39:10 -0000
@@ -51,6 +51,7 @@
 
 #include "float.h"
 #include "types.h"
+#include <asm/processor.h>
 /* #include <sys/debug.h> */
 /* #include <machine/sys/mdep_private.h> */
 
@@ -166,6 +167,20 @@ static void update_status_cbit();
 
 #define VASSERT(x)
 
+static void parisc_linux_get_fpu_type(u_int fpregs[])
+{
+	/* on pa-linux the fpu type is not filled in by the
+	 * caller; it is constructed here  
+	 */ 
+	if (boot_cpu_data.cpu_type == pcxs)
+		fpregs[FPU_TYPE_FLAG_POS] = TIMEX_EXTEN_FLAG;
+	else if (boot_cpu_data.cpu_type == pcxt ||
+	         boot_cpu_data.cpu_type == pcxt_)
+		fpregs[FPU_TYPE_FLAG_POS] = ROLEX_EXTEN_FLAG;
+	else if (boot_cpu_data.cpu_type >= pcxu)
+		fpregs[FPU_TYPE_FLAG_POS] = PA2_0_FPU_FLAG;
+}
+
 /*
  * this routine will decode the excepting floating point instruction and
  * call the approiate emulation routine.
@@ -183,6 +198,8 @@ fpudispatch(u_int ir, u_int excp_code, u
 
 	/* All FP emulation code assumes that ints are 4-bytes in length */
 	VASSERT(sizeof(int) == 4);
+
+	parisc_linux_get_fpu_type(fpregs);
 
 	fpu_type_flags=fpregs[FPU_TYPE_FLAG_POS];  /* get fpu type flags */
 
randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

  reply	other threads:[~2003-01-12  8:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-11 21:13 [parisc-linux] ["CSA Test Drive" <TestDrive@compaq.com>] FW: Some issues Bdale Garbee
2002-12-11 22:03 ` John David Anglin
2002-12-11 22:44   ` Carlos O'Donell
2002-12-11 23:05     ` John David Anglin
2002-12-11 23:17       ` Carlos O'Donell
2002-12-12  6:50       ` Randolph Chung
2002-12-12 12:15         ` Matthew Wilcox
2003-01-10  7:54       ` [parisc-linux] Re: floating point exception error Randolph Chung
2003-01-10 18:08         ` Jim Hull
2003-01-10 18:35           ` Randolph Chung
2003-01-10 18:48           ` John David Anglin
2003-01-10 22:30             ` Jim Hull
2003-01-11  6:16               ` Randolph Chung
2003-01-11  7:10                 ` Grant Grundler
2003-01-11 18:31                 ` John David Anglin
2003-01-12  8:37                   ` Randolph Chung [this message]
2003-01-13 15:58                     ` jsoe0708
2003-01-13 16:57                       ` Randolph Chung
2003-01-13 17:16                         ` jsoe0708
2003-01-13 17:16                           ` Randolph Chung

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=20030112083733.GE1177@tausq.org \
    --to=randolph@tausq.org \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=jim.hull@hp.com \
    --cc=parisc-linux@parisc-linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.