The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/arch/sparc/kernel/head.S

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $Id: head.S,v 1.105 2001/08/12 09:08:56 davem Exp $
    2  * head.S: The initial boot code for the Sparc port of Linux.
    3  *
    4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
    5  * Copyright (C) 1995,1999 Pete Zaitcev   (zaitcev@yahoo.com)
    6  * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
    7  * Copyright (C) 1997 Jakub Jelinek   (jj@sunsite.mff.cuni.cz)
    8  * Copyright (C) 1997 Michael A. Griffith (grif@acm.org)
    9  *
   10  * CompactPCI platform by Eric Brower, 1999.
   11  */
   12 
   13 #include <linux/version.h>
   14 #include <linux/config.h>
   15 #include <linux/init.h>
   16 
   17 #include <asm/cprefix.h>
   18 #include <asm/head.h>
   19 #include <asm/asi.h>
   20 #include <asm/contregs.h>
   21 #include <asm/ptrace.h>
   22 #include <asm/psr.h>
   23 #include <asm/page.h>
   24 #include <asm/kdebug.h>
   25 #include <asm/winmacro.h>
   26 #include <asm/errno.h>
   27 
   28         .data
   29 /* 
   30  * The following are used with the prom_vector node-ops to figure out
   31  * the cpu-type 
   32  */
   33 
   34         .align 4
   35         .globl  C_LABEL(cputyp)
   36 C_LABEL(cputyp):
   37         .word   1
   38 
   39         .align 4
   40         .globl C_LABEL(cputypval)
   41 C_LABEL(cputypval):
   42         .asciz "sun4c"
   43         .ascii "     "
   44 
   45 C_LABEL(cputypvalend):
   46 C_LABEL(cputypvallen) = C_LABEL(cputypvar) - C_LABEL(cputypval)
   47 
   48         .align 4
   49 /*
   50  * Sun people can't spell worth damn. "compatability" indeed.
   51  * At least we *know* we can't spell, and use a spell-checker.
   52  */
   53 
   54 /* Uh, actually Linus it is I who cannot spell. Too much murky
   55  * Sparc assembly will do this to ya.
   56  */
   57 C_LABEL(cputypvar):
   58         .asciz "compatability"
   59 
   60 /* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */
   61         .align 4
   62 C_LABEL(cputypvar_sun4m):
   63         .asciz "compatible"
   64 
   65         .align 4
   66 
   67 #ifndef CONFIG_SUN4
   68 sun4_notsup:
   69         .asciz  "Sparc-Linux sun4 needs a specially compiled kernel, turn CONFIG_SUN4 on.\n\n"
   70         .align 4
   71 #else
   72 sun4cdm_notsup:
   73         .asciz  "Kernel compiled with CONFIG_SUN4 cannot run on SUN4C/SUN4M/SUN4D\nTurn CONFIG_SUN4 off.\n\n"
   74         .align 4
   75 #endif
   76 
   77 sun4e_notsup:
   78         .asciz  "Sparc-Linux sun4e support does not exist\n\n"
   79         .align 4
   80 
   81 #ifndef CONFIG_SUNOS_EMUL
   82 #undef SUNOS_SYSCALL_TRAP
   83 #define SUNOS_SYSCALL_TRAP SUNOS_NO_SYSCALL_TRAP
   84 #endif
   85 
   86         /* The Sparc trap table, bootloader gives us control at _start. */
   87         .text
   88         .globl  start, _stext, _start, __stext
   89         .globl  C_LABEL(trapbase)
   90 _start:   /* danger danger */
   91 __stext:
   92 _stext:
   93 start:
   94 C_LABEL(trapbase):
   95 #ifdef CONFIG_SMP
   96 C_LABEL(trapbase_cpu0):
   97 #endif
   98 /* We get control passed to us here at t_zero. */
   99 t_zero: b gokernel; nop; nop; nop;
  100 t_tflt: SPARC_TFAULT                        /* Inst. Access Exception        */
  101 t_bins: TRAP_ENTRY(0x2, bad_instruction)    /* Illegal Instruction           */
  102 t_pins: TRAP_ENTRY(0x3, priv_instruction)   /* Privileged Instruction        */
  103 t_fpd:  TRAP_ENTRY(0x4, fpd_trap_handler)   /* Floating Point Disabled       */
  104 t_wovf: WINDOW_SPILL                        /* Window Overflow               */
  105 t_wunf: WINDOW_FILL                         /* Window Underflow              */
  106 t_mna:  TRAP_ENTRY(0x7, mna_handler)        /* Memory Address Not Aligned    */
  107 t_fpe:  TRAP_ENTRY(0x8, fpe_trap_handler)   /* Floating Point Exception      */
  108 t_dflt: SPARC_DFAULT                        /* Data Miss Exception           */
  109 t_tio:  TRAP_ENTRY(0xa, do_tag_overflow)    /* Tagged Instruction Ovrflw     */
  110 t_wpt:  TRAP_ENTRY(0xb, do_watchpoint)      /* Watchpoint Detected           */
  111 t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  112 t_irq1: TRAP_ENTRY_INTERRUPT(1)             /* IRQ Software/SBUS Level 1     */
  113 t_irq2: TRAP_ENTRY_INTERRUPT(2)             /* IRQ SBUS Level 2              */
  114 t_irq3: TRAP_ENTRY_INTERRUPT(3)             /* IRQ SCSI/DMA/SBUS Level 3     */
  115 t_irq4: TRAP_ENTRY_INTERRUPT(4)             /* IRQ Software Level 4          */
  116 t_irq5: TRAP_ENTRY_INTERRUPT(5)             /* IRQ SBUS/Ethernet Level 5     */
  117 t_irq6: TRAP_ENTRY_INTERRUPT(6)             /* IRQ Software Level 6          */
  118 t_irq7: TRAP_ENTRY_INTERRUPT(7)             /* IRQ Video/SBUS Level 5        */
  119 t_irq8: TRAP_ENTRY_INTERRUPT(8)             /* IRQ SBUS Level 6              */
  120 t_irq9: TRAP_ENTRY_INTERRUPT(9)             /* IRQ SBUS Level 7              */
  121 t_irq10:TRAP_ENTRY_INTERRUPT(10)            /* IRQ Timer #1 (one we use)     */
  122 t_irq11:TRAP_ENTRY_INTERRUPT(11)            /* IRQ Floppy Intr.              */
  123 t_irq12:TRAP_ENTRY_INTERRUPT(12)            /* IRQ Zilog serial chip         */
  124 t_irq13:TRAP_ENTRY_INTERRUPT(13)            /* IRQ Audio Intr.               */
  125 t_irq14:TRAP_ENTRY_INTERRUPT(14)            /* IRQ Timer #2                  */
  126         .globl  t_nmi
  127 #ifndef CONFIG_SMP
  128 t_nmi:  NMI_TRAP                            /* Level 15 (NMI)                */
  129 #else
  130 t_nmi:  TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  131 #endif
  132 t_racc: TRAP_ENTRY(0x20, do_reg_access)     /* General Register Access Error */
  133 t_iacce:BAD_TRAP(0x21)                      /* Instr Access Error            */
  134 t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
  135 t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled)    /* Co-Processor Disabled         */
  136 t_uflsh:SKIP_TRAP(0x25, unimp_flush)        /* Unimplemented FLUSH inst.     */
  137 t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
  138 t_cpexc:TRAP_ENTRY(0x28, do_cp_exception)   /* Co-Processor Exception        */
  139 t_dacce:SPARC_DFAULT                        /* Data Access Error             */
  140 t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero)     /* Division by zero, you lose... */
  141 t_dserr:BAD_TRAP(0x2b)                      /* Data Store Error              */
  142 t_daccm:BAD_TRAP(0x2c)                      /* Data Access MMU-Miss          */
  143 t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  144 t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  145 t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  146 t_iaccm:BAD_TRAP(0x3c)                      /* Instr Access MMU-Miss         */
  147 t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
  148 t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
  149 t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
  150 t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
  151 t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  152 t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  153 t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  154 t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  155 t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  156 t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  157 t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  158 t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  159 t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  160 t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  161 t_sunos:SUNOS_SYSCALL_TRAP                  /* SunOS System Call             */
  162 t_sbkpt:BREAKPOINT_TRAP                     /* Software Breakpoint/KGDB      */
  163 t_divz: TRAP_ENTRY(0x82, do_hw_divzero)     /* Divide by zero trap           */
  164 t_flwin:TRAP_ENTRY(0x83, do_flush_windows)  /* Flush Windows Trap            */
  165 t_clwin:BAD_TRAP(0x84)                      /* Clean Windows Trap            */
  166 t_rchk: BAD_TRAP(0x85)                      /* Range Check                   */
  167 t_funal:BAD_TRAP(0x86)                      /* Fix Unaligned Access Trap     */
  168 t_iovf: BAD_TRAP(0x87)                      /* Integer Overflow Trap         */
  169 t_slowl:SOLARIS_SYSCALL_TRAP                /* Slowaris System Call          */
  170 t_netbs:NETBSD_SYSCALL_TRAP                 /* Net-B.S. System Call          */
  171 t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
  172 t_bad8f:BAD_TRAP(0x8f)
  173 t_linux:LINUX_SYSCALL_TRAP                  /* Linux System Call             */
  174 t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
  175 t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
  176 t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
  177 t_getcc:GETCC_TRAP                          /* Get Condition Codes           */
  178 t_setcc:SETCC_TRAP                          /* Set Condition Codes           */
  179 t_getpsr:GETPSR_TRAP                        /* Get PSR Register              */
  180 t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  181 t_slowi:INDIRECT_SOLARIS_SYSCALL(156)
  182 t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  183 t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  184 t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  185 t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  186 t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  187 t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  188 t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  189 t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  190 t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  191 t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  192 t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  193 t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  194 t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  195 t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  196 t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  197 t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  198 t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  199 t_badfc:BAD_TRAP(0xfc) BAD_TRAP(0xfd)
  200 dbtrap: BAD_TRAP(0xfe)                      /* Debugger/PROM breakpoint #1   */
  201 dbtrap2:BAD_TRAP(0xff)                      /* Debugger/PROM breakpoint #2   */ 
  202 
  203         .globl  C_LABEL(end_traptable)
  204 C_LABEL(end_traptable):
  205 
  206 #ifdef CONFIG_SMP
  207         /* Trap tables for the other cpus. */
  208         .globl  C_LABEL(trapbase_cpu1), C_LABEL(trapbase_cpu2), C_LABEL(trapbase_cpu3)
  209 C_LABEL(trapbase_cpu1):
  210         BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
  211         TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
  212         WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
  213         TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
  214         TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
  215         BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  216         TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
  217         TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
  218         TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
  219         TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
  220         TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
  221         TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
  222         TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
  223         TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  224         TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
  225         BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
  226         BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
  227         SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
  228         BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  229         BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  230         BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  231         BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
  232         BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
  233         BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
  234         BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
  235         BAD_TRAP(0x50)
  236         BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  237         BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  238         BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  239         BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  240         BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  241         BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  242         BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  243         BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  244         BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  245         BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  246         SUNOS_SYSCALL_TRAP 
  247         BREAKPOINT_TRAP
  248         TRAP_ENTRY(0x82, do_hw_divzero)
  249         TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
  250         BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
  251         NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
  252         BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
  253         LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
  254         BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
  255         BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
  256         BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
  257         BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  258         INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  259         BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  260         BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  261         BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  262         BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  263         BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  264         BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  265         BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  266         BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  267         BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  268         BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  269         BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  270         BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  271         BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  272         BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  273         BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  274         BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  275         BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
  276 
  277 C_LABEL(trapbase_cpu2):
  278         BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
  279         TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
  280         WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
  281         TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
  282         TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
  283         BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  284         TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
  285         TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
  286         TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
  287         TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
  288         TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
  289         TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
  290         TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
  291         TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  292         TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
  293         BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
  294         BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
  295         SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
  296         BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  297         BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  298         BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  299         BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
  300         BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
  301         BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
  302         BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
  303         BAD_TRAP(0x50)
  304         BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  305         BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  306         BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  307         BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  308         BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  309         BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  310         BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  311         BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  312         BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  313         BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  314         SUNOS_SYSCALL_TRAP 
  315         BREAKPOINT_TRAP
  316         TRAP_ENTRY(0x82, do_hw_divzero)
  317         TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
  318         BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
  319         NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
  320         BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
  321         LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
  322         BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
  323         BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
  324         BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
  325         BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  326         INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  327         BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  328         BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  329         BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  330         BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  331         BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  332         BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  333         BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  334         BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  335         BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  336         BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  337         BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  338         BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  339         BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  340         BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  341         BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  342         BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  343         BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
  344 
  345 C_LABEL(trapbase_cpu3):
  346         BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
  347         TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
  348         WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
  349         TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
  350         TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
  351         BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
  352         TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
  353         TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
  354         TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
  355         TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
  356         TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
  357         TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
  358         TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
  359         TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
  360         TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
  361         BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
  362         BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
  363         SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
  364         BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
  365         BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
  366         BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
  367         BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
  368         BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
  369         BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
  370         BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
  371         BAD_TRAP(0x50)
  372         BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
  373         BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
  374         BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
  375         BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
  376         BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
  377         BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
  378         BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
  379         BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
  380         BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
  381         BAD_TRAP(0x7e) BAD_TRAP(0x7f)
  382         SUNOS_SYSCALL_TRAP  
  383         BREAKPOINT_TRAP
  384         TRAP_ENTRY(0x82, do_hw_divzero)
  385         TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
  386         BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
  387         NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
  388         BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
  389         LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
  390         BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
  391         BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
  392         BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
  393         BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
  394         INDIRECT_SOLARIS_SYSCALL(156) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
  395         BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
  396         BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
  397         BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
  398         BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
  399         BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
  400         BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
  401         BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
  402         BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
  403         BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
  404         BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
  405         BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
  406         BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
  407         BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
  408         BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
  409         BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
  410         BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
  411         BAD_TRAP(0xfc) BAD_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
  412 
  413 #endif
  414         .align PAGE_SIZE
  415 
  416 /* This was the only reasonable way I could think of to properly align
  417  * these page-table data structures.
  418  */
  419         .globl C_LABEL(pg0), C_LABEL(pg1), C_LABEL(pg2), C_LABEL(pg3)
  420         .globl C_LABEL(empty_bad_page)
  421         .globl C_LABEL(empty_bad_page_table)
  422         .globl C_LABEL(empty_zero_page)
  423         .globl C_LABEL(swapper_pg_dir)
  424 C_LABEL(swapper_pg_dir):                .skip PAGE_SIZE
  425 C_LABEL(pg0):                           .skip PAGE_SIZE
  426 C_LABEL(pg1):                           .skip PAGE_SIZE
  427 C_LABEL(pg2):                           .skip PAGE_SIZE
  428 C_LABEL(pg3):                           .skip PAGE_SIZE
  429 C_LABEL(empty_bad_page):                .skip PAGE_SIZE
  430 C_LABEL(empty_bad_page_table):          .skip PAGE_SIZE
  431 C_LABEL(empty_zero_page):               .skip PAGE_SIZE
  432 
  433         .global C_LABEL(root_flags)
  434         .global C_LABEL(ram_flags)
  435         .global C_LABEL(root_dev)
  436         .global C_LABEL(sparc_ramdisk_image)
  437         .global C_LABEL(sparc_ramdisk_size)
  438 
  439 /* This stuff has to be in sync with SILO and other potential boot loaders
  440  * Fields should be kept upward compatible and whenever any change is made,
  441  * HdrS version should be incremented.
  442  */
  443         .ascii  "HdrS"
  444         .word   LINUX_VERSION_CODE
  445         .half   0x0203          /* HdrS version */
  446 C_LABEL(root_flags):
  447         .half   1
  448 C_LABEL(root_dev):
  449         .half   0
  450 C_LABEL(ram_flags):
  451         .half   0
  452 C_LABEL(sparc_ramdisk_image):
  453         .word   0
  454 C_LABEL(sparc_ramdisk_size):
  455         .word   0
  456         .word   C_LABEL(reboot_command)
  457         .word   0, 0, 0
  458         .word   _end
  459 
  460 /* Cool, here we go. Pick up the romvec pointer in %o0 and stash it in
  461  * %g7 and at prom_vector_p. And also quickly check whether we are on
  462  * a v0, v2, or v3 prom.
  463  */
  464 gokernel:
  465                 /* Ok, it's nice to know, as early as possible, if we
  466                  * are already mapped where we expect to be in virtual
  467                  * memory.  The Solaris /boot elf format bootloader
  468                  * will peek into our elf header and load us where
  469                  * we want to be, otherwise we have to re-map.
  470                  *
  471                  * Some boot loaders don't place the jmp'rs address
  472                  * in %o7, so we do a pc-relative call to a local
  473                  * label, then see what %o7 has.
  474                  */
  475 
  476                 mov     %o7, %g4                ! Save %o7
  477 
  478                 /* Jump to it, and pray... */
  479 current_pc:
  480                 call    1f
  481                  nop
  482 
  483 1:
  484                 mov     %o7, %g3
  485 
  486                 tst     %o0
  487                 be      no_sun4u_here
  488                  mov    %g4, %o7                /* Previous %o7. */
  489         
  490                 mov     %o0, %l0                ! stash away romvec
  491                 mov     %o0, %g7                ! put it here too
  492                 mov     %o1, %l1                ! stash away debug_vec too
  493 
  494                 /* Ok, let's check out our run time program counter. */
  495                 set     current_pc, %g5
  496                 cmp     %g3, %g5
  497                 be      already_mapped
  498                  nop 
  499 
  500                 /* %l6 will hold the offset we have to subtract
  501                  * from absolute symbols in order to access areas
  502                  * in our own image.  If already mapped this is
  503                  * just plain zero, else it is KERNBASE.
  504                  */
  505                 set     KERNBASE, %l6
  506                 b       copy_prom_lvl14
  507                  nop
  508 
  509 already_mapped:
  510                 mov     0, %l6
  511 
  512                 /* Copy over the Prom's level 14 clock handler. */
  513 copy_prom_lvl14:
  514 #if 1
  515                 /* DJHR
  516                  * preserve our linked/calculated instructions
  517                  */
  518                 set     C_LABEL(lvl14_save), %g1
  519                 set     t_irq14, %g3
  520                 sub     %g1, %l6, %g1           ! translate to physical
  521                 sub     %g3, %l6, %g3           ! translate to physical
  522                 ldd     [%g3], %g4
  523                 std     %g4, [%g1]
  524                 ldd     [%g3+8], %g4
  525                 std     %g4, [%g1+8]
  526 #endif
  527                 rd      %tbr, %g1
  528                 andn    %g1, 0xfff, %g1         ! proms trap table base
  529                 or      %g0, (0x1e<<4), %g2     ! offset to lvl14 intr
  530                 or      %g1, %g2, %g2
  531                 set     t_irq14, %g3
  532                 sub     %g3, %l6, %g3
  533                 ldd     [%g2], %g4
  534                 std     %g4, [%g3]
  535                 ldd     [%g2 + 0x8], %g4
  536                 std     %g4, [%g3 + 0x8]        ! Copy proms handler
  537 
  538 /* Must determine whether we are on a sun4c MMU, SRMMU, or SUN4/400 MUTANT
  539  * MMU so we can remap ourselves properly.  DON'T TOUCH %l0 thru %l5 in these
  540  * remapping routines, we need their values afterwards!
  541  */
  542                 /* Now check whether we are already mapped, if we
  543                  * are we can skip all this garbage coming up.
  544                  */
  545 copy_prom_done:
  546                 cmp     %l6, 0
  547                 be      go_to_highmem           ! this will be a nop then
  548                  nop
  549 
  550                 set     LOAD_ADDR, %g6
  551                 cmp     %g7, %g6
  552                 bne     remap_not_a_sun4        ! This is not a Sun4
  553                  nop
  554 
  555                 or      %g0, 0x1, %g1
  556                 lduba   [%g1] ASI_CONTROL, %g1  ! Only safe to try on Sun4.
  557                 subcc   %g1, 0x24, %g0          ! Is this a mutant Sun4/400???
  558                 be      sun4_mutant_remap       ! Ugh, it is...
  559                  nop
  560 
  561                 b       sun4_normal_remap       ! regular sun4, 2 level mmu
  562                  nop
  563 
  564 remap_not_a_sun4:
  565                 lda     [%g0] ASI_M_MMUREGS, %g1 ! same as ASI_PTE on sun4c
  566                 and     %g1, 0x1, %g1           ! Test SRMMU Enable bit ;-)
  567                 cmp     %g1, 0x0
  568                 be      sun4c_remap             ! A sun4c MMU or normal Sun4
  569                  nop
  570 srmmu_remap:
  571                 /* First, check for a viking (TI) module. */
  572                 set     0x40000000, %g2
  573                 rd      %psr, %g3
  574                 and     %g2, %g3, %g3
  575                 subcc   %g3, 0x0, %g0
  576                 bz      srmmu_nviking
  577                  nop
  578 
  579                 /* Figure out what kind of viking we are on.
  580                  * We need to know if we have to play with the
  581                  * AC bit and disable traps or not.
  582                  */
  583 
  584                 /* I've only seen MicroSparc's on SparcClassics with this
  585                  * bit set.
  586                  */
  587                 set     0x800, %g2
  588                 lda     [%g0] ASI_M_MMUREGS, %g3        ! peek in the control reg
  589                 and     %g2, %g3, %g3
  590                 subcc   %g3, 0x0, %g0
  591                 bnz     srmmu_nviking                   ! is in mbus mode
  592                  nop
  593                 
  594                 rd      %psr, %g3                       ! DO NOT TOUCH %g3
  595                 andn    %g3, PSR_ET, %g2
  596                 wr      %g2, 0x0, %psr
  597                 WRITE_PAUSE
  598                 
  599                 /* Get context table pointer, then convert to
  600                  * a physical address, which is 36 bits.
  601                  */
  602                 set     AC_M_CTPR, %g4
  603                 lda     [%g4] ASI_M_MMUREGS, %g4
  604                 sll     %g4, 0x4, %g4                   ! We use this below
  605                                                         ! DO NOT TOUCH %g4
  606 
  607                 /* Set the AC bit in the Viking's MMU control reg. */
  608                 lda     [%g0] ASI_M_MMUREGS, %g5        ! DO NOT TOUCH %g5
  609                 set     0x8000, %g6                     ! AC bit mask
  610                 or      %g5, %g6, %g6                   ! Or it in...
  611                 sta     %g6, [%g0] ASI_M_MMUREGS        ! Close your eyes...
  612 
  613                 /* Grrr, why does it seem like every other load/store
  614                  * on the sun4m is in some ASI space...
  615                  * Fine with me, let's get the pointer to the level 1
  616                  * page table directory and fetch its entry.
  617                  */
  618                 lda     [%g4] ASI_M_BYPASS, %o1         ! This is a level 1 ptr
  619                 srl     %o1, 0x4, %o1                   ! Clear low 4 bits
  620                 sll     %o1, 0x8, %o1                   ! Make physical
  621                 
  622                 /* Ok, pull in the PTD. */
  623                 lda     [%o1] ASI_M_BYPASS, %o2         ! This is the 0x0 16MB pgd
  624 
  625                 /* Calculate to KERNBASE entry.
  626                  *
  627                  * XXX Should not use empirical constant, but Gas gets an  XXX
  628                  * XXX upset stomach with the bitshift I would have to use XXX
  629                  */
  630                 add     %o1, 0x3c0, %o3         
  631 
  632                 /* Poke the entry into the calculated address. */
  633                 sta     %o2, [%o3] ASI_M_BYPASS
  634 
  635                 /* I don't get it Sun, if you engineered all these
  636                  * boot loaders and the PROM (thank you for the debugging
  637                  * features btw) why did you not have them load kernel
  638                  * images up in high address space, since this is necessary
  639                  * for ABI compliance anyways?  Does this low-mapping provide
  640                  * enhanced interoperability?
  641                  *
  642                  * "The PROM is the computer."
  643                  */
  644 
  645                 /* Ok, restore the MMU control register we saved in %g5 */
  646                 sta     %g5, [%g0] ASI_M_MMUREGS        ! POW... ouch
  647 
  648                 /* Turn traps back on.  We saved it in %g3 earlier. */
  649                 wr      %g3, 0x0, %psr                  ! tick tock, tick tock
  650 
  651                 /* Now we burn precious CPU cycles due to bad engineering. */
  652                 WRITE_PAUSE
  653 
  654                 /* Wow, all that just to move a 32-bit value from one
  655                  * place to another...  Jump to high memory.
  656                  */
  657                 b       go_to_highmem
  658                  nop
  659 
  660                 /* This works on viking's in Mbus mode and all
  661                  * other MBUS modules.  It is virtually the same as
  662                  * the above madness sans turning traps off and flipping
  663                  * the AC bit.
  664                  */
  665 srmmu_nviking:
  666                 set     AC_M_CTPR, %g1
  667                 lda     [%g1] ASI_M_MMUREGS, %g1        ! get ctx table ptr
  668                 sll     %g1, 0x4, %g1                   ! make physical addr
  669                 lda     [%g1] ASI_M_BYPASS, %g1         ! ptr to level 1 pg_table
  670                 srl     %g1, 0x4, %g1
  671                 sll     %g1, 0x8, %g1                   ! make phys addr for l1 tbl
  672 
  673                 lda     [%g1] ASI_M_BYPASS, %g2         ! get level1 entry for 0x0
  674                 add     %g1, 0x3c0, %g3                 ! XXX AWAY WITH EMPIRICALS
  675                 sta     %g2, [%g3] ASI_M_BYPASS         ! place at KERNBASE entry
  676                 b       go_to_highmem
  677                  nop                                    ! wheee....
  678 
  679                 /* This remaps the kernel on Sun4/4xx machines
  680                  * that have the Sun Mutant Three Level MMU.
  681                  * It's like a platypus, Sun didn't have the
  682                  * SRMMU in conception so they kludged the three
  683                  * level logic in the regular Sun4 MMU probably.
  684                  *
  685                  * Basically, you take each entry in the top level
  686                  * directory that maps the low 3MB starting at
  687                  * address zero and put the mapping in the KERNBASE
  688                  * slots.  These top level pgd's are called regmaps.
  689                  */
  690 sun4_mutant_remap:
  691                 or      %g0, %g0, %g3           ! source base
  692                 sethi   %hi(KERNBASE), %g4      ! destination base
  693                 or      %g4, %lo(KERNBASE), %g4
  694                 sethi   %hi(0x300000), %g5
  695                 or      %g5, %lo(0x300000), %g5 ! upper bound 3MB
  696                 or      %g0, 0x1, %l6
  697                 sll     %l6, 24, %l6            ! Regmap mapping size
  698                 add     %g3, 0x2, %g3           ! Base magic
  699                 add     %g4, 0x2, %g4           ! Base magic
  700 
  701                 /* Main remapping loop on Sun4-Mutant-MMU.
  702                  * "I am not an animal..." -Famous Mutant Person
  703                  */
  704 sun4_mutant_loop:
  705                 lduha   [%g3] ASI_REGMAP, %g2   ! Get lower entry
  706                 stha    %g2, [%g4] ASI_REGMAP   ! Store in high entry
  707                 add     %g4, %l6, %g4           ! Move up high memory ptr
  708                 subcc   %g3, %g5, %g0           ! Reached our limit?
  709                 blu     sun4_mutant_loop        ! Nope, loop again
  710                  add    %g3, %l6, %g3           ! delay, Move up low ptr
  711                 b       go_to_highmem           ! Jump to high memory.
  712                  nop
  713 
  714                 /* The following is for non-4/4xx sun4 MMU's. */
  715 sun4_normal_remap:
  716                 mov     0, %g3                  ! source base
  717                 set     KERNBASE, %g4           ! destination base
  718                 set     0x300000, %g5           ! upper bound 3MB
  719                 mov     1, %l6
  720                 sll     %l6, 18, %l6            ! sun4 mmu segmap size
  721 sun4_normal_loop:
  722                 lduha   [%g3] ASI_SEGMAP, %g6   ! load phys_seg
  723                 stha    %g6, [%g4] ASI_SEGMAP   ! stort new virt mapping
  724                 add     %g3, %l6, %g3           ! increment source pointer
  725                 subcc   %g3, %g5, %g0           ! reached limit?
  726                 blu     sun4_normal_loop        ! nope, loop again
  727                  add    %g4, %l6, %g4           ! delay, increment dest ptr
  728                 b       go_to_highmem
  729                  nop
  730 
  731                 /* The following works for Sun4c MMU's */
  732 sun4c_remap:
  733                 mov     0, %g3                  ! source base
  734                 set     KERNBASE, %g4           ! destination base
  735                 set     0x300000, %g5           ! upper bound 3MB
  736                 mov     1, %l6
  737                 sll     %l6, 18, %l6            ! sun4c mmu segmap size
  738 sun4c_remap_loop:
  739                 lda     [%g3] ASI_SEGMAP, %g6   ! load phys_seg
  740                 sta     %g6, [%g4] ASI_SEGMAP   ! store new virt mapping
  741                 add     %g3, %l6, %g3           ! Increment source ptr
  742                 subcc   %g3, %g5, %g0           ! Reached limit?
  743                 bl      sun4c_remap_loop        ! Nope, loop again
  744                  add    %g4, %l6, %g4           ! delay, Increment dest ptr
  745 
  746 /* Now do a non-relative jump so that PC is in high-memory */
  747 go_to_highmem:
  748                 set     execute_in_high_mem, %g1
  749                 jmpl    %g1, %g0
  750                  nop
  751 
  752         /* This is to align init_task_union properly, be careful. -DaveM */
  753         .align  8192
  754 
  755 /* The code above should be at beginning and we have to take care about
  756  * short jumps, as branching to .text.init section from .text is usually
  757  * impossible */
  758                 __INIT
  759 /* Acquire boot time privileged register values, this will help debugging.
  760  * I figure out and store nwindows and nwindowsm1 later on.
  761  */
  762 execute_in_high_mem:
  763                 mov     %l0, %o0                ! put back romvec
  764                 mov     %l1, %o1                ! and debug_vec
  765 
  766                 sethi   %hi( C_LABEL(prom_vector_p) ), %g1
  767                 st      %o0, [%g1 + %lo( C_LABEL(prom_vector_p) )]
  768 
  769                 sethi   %hi( C_LABEL(linux_dbvec) ), %g1
  770                 st      %o1, [%g1 + %lo( C_LABEL(linux_dbvec) )]
  771 
  772                 ld      [%o0 + 0x4], %o3
  773                 and     %o3, 0x3, %o5                   ! get the version
  774 
  775                 cmp     %o3, 0x2                        ! a v2 prom?
  776                 be      found_version
  777                  nop
  778 
  779                 /* paul@sfe.com.au */
  780                 cmp     %o3, 0x3                        ! a v3 prom?
  781                 be      found_version
  782                  nop
  783 
  784 /* Old sun4's pass our load address into %o0 instead of the prom
  785  * pointer. On sun4's you have to hard code the romvec pointer into
  786  * your code. Sun probably still does that because they don't even
  787  * trust their own "OpenBoot" specifications.
  788  */
  789                 set     LOAD_ADDR, %g6
  790                 cmp     %o0, %g6                ! an old sun4?
  791                 be      sun4_init
  792                  nop
  793 
  794 found_version:
  795 #ifdef CONFIG_SUN4
  796 /* For people who try sun4 kernels, even if Configure.help advises them. */
  797                 ld      [%g7 + 0x68], %o1
  798                 set     sun4cdm_notsup, %o0
  799                 call    %o1
  800                  nop
  801                 b       halt_me
  802                  nop
  803 #endif
  804 /* Get the machine type via the mysterious romvec node operations. */
  805 
  806                 add     %g7, 0x1c, %l1          
  807                 ld      [%l1], %l0
  808                 ld      [%l0], %l0
  809                 call    %l0
  810                  or     %g0, %g0, %o0           ! next_node(0) = first_node
  811                 or      %o0, %g0, %g6
  812 
  813                 sethi   %hi( C_LABEL(cputypvar) ), %o1  ! First node has cpu-arch
  814                 or      %o1, %lo( C_LABEL(cputypvar) ), %o1
  815                 sethi   %hi( C_LABEL(cputypval) ), %o2  ! information, the string
  816                 or      %o2, %lo( C_LABEL(cputypval) ), %o2
  817                 ld      [%l1], %l0              ! 'compatibility' tells
  818                 ld      [%l0 + 0xc], %l0        ! that we want 'sun4x' where
  819                 call    %l0                     ! x is one of '', 'c', 'm',
  820                  nop                            ! 'd' or 'e'. %o2 holds pointer
  821                                                 ! to a buf where above string
  822                                                 ! will get stored by the prom.
  823 
  824                 subcc   %o0, %g0, %g0
  825                 bpos    got_prop                ! Got the property
  826                  nop
  827 
  828                 or      %g6, %g0, %o0
  829                 sethi   %hi( C_LABEL(cputypvar_sun4m) ), %o1
  830                 or      %o1, %lo( C_LABEL(cputypvar_sun4m) ), %o1
  831                 sethi   %hi( C_LABEL(cputypval) ), %o2
  832                 or      %o2, %lo( C_LABEL(cputypval) ), %o2
  833                 ld      [%l1], %l0
  834                 ld      [%l0 + 0xc], %l0
  835                 call    %l0
  836                  nop
  837 
  838 got_prop:
  839                 set     C_LABEL(cputypval), %o2
  840                 ldub    [%o2 + 0x4], %l1
  841 
  842                 cmp     %l1, ' '
  843                 be      1f
  844                  cmp    %l1, 'c'
  845                 be      1f
  846                  cmp    %l1, 'm'
  847                 be      1f
  848                  cmp    %l1, 's'
  849                 be      1f
  850                  cmp    %l1, 'd'
  851                 be      1f
  852                  cmp    %l1, 'e'
  853                 be      no_sun4e_here           ! Could be a sun4e.
  854                  nop
  855                 b       no_sun4u_here           ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
  856                  nop
  857 
  858 1:              set     C_LABEL(cputypval), %l1
  859                 ldub    [%l1 + 0x4], %l1
  860                 cmp     %l1, 'm'                ! Test for sun4d, sun4e ?
  861                 be      sun4m_init
  862                  cmp    %l1, 's'                ! Treat sun4s as sun4m
  863                 be      sun4m_init
  864                  cmp    %l1, 'd'                ! Let us see how the beast will die
  865                 be      sun4d_init
  866                  nop
  867 
  868                 /* Jump into mmu context zero. */
  869                 set     AC_CONTEXT, %g1
  870                 stba    %g0, [%g1] ASI_CONTROL
  871 
  872                 b       sun4c_continue_boot
  873                  nop
  874 
  875 /* CPUID in bootbus can be found at PA 0xff0140000 */
  876 #define SUN4D_BOOTBUS_CPUID     0xf0140000
  877 
  878 sun4d_init:
  879         /* Need to patch call to handler_irq */
  880         set     C_LABEL(patch_handler_irq), %g4
  881         set     C_LABEL(sun4d_handler_irq), %g5
  882         sethi   %hi(0x40000000), %g3            ! call
  883         sub     %g5, %g4, %g5
  884         srl     %g5, 2, %g5
  885         or      %g5, %g3, %g5
  886         st      %g5, [%g4]
  887 
  888 #ifdef CONFIG_SMP
  889         /* Get our CPU id out of bootbus */
  890         set     SUN4D_BOOTBUS_CPUID, %g3
  891         lduba   [%g3] ASI_M_CTL, %g3
  892         and     %g3, 0xf8, %g3
  893         srl     %g3, 3, %g4
  894         sta     %g4, [%g0] ASI_M_VIKING_TMP1
  895         sethi   %hi(boot_cpu_id), %g5
  896         stb     %g4, [%g5 + %lo(boot_cpu_id)]
  897         sll     %g4, 2, %g4
  898         sethi   %hi(boot_cpu_id4), %g5
  899         stb     %g4, [%g5 + %lo(boot_cpu_id4)]
  900 #endif
  901 
  902         /* Fall through to sun4m_init */
  903 
  904 sun4m_init:
  905         /* XXX Fucking Cypress... */
  906         lda     [%g0] ASI_M_MMUREGS, %g5
  907         srl     %g5, 28, %g4
  908 
  909         cmp     %g4, 1
  910         bne     1f
  911          srl    %g5, 24, %g4
  912 
  913         and     %g4, 0xf, %g4
  914         cmp     %g4, 7          /* This would be a HyperSparc. */
  915 
  916         bne     2f
  917          nop
  918 
  919 1:
  920 
  921 #define PATCH_IT(dst, src)      \
  922         set     (dst), %g5;     \
  923         set     (src), %g4;     \
  924         ld      [%g4], %g3;     \
  925         st      %g3, [%g5];     \
  926         ld      [%g4+0x4], %g3; \
  927         st      %g3, [%g5+0x4];
  928 
  929         /* Signed multiply. */
  930         PATCH_IT(.mul, .mul_patch)
  931         PATCH_IT(.mul+0x08, .mul_patch+0x08)
  932 
  933         /* Signed remainder. */
  934         PATCH_IT(.rem, .rem_patch)
  935         PATCH_IT(.rem+0x08, .rem_patch+0x08)
  936         PATCH_IT(.rem+0x10, .rem_patch+0x10)
  937         PATCH_IT(.rem+0x18, .rem_patch+0x18)
  938         PATCH_IT(.rem+0x20, .rem_patch+0x20)
  939         PATCH_IT(.rem+0x28, .rem_patch+0x28)
  940 
  941         /* Signed division. */
  942         PATCH_IT(.div, .div_patch)
  943         PATCH_IT(.div+0x08, .div_patch+0x08)
  944         PATCH_IT(.div+0x10, .div_patch+0x10)
  945         PATCH_IT(.div+0x18, .div_patch+0x18)
  946         PATCH_IT(.div+0x20, .div_patch+0x20)
  947 
  948         /* Unsigned multiply. */
  949         PATCH_IT(.umul, .umul_patch)
  950         PATCH_IT(.umul+0x08, .umul_patch+0x08)
  951 
  952         /* Unsigned remainder. */
  953         PATCH_IT(.urem, .urem_patch)
  954         PATCH_IT(.urem+0x08, .urem_patch+0x08)
  955         PATCH_IT(.urem+0x10, .urem_patch+0x10)
  956         PATCH_IT(.urem+0x18, .urem_patch+0x18)
  957 
  958         /* Unsigned division. */
  959         PATCH_IT(.udiv, .udiv_patch)
  960         PATCH_IT(.udiv+0x08, .udiv_patch+0x08)
  961         PATCH_IT(.udiv+0x10, .udiv_patch+0x10)
  962 
  963 #undef PATCH_IT
  964 
  965 /* Ok, the PROM could have done funny things and apple cider could still
  966  * be sitting in the fault status/address registers.  Read them all to
  967  * clear them so we don't get magic faults later on.
  968  */
  969 /* This sucks, apparently this makes Vikings call prom panic, will fix later */
  970 2:
  971                 rd      %psr, %o1
  972                 srl     %o1, 28, %o1            ! Get a type of the CPU
  973 
  974                 subcc   %o1, 4, %g0             ! TI: Viking or MicroSPARC
  975                 be      sun4c_continue_boot
  976                  nop
  977 
  978                 set     AC_M_SFSR, %o0
  979                 lda     [%o0] ASI_M_MMUREGS, %g0
  980                 set     AC_M_SFAR, %o0
  981                 lda     [%o0] ASI_M_MMUREGS, %g0
  982 
  983                 /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
  984                 subcc   %o1, 0, %g0
  985                 be      sun4c_continue_boot
  986                  nop
  987 
  988                 set     AC_M_AFSR, %o0
  989                 lda     [%o0] ASI_M_MMUREGS, %g0
  990                 set     AC_M_AFAR, %o0
  991                 lda     [%o0] ASI_M_MMUREGS, %g0
  992                  nop
  993 
  994 
  995 sun4c_continue_boot:
  996 
  997 
  998 /* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
  999  * show-time!
 1000  */
 1001 
 1002                 sethi   %hi( C_LABEL(cputyp) ), %o0
 1003                 st      %g4, [%o0 + %lo( C_LABEL(cputyp) )]
 1004 
 1005                 /* Turn on Supervisor, EnableFloating, and all the PIL bits.
 1006                  * Also puts us in register window zero with traps off.
 1007                  */
 1008                 set     (PSR_PS | PSR_S | PSR_PIL | PSR_EF), %g2
 1009                 wr      %g2, 0x0, %psr
 1010                 WRITE_PAUSE
 1011 
 1012                 /* I want a kernel stack NOW! */
 1013                 set     C_LABEL(init_task_union), %g1
 1014                 set     (TASK_UNION_SIZE - STACKFRAME_SZ), %g2
 1015                 add     %g1, %g2, %sp
 1016                 mov     0, %fp                  /* And for good luck */
 1017 
 1018                 /* Zero out our BSS section. */
 1019                 set     C_LABEL(__bss_start) , %o0      ! First address of BSS
 1020                 set     C_LABEL(end) , %o1              ! Last address of BSS
 1021                 add     %o0, 0x1, %o0
 1022 1:      
 1023                 stb     %g0, [%o0]
 1024                 subcc   %o0, %o1, %g0
 1025                 bl      1b
 1026                  add    %o0, 0x1, %o0
 1027 
 1028                 /* Initialize the umask value for init_task just in case.
 1029                  * But first make current_set[boot_cpu_id] point to something useful.
 1030                  */
 1031                 set     C_LABEL(init_task_union), %g6
 1032                 set     C_LABEL(current_set), %g2
 1033 #ifdef CONFIG_SMP
 1034                 sethi   %hi(C_LABEL(boot_cpu_id4)), %g3
 1035                 ldub    [%g3 + %lo(C_LABEL(boot_cpu_id4))], %g3
 1036                 st      %g6, [%g2]
 1037                 add     %g2, %g3, %g2
 1038 #endif
 1039                 st      %g6, [%g2]
 1040 
 1041                 st      %g0, [%g6 + AOFF_task_thread + AOFF_thread_uwinmask]
 1042 
 1043 /* Compute NWINDOWS and stash it away. Now uses %wim trick explained
 1044  * in the V8 manual. Ok, this method seems to work, Sparc is cool...
 1045  * No, it doesn't work, have to play the save/readCWP/restore trick.
 1046  */
 1047 
 1048                 wr      %g0, 0x0, %wim                  ! so we do not get a trap
 1049                 WRITE_PAUSE
 1050 
 1051                 save
 1052 
 1053                 rd      %psr, %g3
 1054 
 1055                 restore
 1056 
 1057                 and     %g3, 0x1f, %g3
 1058                 add     %g3, 0x1, %g3
 1059 
 1060                 mov     2, %g1
 1061                 wr      %g1, 0x0, %wim                  ! make window 1 invalid
 1062                 WRITE_PAUSE
 1063 
 1064                 cmp     %g3, 0x7
 1065                 bne     2f
 1066                  nop
 1067 
 1068                 /* Adjust our window handling routines to
 1069                  * do things correctly on 7 window Sparcs.
 1070                  */
 1071 
 1072 #define         PATCH_INSN(src, dest) \
 1073                 set     src, %g5; \
 1074                 set     dest, %g2; \
 1075                 ld      [%g5], %g4; \
 1076                 st      %g4, [%g2];
 1077         
 1078                 /* Patch for window spills... */
 1079                 PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
 1080                 PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
 1081                 PATCH_INSN(spnwin_patch3_7win, spnwin_patch3)
 1082 
 1083                 /* Patch for window fills... */
 1084                 PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
 1085                 PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
 1086 
 1087                 /* Patch for trap entry setup... */
 1088                 PATCH_INSN(tsetup_7win_patch1, tsetup_patch1)
 1089                 PATCH_INSN(tsetup_7win_patch2, tsetup_patch2)
 1090                 PATCH_INSN(tsetup_7win_patch3, tsetup_patch3)
 1091                 PATCH_INSN(tsetup_7win_patch4, tsetup_patch4)
 1092                 PATCH_INSN(tsetup_7win_patch5, tsetup_patch5)
 1093                 PATCH_INSN(tsetup_7win_patch6, tsetup_patch6)
 1094 
 1095                 /* Patch for returning from traps... */
 1096                 PATCH_INSN(rtrap_7win_patch1, rtrap_patch1)
 1097                 PATCH_INSN(rtrap_7win_patch2, rtrap_patch2)
 1098                 PATCH_INSN(rtrap_7win_patch3, rtrap_patch3)
 1099                 PATCH_INSN(rtrap_7win_patch4, rtrap_patch4)
 1100                 PATCH_INSN(rtrap_7win_patch5, rtrap_patch5)
 1101 
 1102                 /* Patch for killing user windows from the register file. */
 1103                 PATCH_INSN(kuw_patch1_7win, kuw_patch1)
 1104 
 1105                 /* Now patch the kernel window flush sequences.
 1106                  * This saves 2 traps on every switch and fork.
 1107                  */
 1108                 set     0x01000000, %g4
 1109                 set     flush_patch_one, %g5
 1110                 st      %g4, [%g5 + 0x18]
 1111                 st      %g4, [%g5 + 0x1c]
 1112                 set     flush_patch_two, %g5
 1113                 st      %g4, [%g5 + 0x18]
 1114                 st      %g4, [%g5 + 0x1c]
 1115                 set     flush_patch_three, %g5
 1116                 st      %g4, [%g5 + 0x18]
 1117                 st      %g4, [%g5 + 0x1c]
 1118                 set     flush_patch_four, %g5
 1119                 st      %g4, [%g5 + 0x18]
 1120                 st      %g4, [%g5 + 0x1c]
 1121                 set     flush_patch_exception, %g5
 1122                 st      %g4, [%g5 + 0x18]
 1123                 st      %g4, [%g5 + 0x1c]
 1124                 set     flush_patch_switch, %g5
 1125                 st      %g4, [%g5 + 0x18]
 1126                 st      %g4, [%g5 + 0x1c]
 1127 
 1128 2:              
 1129                 sethi   %hi( C_LABEL(nwindows) ), %g4
 1130                 st      %g3, [%g4 + %lo( C_LABEL(nwindows) )]   ! store final value
 1131                 sub     %g3, 0x1, %g3
 1132                 sethi   %hi( C_LABEL(nwindowsm1) ), %g4
 1133                 st      %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
 1134 
 1135                 /* Here we go, start using Linux's trap table... */
 1136                 set     C_LABEL(trapbase), %g3
 1137                 wr      %g3, 0x0, %tbr
 1138                 WRITE_PAUSE
 1139 
 1140                 /* Finally, turn on traps so that we can call c-code. */
 1141                 rd      %psr, %g3
 1142                 wr      %g3, 0x0, %psr
 1143                 WRITE_PAUSE
 1144 
 1145                 wr      %g3, PSR_ET, %psr
 1146                 WRITE_PAUSE
 1147 
 1148                 /* First we call prom_init() to set up PROMLIB, then
 1149                  * off to start_kernel().
 1150                  */
 1151 
 1152                 sethi   %hi( C_LABEL(prom_vector_p) ), %g5
 1153                 ld      [%g5 + %lo( C_LABEL(prom_vector_p) )], %o0
 1154                 call    C_LABEL(prom_init)
 1155                  nop
 1156 
 1157                 call    C_LABEL(start_kernel)
 1158                  nop
 1159         
 1160                 /* We should not get here. */
 1161                 call    halt_me
 1162                  nop
 1163 
 1164 sun4_init:
 1165 #ifdef CONFIG_SUN4
 1166 /* There, happy now Adrian? */
 1167                 set     C_LABEL(cputypval), %o2         ! Let everyone know we
 1168                 set     ' ', %o0                        ! are a "sun4 " architecture
 1169                 stb     %o0, [%o2 + 0x4]                
 1170 
 1171                 b got_prop 
 1172                  nop
 1173 #else
 1174                 sethi   %hi(SUN4_PROM_VECTOR+0x84), %o1
 1175                 ld      [%o1 + %lo(SUN4_PROM_VECTOR+0x84)], %o1
 1176                 set     sun4_notsup, %o0
 1177                 call    %o1     /* printf */
 1178                  nop
 1179                 sethi   %hi(SUN4_PROM_VECTOR+0xc4), %o1
 1180                 ld      [%o1 + %lo(SUN4_PROM_VECTOR+0xc4)], %o1
 1181                 call    %o1     /* exittomon */
 1182                  nop
 1183 1:              ba      1b                      ! Cannot exit into KMON
 1184                  nop
 1185 #endif
 1186 no_sun4e_here:
 1187                 ld      [%g7 + 0x68], %o1
 1188                 set     sun4e_notsup, %o0
 1189                 call    %o1
 1190                  nop
 1191                 b       halt_me
 1192                  nop
 1193 
 1194                 __INITDATA
 1195 
 1196 sun4u_1:
 1197                 .asciz "finddevice"
 1198                 .align  4
 1199 sun4u_2:
 1200                 .asciz "/chosen"
 1201                 .align  4
 1202 sun4u_3:
 1203                 .asciz "getprop"
 1204                 .align  4
 1205 sun4u_4:
 1206                 .asciz "stdout"
 1207                 .align  4
 1208 sun4u_5:
 1209                 .asciz "write"
 1210                 .align  4
 1211 sun4u_6:
 1212                 .asciz  "\n\rOn sun4u you have to use UltraLinux (64bit) kernel\n\rand not a 32bit sun4[cdem] version\n\r\n\r"
 1213 sun4u_6e:
 1214                 .align  4
 1215 sun4u_7:
 1216                 .asciz "exit"
 1217                 .align  8
 1218 sun4u_a1:
 1219                 .word   0, sun4u_1, 0, 1, 0, 1, 0, sun4u_2, 0
 1220 sun4u_r1:
 1221                 .word   0
 1222 sun4u_a2:
 1223                 .word   0, sun4u_3, 0, 4, 0, 1, 0
 1224 sun4u_i2:
 1225                 .word   0, 0, sun4u_4, 0, sun4u_1, 0, 8, 0
 1226 sun4u_r2:
 1227                 .word   0
 1228 sun4u_a3:
 1229                 .word   0, sun4u_5, 0, 3, 0, 1, 0
 1230 sun4u_i3:
 1231                 .word   0, 0, sun4u_6, 0, sun4u_6e - sun4u_6 - 1, 0
 1232 sun4u_r3:
 1233                 .word   0
 1234 sun4u_a4:
 1235                 .word   0, sun4u_7, 0, 0, 0, 0
 1236 sun4u_r4:
 1237 
 1238                 __INIT
 1239 no_sun4u_here:
 1240                 set     sun4u_a1, %o0
 1241                 set     current_pc, %l2
 1242                 cmp     %l2, %g3
 1243                 be      1f
 1244                  mov    %o4, %l0
 1245                 sub     %g3, %l2, %l6
 1246                 add     %o0, %l6, %o0
 1247                 mov     %o0, %l4
 1248                 mov     sun4u_r4 - sun4u_a1, %l3
 1249                 ld      [%l4], %l5
 1250 2:
 1251                 add     %l4, 4, %l4
 1252                 cmp     %l5, %l2
 1253                 add     %l5, %l6, %l5
 1254                 bgeu,a  3f
 1255                  st     %l5, [%l4 - 4]
 1256 3:
 1257                 subcc   %l3, 4, %l3
 1258                 bne     2b
 1259                  ld     [%l4], %l5
 1260 1:
 1261                 call    %l0
 1262                  mov    %o0, %l1
 1263 
 1264                 ld      [%l1 + (sun4u_r1 - sun4u_a1)], %o1
 1265                 add     %l1, (sun4u_a2 - sun4u_a1), %o0
 1266                 call    %l0
 1267                  st     %o1, [%o0 + (sun4u_i2 - sun4u_a2)]
 1268 
 1269                 ld      [%l1 + (sun4u_1 - sun4u_a1)], %o1
 1270                 add     %l1, (sun4u_a3 - sun4u_a1), %o0
 1271                 call    %l0
 1272                 st      %o1, [%o0 + (sun4u_i3 - sun4u_a3)]
 1273 
 1274                 call    %l0
 1275                  add    %l1, (sun4u_a4 - sun4u_a1), %o0
 1276 
 1277                 /* Not reached */
 1278 halt_me:
 1279                 ld      [%g7 + 0x74], %o0
 1280                 call    %o0                     ! Get us out of here...
 1281                  nop                            ! Apparently Solaris is better.
 1282 
 1283 /* Ok, now we continue in the .data/.text sections */
 1284 
 1285         .data
 1286         .align 4
 1287 
 1288 /*
 1289  * Fill up the prom vector, note in particular the kind first element,
 1290  * no joke. I don't need all of them in here as the entire prom vector
 1291  * gets initialized in c-code so all routines can use it.
 1292  */
 1293 
 1294         .globl  C_LABEL(prom_vector_p)
 1295 C_LABEL(prom_vector_p):
 1296                 .word 0
 1297 
 1298 /* We calculate the following at boot time, window fills/spills and trap entry
 1299  * code uses these to keep track of the register windows.
 1300  */
 1301 
 1302         .align 4
 1303         .globl  C_LABEL(nwindows)
 1304         .globl  C_LABEL(nwindowsm1)
 1305 C_LABEL(nwindows):
 1306         .word   8
 1307 C_LABEL(nwindowsm1):
 1308         .word   7
 1309 
 1310 /* Boot time debugger vector value.  We need this later on. */
 1311 
 1312         .align 4
 1313         .globl  C_LABEL(linux_dbvec)
 1314 C_LABEL(linux_dbvec):
 1315         .word   0
 1316         .word   0
 1317 
 1318         .align 8
 1319 
 1320         .globl  C_LABEL(lvl14_save)
 1321 C_LABEL(lvl14_save):
 1322         .word   0
 1323         .word   0
 1324         .word   0
 1325         .word   0
 1326         .word   t_irq14
 1327 
 1328         .section        ".fixup",#alloc,#execinstr
 1329         .globl  __ret_efault
 1330 __ret_efault:
 1331         ret
 1332          restore %g0, -EFAULT, %o0

Cache object: a68a36013e88743975b6c738bf4db6eb


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.