root/include/asm-sparc/traps.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* traps.h:  Format of entries for the Sparc trap table.
   2  *
   3  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   4  */
   5 
   6 #ifndef _SPARC_TRAPS_H
   7 #define _SPARC_TRAPS_H
   8 
   9 #define NUM_SPARC_TRAPS  255
  10 
  11 /* This is for V8 and V9 compliant Sparc CPUS */
  12 struct tt_entry {
  13         unsigned long inst_one;
  14         unsigned long inst_two;
  15         unsigned long inst_three;
  16         unsigned long inst_four;
  17 };
  18 
  19 /* We set this to _start in system setup. */
  20 extern struct tt_entry *sparc_ttable;
  21 
  22 /* This for V9 compliant Sparc CPUS */
  23 struct tt_v9_entry {
  24         unsigned long inst_one;
  25         unsigned long inst_two;
  26         unsigned long inst_three;
  27         unsigned long inst_four;
  28         unsigned long inst_five;
  29         unsigned long inst_six;
  30         unsigned long inst_seven;
  31         unsigned long inst_eight;
  32 };
  33 
  34 /* V9 has multiple trap tables, which one is used depends
  35  * upon how deep within multiple traps you are.
  36  * I believe the UltraSparc supports two levels now.
  37  */
  38 extern struct tt_v9_entry *sparc_v9_ttablel0;
  39 extern struct tt_v9_entry *sparc_v9_ttablel1;
  40 
  41 /* For patching the trap table at boot time, we need to know how to
  42  * form various common Sparc instructions.  Thus these macros...
  43  */
  44 
  45 #define SPARC_MOV_CONST_L3(const) (0xa6102000 | (const&0xfff))
  46 
  47 /* The following assumes that the branch lies before the place we
  48  * are branching to.  This is the case for a trap vector...
  49  * You have been warned.
  50  */
  51 #define SPARC_BRANCH(dest_addr, inst_addr) \
  52           (0x10800000 | (((dest_addr-inst_addr)>>2)&0x3fffff))
  53 
  54 #define SPARC_RD_PSR_L0  (0xa1480000)
  55 #define SPARC_NOP (0x01000000)
  56 
  57 /* Various interesting trap levels. */
  58 /* First, hardware traps. */
  59 #define SP_TRAP_TFLT    0x1          /* Text fault */
  60 #define SP_TRAP_II      0x2          /* Illegal Instruction */
  61 #define SP_TRAP_PI      0x3          /* Priviledged Instruction */
  62 #define SP_TRAP_FPD     0x4          /* Floating Point Disabled */
  63 #define SP_TRAP_WOVF    0x5          /* Window Overflow */
  64 #define SP_TRAP_WUNF    0x6          /* Window Underflow */
  65 #define SP_TRAP_MNA     0x7          /* Memory Address Unaligned */
  66 #define SP_TRAP_FPE     0x8          /* Floating Point Exception */
  67 #define SP_TRAP_DFLT    0x9          /* Data Fault */
  68 #define SP_TRAP_TOF     0xa          /* Tag Overflow */
  69 #define SP_TRAP_WDOG    0xb          /* Watchpoint Detected */
  70 #define SP_TRAP_IRQ1    0x11         /* IRQ level 1 */
  71 #define SP_TRAP_IRQ2    0x12         /* IRQ level 2 */
  72 #define SP_TRAP_IRQ3    0x13         /* IRQ level 3 */
  73 #define SP_TRAP_IRQ4    0x14         /* IRQ level 4 */
  74 #define SP_TRAP_IRQ5    0x15         /* IRQ level 5 */
  75 #define SP_TRAP_IRQ6    0x16         /* IRQ level 6 */
  76 #define SP_TRAP_IRQ7    0x17         /* IRQ level 7 */
  77 #define SP_TRAP_IRQ8    0x18         /* IRQ level 8 */
  78 #define SP_TRAP_IRQ9    0x19         /* IRQ level 9 */
  79 #define SP_TRAP_IRQ10   0x1a         /* IRQ level 10 */
  80 #define SP_TRAP_IRQ11   0x1b         /* IRQ level 11 */
  81 #define SP_TRAP_IRQ12   0x1c         /* IRQ level 12 */
  82 #define SP_TRAP_IRQ13   0x1d         /* IRQ level 13 */
  83 #define SP_TRAP_IRQ14   0x1e         /* IRQ level 14 */
  84 #define SP_TRAP_IRQ15   0x1f         /* IRQ level 15 Non-maskable */
  85 #define SP_TRAP_RACC    0x20         /* Register Access Error ??? */
  86 #define SP_TRAP_IACC    0x21         /* Instruction Access Error */
  87 #define SP_TRAP_CPDIS   0x24         /* Co-Processor Disabled */
  88 #define SP_TRAP_BADFL   0x25         /* Unimplemented Flush Instruction */
  89 #define SP_TRAP_CPEXP   0x28         /* Co-Processor Exception */
  90 #define SP_TRAP_DACC    0x29         /* Data Access Error */
  91 #define SP_TRAP_DIVZ    0x2a         /* Divide By Zero */
  92 #define SP_TRAP_DSTORE  0x2b         /* Data Store Error ??? */
  93 #define SP_TRAP_DMM     0x2c         /* Data Access MMU Miss ??? */
  94 #define SP_TRAP_IMM     0x3c         /* Instruction Access MMU Miss ??? */
  95 
  96 /* Now the Software Traps... */
  97 #define SP_TRAP_SUNOS   0x80         /* SunOS System Call */
  98 #define SP_TRAP_SBPT    0x81         /* Software Breakpoint */
  99 #define SP_TRAP_SDIVZ   0x82         /* Software Divide-by-Zero trap */
 100 #define SP_TRAP_FWIN    0x83         /* Flush Windows */
 101 #define SP_TRAP_CWIN    0x84         /* Clean Windows */
 102 #define SP_TRAP_RCHK    0x85         /* Range Check */
 103 #define SP_TRAP_FUNA    0x86         /* Fix Unaligned Access */
 104 #define SP_TRAP_IOWFL   0x87         /* Integer Overflow */
 105 #define SP_TRAP_SOLARIS 0x88         /* Solaris System Call */
 106 #define SP_TRAP_NETBSD  0x89         /* NetBSD System Call */
 107 #define SP_TRAP_LINUX   0x90         /* Linux System Call */
 108 
 109 /* Special traps... */
 110 #define SP_TRAP_KBPT1   0xfe         /* KADB/PROM Breakpoint one */
 111 #define SP_TRAP_KBPT2   0xff         /* KADB/PROM Breakpoint two */
 112 
 113 /* Handy Macros */
 114 /* Is this a trap we never expect to get? */
 115 #define BAD_TRAP_P(level) \
 116         ((level > SP_TRAP_WDOG && level < SP_TRAP_IRQ1) || \
 117          (level > SP_TRAP_IACC && level < SP_TRAP_CPDIS) || \
 118          (level > SP_TRAP_BADFL && level < SP_TRAP_CPEXP) || \
 119          (level > SP_TRAP_DMM && level < SP_TRAP_IMM) || \
 120          (level > SP_TRAP_IMM && level < SP_TRAP_SUNOS) || \
 121          (level > SP_TRAP_LINUX && level < SP_TRAP_KBPT1))
 122 
 123 /* Is this a Hardware trap? */
 124 #define HW_TRAP_P(level) ((level > 0) && (level < SP_TRAP_SUNOS))
 125 
 126 /* Is this a Software trap? */
 127 #define SW_TRAP_P(level) ((level >= SP_TRAP_SUNOS) && (level <= SP_TRAP_KBPT2))
 128 
 129 /* Is this a system call for some OS we know about? */
 130 #define SCALL_TRAP_P(level) ((level == SP_TRAP_SUNOS) || \
 131                              (level == SP_TRAP_SOLARIS) || \
 132                              (level == SP_TRAP_NETBSD) || \
 133                              (level == SP_TRAP_LINUX))
 134 
 135 #endif /* !(_SPARC_TRAPS_H) */

/* [previous][next][first][last][top][bottom][index][help] */