public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@avtrex.com>
To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Cc: cgd@broadcom.com, Ralf Baechle <ralf@linux-mips.org>,
	 linux-mips@linux-mips.org,  binutils@sources.redhat.com
Subject: Re: [Patch]  / 0 should send SIGFPE not SIGTRAP...
Date: Fri, 11 Jun 2004 20:52:00 -0000	[thread overview]
Message-ID: <40CA1B35.6010603@avtrex.com> (raw)
In-Reply-To: <Pine.LNX.4.55.0406112133380.13062@jurand.ds.pg.gda.pl>

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

Maciej W. Rozycki wrote:

>On Fri, 11 Jun 2004 cgd@broadcom.com wrote:
>  
>
>>Unfortunately, at this point, Linux should probably accept the
>>divide-by-zero code in both locations.
>>    
>>
>
> I think that's not a big trouble for Linux -- the path is rare and not
>critical for performance.
>
>  
>
How about the attached (lightly tested) patch?

David Daney.

[-- Attachment #2: traps.diff --]
[-- Type: text/plain, Size: 2111 bytes --]

*** ../linux-avtrex/linux/arch/mips/kernel/traps.c	2004-02-26 11:14:09.000000000 -0800
--- arch/mips/kernel/traps.c	2004-06-11 13:43:00.000000000 -0700
***************
*** 597,615 ****
  	 * There is the ancient bug in the MIPS assemblers that the break
  	 * code starts left to bit 16 instead to bit 6 in the opcode.
  	 * Gas is bug-compatible ...
! 	 */
! 	bcode = ((opcode >> 16) & ((1 << 20) - 1));
! 
! 	/*
  	 * (A short test says that IRIX 5.3 sends SIGTRAP for all break
  	 * insns, even for break codes that indicate arithmetic failures.
  	 * Weird ...)
  	 * But should we continue the brokenness???  --macro
  	 */
  	switch (bcode) {
! 	case 6:
! 	case 7:
! 		if (bcode == 7)
  			info.si_code = FPE_INTDIV;
  		else
  			info.si_code = FPE_INTOVF;
--- 597,621 ----
  	 * There is the ancient bug in the MIPS assemblers that the break
  	 * code starts left to bit 16 instead to bit 6 in the opcode.
  	 * Gas is bug-compatible ...
! 	 *
  	 * (A short test says that IRIX 5.3 sends SIGTRAP for all break
  	 * insns, even for break codes that indicate arithmetic failures.
  	 * Weird ...)
  	 * But should we continue the brokenness???  --macro
+          *
+          * It seems some assemblers (binutils-2.15 for example) assemble
+          * break correctly.  So we check for the break code in either
+          * position.
+          *
  	 */
+ 
+ 	bcode = ((opcode >> 6) & ((1 << 20) - 1));
  	switch (bcode) {
! 	case 0x0006:
! 	case 0x0007:
!         case 0x1800: /* 6 << 10 */
!         case 0x1c00: /* 7 << 10 */
! 		if (bcode == 0x7 || bcode == 0x1c00)
  			info.si_code = FPE_INTDIV;
  		else
  			info.si_code = FPE_INTOVF;
***************
*** 633,639 ****
  
  	/* Immediate versions don't provide a code.  */
  	if (!(opcode & OPCODE))
! 		tcode = ((opcode >> 6) & ((1 << 20) - 1));
  
  	/*
  	 * (A short test says that IRIX 5.3 sends SIGTRAP for all trap
--- 639,645 ----
  
  	/* Immediate versions don't provide a code.  */
  	if (!(opcode & OPCODE))
! 		tcode = ((opcode >> 6) & ((1 << 10) - 1));
  
  	/*
  	 * (A short test says that IRIX 5.3 sends SIGTRAP for all trap

  reply	other threads:[~2004-06-11 20:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <40C9F5A4.2050606@avtrex.com>
     [not found] ` <40C9F5FE.8030607@avtrex.com>
2004-06-11 18:22   ` David Daney
2004-06-11 19:12     ` Maciej W. Rozycki
     [not found]       ` <mailpost.1086981251.16853@news-sj1-1>
2004-06-11 19:28         ` cgd
2004-06-11 19:50           ` Maciej W. Rozycki
2004-06-11 20:52             ` David Daney [this message]
2004-06-11 21:12               ` [Patch] (revised patch) " David Daney
2004-06-13  8:33                 ` Geert Uytterhoeven
2004-06-14 12:52                   ` Maciej W. Rozycki
2004-06-22 21:30           ` [Patch] " Maciej W. Rozycki
2004-06-23 19:33             ` David Daney
2004-06-23 19:38               ` Maciej W. Rozycki
2004-06-24 10:39             ` Richard Sandiford
2004-06-24 18:34               ` Maciej W. Rozycki
     [not found]                 ` <mailpost.1088102121.25381@news-sj1-1>
2004-06-24 18:47                   ` cgd
2004-06-28 13:46                     ` Maciej W. Rozycki
2004-06-28 15:19 cgd
2004-06-28 15:36 ` Maciej W. Rozycki
2004-07-19 14:22 ` Maciej W. Rozycki
     [not found]   ` <mailpost.1090246948.15046@news-sj1-1>
2004-07-19 15:19     ` cgd
2004-07-19 15:42       ` Maciej W. Rozycki
2004-07-19 23:29   ` Thiemo Seufer

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=40CA1B35.6010603@avtrex.com \
    --to=ddaney@avtrex.com \
    --cc=binutils@sources.redhat.com \
    --cc=cgd@broadcom.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@ds2.pg.gda.pl \
    --cc=ralf@linux-mips.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 read-only IMAP folder(s) and NNTP newsgroup(s).