SPARC traps under SunOS

By: Jim Moore, SunSoft, Sun Microsystems Inc
Email: Jim.Moore@UK.Sun.COM
Version: 1.01
Date: 4 April 1997


Appendixies

APPENDIX A - SPARC v7/v8 TRAPS

This is a list of SPARC v7/v8 traps and the associated definitions, where applicable but note that while this should be accurate for all SPARC's, it is possible that some implementations may differ.
The table shows the trap number (TRAP), the trap priority (PRI) and the description. With trap priorities, the lowest number has the highest priority.

        TRAP    PRI     DESCRIPTION

        0x00      1     Reset
        0x01      5     Text fault, instruction access exception
        0x02      7     Illegal instruction
        0x03      6     Privileged instruction
        0x04      8     Floating point disabled
        0x05      9     Window overflow
        0x06      9     Window underflow
        0x07     10     Memory address not aligned
        0x08     11     Floating point exception
        0x09     13     Data fault, data access exception
        0x0A     14     Tag overflow
        0x0B      8     Watchpoint detected
        0x0C - 0x10     Undefined
        0x11     31     Interrupt, level 1  - Implementation dependent
        0x12     30     Interrupt, level 2  - Sbus/VME level 1
        0x13     29     Interrupt, level 3  - Sbus/VME level 2
        0x14     28     Interrupt, level 4  - Onboard SCSI
        0x15     27     Interrupt, level 5  - Sbus/VME level 3
        0x16     26     Interrupt, level 6  - Onboard ethernet
        0x17     25     Interrupt, level 7  - Sbus/VME level 4
        0x18     24     Interrupt, level 8  - Onboard video
        0x19     23     Interrupt, level 9  - Sbus/VME level 5, module
        0x1A     22     Interrupt, level 10 - TOD clock
        0x1B     21     Interrupt, level 11 - Sbus/VME level 6, floppy
        0x1C     20     Interrupt, level 12 - Serial I/O
        0x1D     19     Interrupt, level 13 - Sbus/VME level 7, audio, X-Call
        0x1E     18     Interrupt, level 14 - Hi-res system timer
        0x1F     17     Interrupt, level 15 - Asynchronous memory fault
        0x20      4     Register access error (you're hosed!)
        0x21      3     Text fault, instruction access error
        0x22 - 0x23     Undefined
        0x24      8     Coprocessor disabled
        0x25      8     FLUSH/IFLUSH not implemented
        0x26 - 0x27     Undefined
        0x28     11     Coprocessor exception
        0x29     12     Data access error
        0x2A     15     Division by zero exception
        0x2B      2     Data store error
        0x2C     12     Data access MMU miss
        0x2D - 0x3B     Undefined
        0x3C      2     Instruction access MMU miss
        0x3D - 0x5F     Undefined
        0x60 - 0x7F     Implementation dependent
Software traps (trap instruction). All at priority 16. This is totally up to the OS designer so these are the SunOS definitions...
        0x80            SunOS 4.x system call
        0x81            User breakpoint
        0x82            Userland divide by zero
        0x83            Flush windows
        0x84            Clean windows
        0x85            Range check
        0x86            Handle unaligned references (Grrr!)
        0x87            Not used (bad trap)
        0x88            System call (ta 0x8)
        0x89            Set trap0 address (lwp->lwp_pcb.pcb_trap0addr)
        0x8A - 0x9F     Not used (bad trap)
        0xA0            Get condition codes
        0xA1            Set condition codes
        0xA2            Get PSR
        0xA3            Set PSR (don't get excited...some fields only :-)
        0xA4            Get timestamp
        0xA5            Get LWP virtual time
        0xA6            Not used (bad trap)
        0xA7            Get hi-res time
        0xA8 - 0xAF     Not used (bad trap)
        0xB0 - 0xB7     Trap tracing facility
        0xB8 - 0xFE     Not used (bad trap)
        0xFF            Drop to prom (or kadb)

APPENDIX B - SPARC v9 TRAPS

This is a list of SPARC v9 traps and the associated definitions, where applicable but note that while this should be accurate for all SPARC's, it is possible that some implementations may differ.
The table shows the trap number (TRAP), the trap priority (PRI) and the description. With trap priorities, the lowest number has the highest priority.

        TRAP    PRI     DESCRIPTION

        0x000   -       Reserved
        0x001   0       Power on reset (POR)
        0x002   1       Watchdog reset (WDR)
        0x003   1       Externally initiated reset (XIR)
        0x004   1       Software initiated reset (SIR)
        0x005   1       RED state exception
        0x006 - 0x007   Reserved
        0x008   5       Instruction access exception
        0x009   2       Instruction access MMU miss
        0x00A   3       Instruction access error
        0x00B - 0x00F   Reserved
        0x010   7       Illegal instruction
        0x011   6       Privileged opcode (instruction)
        0x012   6       Unimplemented LDD
        0x013   6       Unimplemented STD
        0x014 - 0x01F   Reserved
        0x020   8       Floating point disabled
        0x021   11      IEEE 754 floating point exception
        0x022   11      Other floating point exception
        0x023   14      Tag overflow
        0x024 - 0x027   Clean Window
        0x028   15      Division by zero
        0x029   4       Internal processor error
        0x02A - 0x02F   Reserved
        0x030   12      Data access Exception
        0x031   12      Data access MMU miss
        0x032   12      Data access error
        0x033   12      Data access protection
        0x034   12      Memory address not aligned
        0x035   12      LDDF memory address not aligned
        0x036   12      STDF memory address not aligned
        0x037   12      Privileged action (eg: ASI access)
        0x038   12      LDQF memory address not aligned
        0x039   12      STQF memory address not aligned
        0x03A - 0x03F   Reserved
        0x040   2       Asynchronous data error (ECC data store error)
        0x041   31      Interrupt, level 1  - Implementation dependent
        0x042   30      Interrupt, level 2  - Sbus/VME level 1
        0x043   29      Interrupt, level 3  - Sbus/VME level 2
        0x044   28      Interrupt, level 4  - Onboard SCSI
        0x045   27      Interrupt, level 5  - Sbus/VME level 3
        0x046   26      Interrupt, level 6  - Onboard ethernet
        0x047   25      Interrupt, level 7  - Sbus/VME level 4
        0x048   24      Interrupt, level 8  - Onboard video
        0x049   23      Interrupt, level 9  - Sbus/VME level 5, module
        0x04A   22      Interrupt, level 10 - TOD clock
        0x04B   21      Interrupt, level 11 - Sbus/VME level 6, floppy
        0x04C   20      Interrupt, level 12 - Serial I/O
        0x04D   19      Interrupt, level 13 - Sbus/VME level 7, audio, X-Call
        0x04E   18      Interrupt, level 14 - Hi-res system timer
        0x04F   17      Interrupt, level 15 - Asynchronous memory fault
        0x050 - 0x05F   Reserved
These next traps from 0x060 to 0x07F have an implementation dependent priority and definition. The SunOS definitions are listed here...
        0x060           Interrupt vector
        0x061           Physical address watchpoint
        0x062           Virtual address watchpoint
        0x063           Corrected ECC error
        0x064           Instruction access MMU miss
        0x065 - 0x067   Undefined
        0x068           Data access MMU miss
        0x069 - 0x06B   Undefined
        0x06C           Data access protection
        0x06D - 0x07F   Undefined
        0x060 - 0x07F   Implementation dependent
This next wedge of traps are for fills and spills, all of these have a priority of 9. Don't forget that spill/fill trap vectors are 32 instructions long. This supersede the v7/v8 window overflow and underflow traps...
	0x080           OTHERWIN=0, WSTATE.NORMAL=0 spill, normal
                ...
        0x09F           OTHERWIN=0, WSTATE.NORMAL=7 spill, normal

        0x0A0           OTHERWIN!=0, WSTATE.OTHER=0 spill, other
                ...
        0x0BF           OTHERWIN!=0, WSTATE.OTHER=7 spill, other

        0x0C0           OTHERWIN=0, WSTATE.NORMAL=0 fill, normal
                ...
        0x0DF           OTHERWIN=0, WSTATE.NORMAL=7 fill, normal

        0x0E0           OTHERWIN!=0, WSTATE.OTHER=0 fill, other
                ...
        0x0FF           OTHERWIN!=0, WSTATE.OTHER=7 fill, other
That concludes the machine originated traps. This next section describes the software traps (trap instruction originated). The uses for these are up to the OS designer so I've documented the SunOS definitions here. These are all at priority 16...
        0x100           SunOS 4.x system call
        0x101           User breakpoint
        0x102           Userland divide by zero
        0x103           Flush windows
        0x104           Clean windows
        0x105           Range check
        0x106           Handle unaligned references
        0x107           Not used
        0x108           System call
        0x109           Set trap0 address (lwp->lwp_pcb.pcb_trap0addr)
        0x10A - 0x11F   Not used
        0x120           Get condition codes
        0x121           Set condition codes
        0x122           Get PSR
        0x123           Set PSR (some fields only :-)
        0x124           Get timestamp
        0x125           Get lwp virtual time
        0x126           Self directed cross call
        0x127           Get hi-res time
        0x128 - 0x12F   Not used
        0x130 - 0x137   Trap tracing facility
        0x138 - 0x17C   Not used
        0x17D           kadb enter
        0x17E           kadb breakpoint
        0x17F           OpenBoot Prom breakpoint
This last quarter of the trap table is reserved for future use.

        0x180 - 0x1FF   Reserved

Back to table of contents