This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] MIPS: Trap instructions in division/multiply expansions

On Mon, Jul 08, 2002 at 02:45:04PM -0700, wrote:

> >  I believe it would be correct to embed a non-zero code in trap
> > instructions used in division/multiply macro expansions, similarly to how
> > breakpoint codes (6 and 7) are used in the non-trap versions.  The
> > following patch implements it.  At least MIPS/Linux extracts these codes
> > from both break and trap opcodes and uses them to determine whether
> > SIGTRAP or SIGFPE should be sent.  Any comments? 
> What do other OSes do for these cases?  (In particular, i'm wondering
> what the SGI assembler does.)

The trap codes Linux/MIPS is using in the kernel are the same as in IRIX;
they're generated by the IRIX assembler as well.  For example:

bash$ cat s.s 
        div     $2, $3
bash$ bash$ as -o s.o s.s
bash$ mips-linux-objdump -d s.o 

s.o:     file format elf32-bigmips

Disassembly of section .text:

0000000000000000 <.text>:
   0:   0043001a        div     $zero,$v0,$v1
   4:   14600002        bnez    $v1,0x10
   8:   00000021        move    $zero,$zero
   c:   0007000d        break   0x7
  10:   2401ffff        li      $at,-1
  14:   14610004        bne     $v1,$at,0x28
  18:   3c018000        lui     $at,0x8000
  1c:   14410002        bne     $v0,$at,0x28
  20:   00000021        move    $zero,$zero
  24:   0006000d        break   0x6
  28:   00001012        mflo    $v0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]