Annotation of qemu/roms/openbios/arch/sparc32/vectors.S, revision 1.1.1.1

1.1       root        1: /*
                      2:  * <vectors.S>
                      3:  *
                      4:  * Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions.
                      5:  *
                      6:  *   Copyright (C) 1996, 2001 David S. Miller ([email protected])
                      7:  *
                      8:  *   This program is free software; you can redistribute it and/or
                      9:  *   modify it under the terms of the GNU General Public License
                     10:  *   version 2 as published by the Free Software Foundation.
                     11:  *
                     12:  *   This program is distributed in the hope that it will be useful,
                     13:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15:  *   GNU General Public License for more details.
                     16:  *
                     17:  *   You should have received a copy of the GNU General Public License
                     18:  *   along with this program; if not, write to the Free Software
                     19:  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
                     20:  *   MA  02110-1301, USA.
                     21:  *   This program is free software; you can redistribute it and/or
                     22:  *   modify it under the terms of the GNU General Public License V2
                     23:  *   as published by the Free Software Foundation
                     24:  */
                     25: 
                     26: #define __ASSEMBLY
                     27: #include "psr.h"
                     28: #include "asm/asi.h"
                     29: #define SER_ADDR5  0x71100004
                     30: #define SER_ADDR10 0xf1100004
                     31: 
                     32:         .section ".text.vectors", "ax"
                     33:         .align 4 /* Should be 16384, but alignment is handled by the ldscript */
                     34: /* Sparc32 trap table */
                     35:         .globl trap_table, t_zero, t_wovf, t_wunf, __divide_error
                     36: trap_table:
                     37: 
                     38: #define WINDOW_SPILL \
                     39:         rd %psr, %l0; rd %wim, %l3; b spill_window_entry; nop;
                     40: 
                     41: #define WINDOW_FILL \
                     42:         rd %psr, %l0; rd %wim, %l3; b fill_window_entry; nop;
                     43: 
                     44: #define BTRAP(lvl) ba bug; mov lvl, %g1; nop; nop;
                     45: #define BTRAPS(x) BTRAP(x) BTRAP(x+1) BTRAP(x+2) BTRAP(x+3) BTRAP(x+4) BTRAP(x+5) BTRAP(x+6) BTRAP(x+7)
                     46: #define TRAP_ENTRY_INTERRUPT(int_level) \
                     47:         sethi %hi(irq_entry ## int_level), %l7; \
                     48:         or %l7, %lo(irq_entry ## int_level), %l7; \
                     49:         jmp %l7; \
                     50:          nop
                     51: 
                     52: t_zero:         b entry; nop; nop; nop;
                     53:                 BTRAP(0x1) BTRAP(0x2) BTRAP(0x3) BTRAP(0x4)
                     54: t_wovf:         WINDOW_SPILL                        /* Window Overflow               */
                     55: t_wunf:         WINDOW_FILL                         /* Window Underflow              */
                     56:                 BTRAP(0x7)
                     57:                 BTRAPS(0x8)
                     58: #if 0
                     59:                 BAD_TRAP(0x10)
                     60: t_irq1:         TRAP_ENTRY_INTERRUPT(1)             /* IRQ Software/SBUS Level 1     */
                     61: t_irq2:         TRAP_ENTRY_INTERRUPT(2)             /* IRQ SBUS Level 2              */
                     62: t_irq3:         TRAP_ENTRY_INTERRUPT(3)             /* IRQ SCSI/DMA/SBUS Level 3     */
                     63: t_irq4:         TRAP_ENTRY_INTERRUPT(4)             /* IRQ Software Level 4          */
                     64: t_irq5:         TRAP_ENTRY_INTERRUPT(5)             /* IRQ SBUS/Ethernet Level 5     */
                     65: t_irq6:         TRAP_ENTRY_INTERRUPT(6)             /* IRQ Software Level 6          */
                     66: t_irq7:         TRAP_ENTRY_INTERRUPT(7)             /* IRQ Video/SBUS Level 5        */
                     67: t_irq8:         TRAP_ENTRY_INTERRUPT(8)             /* IRQ SBUS Level 6              */
                     68: t_irq9:         TRAP_ENTRY_INTERRUPT(9)             /* IRQ SBUS Level 7              */
                     69: t_irq10:        TRAP_ENTRY_INTERRUPT(10)            /* IRQ Timer #1 (one we use)     */
                     70: t_irq11:        TRAP_ENTRY_INTERRUPT(11)            /* IRQ Floppy Intr.              */
                     71: t_irq12:        TRAP_ENTRY_INTERRUPT(12)            /* IRQ Zilog serial chip         */
                     72: t_irq13:        TRAP_ENTRY_INTERRUPT(13)            /* IRQ Audio Intr.               */
                     73: t_irq14:        TRAP_ENTRY_INTERRUPT(14)            /* IRQ Timer #2                  */
                     74: t_nmi:          BAD_TRAP(0x1f)                      /* Level 15 (NMI)                */
                     75: #else
                     76:                 BTRAPS(0x10)
                     77:                 BTRAP(0x18) BTRAP(0x19)
                     78: t_irq10:        TRAP_ENTRY_INTERRUPT(10)            /* IRQ Timer #1 (one we use)     */
                     79:                 BTRAP(0x1b) BTRAP(0x1c) BTRAP(0x1d)
                     80: t_irq14:        TRAP_ENTRY_INTERRUPT(14)            /* IRQ Timer #2                  */
                     81:                 BTRAP(0x1f)
                     82: #endif
                     83:                 BTRAPS(0x20) BTRAPS(0x28)
                     84:                 BTRAPS(0x30) BTRAPS(0x38)
                     85:                 BTRAPS(0x40) BTRAPS(0x48)
                     86:                 BTRAPS(0x50) BTRAPS(0x58)
                     87:                 BTRAPS(0x60) BTRAPS(0x68)
                     88:                 BTRAPS(0x70) BTRAPS(0x78)
                     89:                 BTRAPS(0x80) BTRAPS(0x88)
                     90:                 BTRAPS(0x90) BTRAPS(0x98)
                     91:                 BTRAPS(0xa0) BTRAPS(0xa8)
                     92:                 BTRAPS(0xb0) BTRAPS(0xb8)
                     93:                 BTRAPS(0xc0) BTRAPS(0xc8)
                     94:                 BTRAPS(0xd0) BTRAPS(0xd8)
                     95:                 BTRAPS(0xe0) BTRAPS(0xe8)
                     96:                 BTRAPS(0xf0) BTRAPS(0xf8)
                     97: 
                     98:         .section ".text", "ax"
                     99:         .align 4
                    100: __divide_error:
                    101: bug:
                    102:         /* Dump the exception and its context */
                    103:         ! Set up CPU state
                    104:         rd      %psr, %g2
                    105:         andn    %g2, PSR_ET, %g2
                    106:         wr      %g2, %psr
                    107:         ! Disable mmu, re-enable boot mode
                    108:         set     _start, %g3
                    109:         set     dump_exception, %g2
                    110:         sub     %g2, %g3, %g3
                    111:         set     3 << 13, %g2
                    112:         jmp    %g3
                    113:          sta    %g2, [%g0] ASI_M_MMUREGS
                    114: 
                    115: outstr:
                    116:         /* void outstr (unsigned long port5, unsigned long port10,
                    117:          * const unsigned char *str);
                    118:          * Writes a string on an IO port.
                    119:          */
                    120: 1:      lduba    [%o2] ASI_M_KERNELTXT, %o3
                    121:         cmp     %o3, 0
                    122:         be      2f
                    123:          nop
                    124:         stba    %o3, [%o0] ASI_M_BYPASS
                    125:         stba    %o3, [%o1] ASI_M_CTL
                    126:         b       1b
                    127:          inc    %o2
                    128: 2:      retl
                    129:          nop
                    130: 
                    131: outhex:
                    132:         /* void outhex (unsigned long port5, unsigned long port10,
                    133:          * uint32_t value);
                    134:          * Dumps a 32 bits hex number on serial port
                    135:          */
                    136:         mov     %o2, %o4
                    137:         set     28, %o3
                    138:         srl     %o4, %o3, %o2
                    139: 1:      and     %o2, 0xf, %o2
                    140:         cmp     %o2, 9
                    141:         bgt     2f
                    142:          nop
                    143:         b       3f
                    144:          add    %o2, '0', %o2
                    145: 2:      add     %o2, 'a' - 10, %o2
                    146: 3:      stba    %o2, [%o0] ASI_M_BYPASS
                    147:         stba    %o2, [%o1] ASI_M_CTL
                    148:         subcc   %o3, 4, %o3
                    149:         bge     1b
                    150:          srl    %o4, %o3, %o2
                    151:         retl
                    152:          nop
                    153: 
                    154:         /* void dump_exception ();
                    155:          *
                    156:          * Dump a message when catching an exception
                    157:          */
                    158: dump_exception:
                    159:         set     SER_ADDR5 + 2, %o0
                    160:         set     SER_ADDR10 + 2, %o1
                    161:         set     (_BUG_message_0), %o2
                    162:         call    outstr
                    163:          nop
                    164: 
                    165:         call    outhex
                    166:          mov    %g1, %o2
                    167: 
                    168:         set     (_BUG_message_1), %o2
                    169:         call    outstr
                    170:          nop
                    171: 
                    172:         call    outhex
                    173:          mov    %l1, %o2
                    174: 
                    175:         set     (_BUG_message_2), %o2
                    176:         call    outstr
                    177:          nop
                    178: 
                    179:         call    outhex
                    180:          mov    %l2, %o2
                    181: 
                    182:         set     (_BUG_message_3), %o2
                    183:         call    outstr
                    184:          nop
                    185: _forever:
                    186:         /* Loop forever */
                    187:         b       _forever                                  ;
                    188:          nop
                    189: 
                    190: irq_entry10:
                    191:         sethi   %hi(counter_regs), %l7
                    192:         ld      [%l7 + %lo(counter_regs)], %l7
                    193:         sethi   0x10000, %l6
                    194:         ld      [%l7 + %l6], %g0
                    195:         jmp     %l1
                    196:          rett   %l2
                    197: 
                    198: irq_entry14:
                    199:         sethi   %hi(counter_regs), %l7
                    200:         ld      [%l7 + %lo(counter_regs)], %l7
                    201:         ld      [%l7], %g0
                    202:         jmp     %l1
                    203:          rett  %l2
                    204: 
                    205: /* Register window handlers */
                    206: #include "wof.S"
                    207: #include "wuf.S"
                    208: 
                    209:         .section .rodata
                    210: _BUG_message_0:
                    211:         .string "Unhandled Exception 0x"
                    212: _BUG_message_1:
                    213:         .string "\r\nPC = 0x"
                    214: _BUG_message_2:
                    215:         .string " NPC = 0x"
                    216: _BUG_message_3:
                    217:         .string "\r\nStopping execution\r\n"

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.