^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* arch/sparc/kernel/entry.S: Sparc trap low-level entry points.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 1996-1999 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/pgtable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/asi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/contregs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/asm-offsets.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/psr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/vaddrs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <asm/winmacro.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <asm/signal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <asm/obio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <asm/mxcc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <asm/thread_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <asm/param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <asm/unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include <asm/asmmacro.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include <asm/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define curptr g6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* These are just handy. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define _SV save %sp, -STACKFRAME_SZ, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define _RS restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define FLUSH_ALL_KERNEL_WINDOWS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) _SV; _SV; _SV; _SV; _SV; _SV; _SV; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) _RS; _RS; _RS; _RS; _RS; _RS; _RS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #ifdef CONFIG_KGDB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .globl arch_kgdb_breakpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) .type arch_kgdb_breakpoint,#function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) arch_kgdb_breakpoint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ta 0x7d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) .size arch_kgdb_breakpoint,.-arch_kgdb_breakpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .globl floppy_hardint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) floppy_hardint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * This code cannot touch registers %l0 %l1 and %l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * because SAVE_ALL depends on their values. It depends
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * on %l3 also, but we regenerate it before a call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * Other registers are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * %l3 -- base address of fdc registers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * %l4 -- pdma_vaddr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * %l5 -- scratch for ld/st address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * %l6 -- pdma_size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * %l7 -- scratch [floppy byte, ld/st address, aux. data]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* Do we have work to do? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) sethi %hi(doing_pdma), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) ld [%l7 + %lo(doing_pdma)], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) cmp %l7, 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) be floppy_dosoftint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* Load fdc register base */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) sethi %hi(fdc_status), %l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) ld [%l3 + %lo(fdc_status)], %l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /* Setup register addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) sethi %hi(pdma_vaddr), %l5 ! transfer buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) ld [%l5 + %lo(pdma_vaddr)], %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) sethi %hi(pdma_size), %l5 ! bytes to go
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ld [%l5 + %lo(pdma_size)], %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) next_byte:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) ldub [%l3], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) andcc %l7, 0x80, %g0 ! Does fifo still have data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) bz floppy_fifo_emptied ! fifo has been emptied...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) andcc %l7, 0x20, %g0 ! in non-dma mode still?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) bz floppy_overrun ! nope, overrun
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) andcc %l7, 0x40, %g0 ! 0=write 1=read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) bz floppy_write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) sub %l6, 0x1, %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* Ok, actually read this byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) ldub [%l3 + 1], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) orcc %g0, %l6, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) stb %l7, [%l4]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) bne next_byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) add %l4, 0x1, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) b floppy_tdone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) floppy_write:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* Ok, actually write this byte */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) ldub [%l4], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) orcc %g0, %l6, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) stb %l7, [%l3 + 1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) bne next_byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) add %l4, 0x1, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /* fall through... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) floppy_tdone:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) sethi %hi(pdma_vaddr), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) st %l4, [%l5 + %lo(pdma_vaddr)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) sethi %hi(pdma_size), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) st %l6, [%l5 + %lo(pdma_size)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /* Flip terminal count pin */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) set auxio_register, %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) ld [%l7], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) ldub [%l7], %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) or %l5, 0xc2, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) stb %l5, [%l7]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) andn %l5, 0x02, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /* Kill some time so the bits set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) stb %l5, [%l7]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* Prevent recursion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) sethi %hi(doing_pdma), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) b floppy_dosoftint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) st %g0, [%l7 + %lo(doing_pdma)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) /* We emptied the FIFO, but we haven't read everything
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * as of yet. Store the current transfer address and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * bytes left to read so we can continue when the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * fast IRQ comes in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) floppy_fifo_emptied:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) sethi %hi(pdma_vaddr), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) st %l4, [%l5 + %lo(pdma_vaddr)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) sethi %hi(pdma_size), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) st %l6, [%l7 + %lo(pdma_size)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* Restore condition codes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) wr %l0, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) jmp %l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) rett %l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) floppy_overrun:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) sethi %hi(pdma_vaddr), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) st %l4, [%l5 + %lo(pdma_vaddr)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) sethi %hi(pdma_size), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) st %l6, [%l5 + %lo(pdma_size)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /* Prevent recursion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) sethi %hi(doing_pdma), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) st %g0, [%l7 + %lo(doing_pdma)]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /* fall through... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) floppy_dosoftint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) rd %wim, %l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /* Set all IRQs off. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) mov 11, %o0 ! floppy irq level (unused anyway)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) mov %g0, %o1 ! devid is not used in fast interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) call sparc_floppy_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) add %sp, STACKFRAME_SZ, %o2 ! struct pt_regs *regs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #endif /* (CONFIG_BLK_DEV_FD) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /* Bad trap handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) .globl bad_trap_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) bad_trap_handler:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) add %sp, STACKFRAME_SZ, %o0 ! pt_regs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) call do_hw_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) mov %l7, %o1 ! trap number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /* For now all IRQ's not registered get sent here. handler_irq() will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * see if a routine is registered to handle this interrupt and if not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * it will say so on the console.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) .globl real_irq_entry, patch_handler_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) real_irq_entry:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) .globl patchme_maybe_smp_msg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) cmp %l7, 11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) patchme_maybe_smp_msg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) bgu maybe_smp4m_msg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) real_irq_continue:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) or %l0, PSR_PIL, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) wr %g2, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) wr %g2, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) mov %l7, %o0 ! irq level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) patch_handler_irq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) call handler_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) add %sp, STACKFRAME_SZ, %o1 ! pt_regs ptr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) or %l0, PSR_PIL, %g2 ! restore PIL after handler_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) wr %g2, PSR_ET, %psr ! keep ET up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) /* SMP per-cpu ticker interrupts are handled specially. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) smp4m_ticker:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) bne real_irq_continue+4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) or %l0, PSR_PIL, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) wr %g2, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) wr %g2, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) call smp4m_percpu_timer_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) #define GET_PROCESSOR4M_ID(reg) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) rd %tbr, %reg; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) srl %reg, 12, %reg; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) and %reg, 3, %reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) /* Here is where we check for possible SMP IPI passed to us
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * on some level other than 15 which is the NMI and only used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * for cross calls. That has a separate entry point below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * IPIs are sent on Level 12, 13 and 14. See IRQ_IPI_*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) maybe_smp4m_msg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) GET_PROCESSOR4M_ID(o3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) sethi %hi(sun4m_irq_percpu), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) sll %o3, 2, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) or %l5, %lo(sun4m_irq_percpu), %o5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) sethi %hi(0x70000000), %o2 ! Check all soft-IRQs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) ld [%o5 + %o3], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) ld [%o1 + 0x00], %o3 ! sun4m_irq_percpu[cpu]->pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) andcc %o3, %o2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) be,a smp4m_ticker
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) cmp %l7, 14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) /* Soft-IRQ IPI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) st %o2, [%o1 + 0x04] ! sun4m_irq_percpu[cpu]->clear=0x70000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) ld [%o1 + 0x00], %g0 ! sun4m_irq_percpu[cpu]->pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) srl %o3, 28, %o2 ! shift for simpler checks below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) maybe_smp4m_msg_check_single:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) andcc %o2, 0x1, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) beq,a maybe_smp4m_msg_check_mask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) andcc %o2, 0x2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) call smp_call_function_single_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) andcc %o2, 0x2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) maybe_smp4m_msg_check_mask:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) beq,a maybe_smp4m_msg_check_resched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) andcc %o2, 0x4, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) call smp_call_function_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) andcc %o2, 0x4, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) maybe_smp4m_msg_check_resched:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /* rescheduling is done in RESTORE_ALL regardless, but incr stats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) beq,a maybe_smp4m_msg_out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) call smp_resched_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) maybe_smp4m_msg_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) .globl linux_trap_ipi15_sun4m
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) linux_trap_ipi15_sun4m:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) sethi %hi(0x80000000), %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) GET_PROCESSOR4M_ID(o0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) sethi %hi(sun4m_irq_percpu), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) or %l5, %lo(sun4m_irq_percpu), %o5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) sll %o0, 2, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) ld [%o5 + %o0], %o5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) ld [%o5 + 0x00], %o3 ! sun4m_irq_percpu[cpu]->pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) andcc %o3, %o2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) be sun4m_nmi_error ! Must be an NMI async memory error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) st %o2, [%o5 + 0x04] ! sun4m_irq_percpu[cpu]->clear=0x80000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) ld [%o5 + 0x00], %g0 ! sun4m_irq_percpu[cpu]->pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) call smp4m_cross_call_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) b ret_trap_lockless_ipi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) clr %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) .globl smp4d_ticker
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) /* SMP per-cpu ticker interrupts are handled specially. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) smp4d_ticker:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) or %l0, PSR_PIL, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) sethi %hi(CC_ICLR), %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) sethi %hi(1 << 14), %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) or %o0, %lo(CC_ICLR), %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) stha %o1, [%o0] ASI_M_MXCC /* Clear PIL 14 in MXCC's ICLR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) wr %g2, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) wr %g2, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) call smp4d_percpu_timer_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) .globl linux_trap_ipi15_sun4d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) linux_trap_ipi15_sun4d:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) sethi %hi(CC_BASE), %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) sethi %hi(MXCC_ERR_ME|MXCC_ERR_PEW|MXCC_ERR_ASE|MXCC_ERR_PEE), %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) or %o4, (CC_EREG - CC_BASE), %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) ldda [%o0] ASI_M_MXCC, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) andcc %o0, %o2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) bne 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) sethi %hi(BB_STAT2), %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) lduba [%o2] ASI_M_CTL, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) andcc %o2, BB_STAT2_MASK, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) bne 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) or %o4, (CC_ICLR - CC_BASE), %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) sethi %hi(1 << 15), %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) stha %o1, [%o0] ASI_M_MXCC /* Clear PIL 15 in MXCC's ICLR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) call smp4d_cross_call_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) b ret_trap_lockless_ipi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) clr %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 1: /* MXCC error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 2: /* BB error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) /* Disable PIL 15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) set CC_IMSK, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) lduha [%l4] ASI_M_MXCC, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) sethi %hi(1 << 15), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) or %l5, %l7, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) stha %l5, [%l4] ASI_M_MXCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) /* FIXME */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 1: b,a 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) .globl smpleon_ipi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) .extern leon_ipi_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) /* SMP per-cpu IPI interrupts are handled specially. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) smpleon_ipi:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) or %l0, PSR_PIL, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) wr %g2, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) wr %g2, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) call leonsmp_ipi_interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) add %sp, STACKFRAME_SZ, %o1 ! pt_regs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) .globl linux_trap_ipi15_leon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) linux_trap_ipi15_leon:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) call leon_cross_call_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) b ret_trap_lockless_ipi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) clr %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) #endif /* CONFIG_SMP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) /* This routine handles illegal instructions and privileged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * instruction attempts from user code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) .globl bad_instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) bad_instruction:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) sethi %hi(0xc1f80000), %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) ld [%l1], %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) sethi %hi(0x81d80000), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) and %l5, %l4, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) cmp %l5, %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) be 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) call do_illegal_instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 1: /* unimplemented flush - just skip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) jmpl %l2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) rett %l2 + 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) .globl priv_instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) priv_instruction:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) call do_priv_instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) /* This routine handles unaligned data accesses. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) .globl mna_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) mna_handler:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) andcc %l0, PSR_PS, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) be mna_fromuser
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) ld [%l1], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) call kernel_unaligned_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) mna_fromuser:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) ld [%l1], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) call user_unaligned_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) /* This routine handles floating point disabled traps. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) .globl fpd_trap_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) fpd_trap_handler:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) call do_fpd_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) /* This routine handles Floating Point Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) .globl fpe_trap_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) fpe_trap_handler:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) set fpsave_magic, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) cmp %l1, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) be 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) sethi %hi(fpsave), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) or %l5, %lo(fpsave), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) cmp %l1, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) bne 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) sethi %hi(fpsave_catch2), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) or %l5, %lo(fpsave_catch2), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) wr %l0, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) jmp %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) rett %l5 + 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) sethi %hi(fpsave_catch), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) or %l5, %lo(fpsave_catch), %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) wr %l0, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) jmp %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) rett %l5 + 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) call do_fpe_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) /* This routine handles Tag Overflow Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) .globl do_tag_overflow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) do_tag_overflow:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) call handle_tag_overflow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) /* This routine handles Watchpoint Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) .globl do_watchpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) do_watchpoint:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) call handle_watchpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) /* This routine handles Register Access Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) .globl do_reg_access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) do_reg_access:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) call handle_reg_access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) /* This routine handles Co-Processor Disabled Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) .globl do_cp_disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) do_cp_disabled:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) call handle_cp_disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) /* This routine handles Co-Processor Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) .globl do_cp_exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) do_cp_exception:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) call handle_cp_exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) /* This routine handles Hardware Divide By Zero Exceptions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) .globl do_hw_divzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) do_hw_divzero:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) wr %l0, PSR_ET, %psr ! re-enable traps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) mov %l1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) mov %l2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) call handle_hw_divzero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) mov %l0, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) .globl do_flush_windows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) do_flush_windows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) andcc %l0, PSR_PS, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) bne dfw_kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) call flush_user_windows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) /* Advance over the trap instruction. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) ld [%sp + STACKFRAME_SZ + PT_NPC], %l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) add %l1, 0x4, %l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) st %l1, [%sp + STACKFRAME_SZ + PT_PC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) .globl flush_patch_one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) /* We get these for debugging routines using __builtin_return_address() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) dfw_kernel:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) flush_patch_one:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) FLUSH_ALL_KERNEL_WINDOWS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) /* Advance over the trap instruction. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) ld [%sp + STACKFRAME_SZ + PT_NPC], %l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) add %l1, 0x4, %l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) st %l1, [%sp + STACKFRAME_SZ + PT_PC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) /* The getcc software trap. The user wants the condition codes from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) * the %psr in register %g1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) .globl getcc_trap_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) getcc_trap_handler:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) srl %l0, 20, %g1 ! give user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) and %g1, 0xf, %g1 ! only ICC bits in %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) jmp %l2 ! advance over trap instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) rett %l2 + 0x4 ! like this...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) /* The setcc software trap. The user has condition codes in %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) * that it would like placed in the %psr. Be careful not to flip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) * any unintentional bits!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) .globl setcc_trap_handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) setcc_trap_handler:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) sll %g1, 0x14, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) set PSR_ICC, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) andn %l0, %l5, %l0 ! clear ICC bits in %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) and %l4, %l5, %l4 ! clear non-ICC bits in user value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) or %l4, %l0, %l4 ! or them in... mix mix mix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) wr %l4, 0x0, %psr ! set new %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) WRITE_PAUSE ! TI scumbags...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) jmp %l2 ! advance over trap instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) rett %l2 + 0x4 ! like this...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) sun4m_nmi_error:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) /* NMI async memory error handling. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) sethi %hi(0x80000000), %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) sethi %hi(sun4m_irq_global), %o5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) ld [%o5 + %lo(sun4m_irq_global)], %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) st %l4, [%l5 + 0x0c] ! sun4m_irq_global->mask_set=0x80000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) call sun4m_nmi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) st %l4, [%l5 + 0x08] ! sun4m_irq_global->mask_clear=0x80000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) .globl linux_trap_ipi15_sun4m
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) linux_trap_ipi15_sun4m:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) ba sun4m_nmi_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) #endif /* CONFIG_SMP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) .globl srmmu_fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) srmmu_fault:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) mov 0x400, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) mov 0x300, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) LEON_PI(lda [%l5] ASI_LEON_MMUREGS, %l6) ! read sfar first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) SUN_PI_(lda [%l5] ASI_M_MMUREGS, %l6) ! read sfar first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) LEON_PI(lda [%l4] ASI_LEON_MMUREGS, %l5) ! read sfsr last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) SUN_PI_(lda [%l4] ASI_M_MMUREGS, %l5) ! read sfsr last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) andn %l6, 0xfff, %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) srl %l5, 6, %l5 ! and encode all info into l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) and %l5, 2, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) or %l5, %l6, %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) or %l6, %l7, %l7 ! l7 = [addr,write,txtfault]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) mov %l7, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) mov %l7, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) and %o1, 1, %o1 ! arg2 = text_faultp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) mov %l7, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) and %o2, 2, %o2 ! arg3 = writep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) andn %o3, 0xfff, %o3 ! arg4 = faulting address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) call do_sparc_fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) add %sp, STACKFRAME_SZ, %o0 ! arg1 = pt_regs ptr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) sunos_execv:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) .globl sunos_execv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) b sys_execve
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) clr %i2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) .globl sys_sigstack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) sys_sigstack:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) mov %o7, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) mov %fp, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) call do_sys_sigstack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) mov %l5, %o7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) .globl sys_sigreturn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) sys_sigreturn:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) call do_sigreturn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) ld [%curptr + TI_FLAGS], %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) andcc %l5, _TIF_SYSCALL_TRACE, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) be 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) call syscall_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) mov 1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) /* We don't want to muck with user registers like a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) * normal syscall, just return.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) .globl sys_rt_sigreturn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) sys_rt_sigreturn:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) call do_rt_sigreturn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) ld [%curptr + TI_FLAGS], %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) andcc %l5, _TIF_SYSCALL_TRACE, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) be 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) call syscall_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) mov 1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) /* We are returning to a signal handler. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) /* Now that we have a real sys_clone, sys_fork() is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) * implemented in terms of it. Our _real_ implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) * of SunOS vfork() will use sys_vfork().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) * XXX These three should be consolidated into mostly shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) * XXX code just like on sparc64... -DaveM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) .globl sys_fork, flush_patch_two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) sys_fork:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) mov %o7, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) flush_patch_two:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) FLUSH_ALL_KERNEL_WINDOWS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) ld [%curptr + TI_TASK], %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) rd %psr, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) rd %wim, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) std %g4, [%o4 + AOFF_task_thread + AOFF_thread_fork_kpsr]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) call sparc_fork
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) mov %l5, %o7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) /* Whee, kernel threads! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) .globl sys_clone, flush_patch_three
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) sys_clone:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) mov %o7, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) flush_patch_three:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) FLUSH_ALL_KERNEL_WINDOWS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) ld [%curptr + TI_TASK], %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) rd %psr, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) rd %wim, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) std %g4, [%o4 + AOFF_task_thread + AOFF_thread_fork_kpsr]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) call sparc_clone
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) mov %l5, %o7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) /* Whee, real vfork! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) .globl sys_vfork, flush_patch_four
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) sys_vfork:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) flush_patch_four:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) FLUSH_ALL_KERNEL_WINDOWS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) ld [%curptr + TI_TASK], %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) rd %psr, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) rd %wim, %g5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) std %g4, [%o4 + AOFF_task_thread + AOFF_thread_fork_kpsr]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) sethi %hi(sparc_vfork), %l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) jmpl %l1 + %lo(sparc_vfork), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) linux_sparc_ni_syscall:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) sethi %hi(sys_ni_syscall), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) b do_syscall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) or %l7, %lo(sys_ni_syscall), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) linux_syscall_trace:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) call syscall_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) mov 0, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) cmp %o0, 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) bne 3f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) mov -ENOSYS, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) /* Syscall tracing can modify the registers. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) ld [%sp + STACKFRAME_SZ + PT_G1], %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) sethi %hi(sys_call_table), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) ld [%sp + STACKFRAME_SZ + PT_I0], %i0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) or %l7, %lo(sys_call_table), %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) ld [%sp + STACKFRAME_SZ + PT_I1], %i1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) ld [%sp + STACKFRAME_SZ + PT_I2], %i2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) ld [%sp + STACKFRAME_SZ + PT_I3], %i3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) ld [%sp + STACKFRAME_SZ + PT_I4], %i4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) ld [%sp + STACKFRAME_SZ + PT_I5], %i5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) cmp %g1, NR_syscalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) bgeu 3f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) mov -ENOSYS, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) sll %g1, 2, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) mov %i0, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) ld [%l7 + %l4], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) mov %i1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) mov %i2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) mov %i3, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) b 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) mov %i4, %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) .globl ret_from_fork
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) ret_from_fork:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) call schedule_tail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) ld [%g3 + TI_TASK], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) b ret_sys_call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) ld [%sp + STACKFRAME_SZ + PT_I0], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) .globl ret_from_kernel_thread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) ret_from_kernel_thread:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) call schedule_tail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957) ld [%g3 + TI_TASK], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) ld [%sp + STACKFRAME_SZ + PT_G1], %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) call %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960) ld [%sp + STACKFRAME_SZ + PT_G2], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) rd %psr, %l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962) ld [%sp + STACKFRAME_SZ + PT_PSR], %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) andn %l0, PSR_CWP, %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965) and %l1, PSR_CWP, %l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) or %l0, %l1, %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) st %l0, [%sp + STACKFRAME_SZ + PT_PSR]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) b ret_sys_call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969) mov 0, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) /* Linux native system calls enter here... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) .globl linux_sparc_syscall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974) linux_sparc_syscall:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) sethi %hi(PSR_SYSCALL), %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976) or %l0, %l4, %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) /* Direct access to user regs, must faster. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) cmp %g1, NR_syscalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979) bgeu linux_sparc_ni_syscall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980) sll %g1, 2, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) ld [%l7 + %l4], %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983) do_syscall:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984) SAVE_ALL_HEAD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) rd %wim, %l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988) mov %i0, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) mov %i1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) mov %i2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) ld [%curptr + TI_FLAGS], %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) mov %i3, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994) andcc %l5, _TIF_SYSCALL_TRACE, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) mov %i4, %o4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996) bne linux_syscall_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) mov %i0, %l5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998) 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999) call %l7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) mov %i5, %o5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) st %o0, [%sp + STACKFRAME_SZ + PT_I0]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) ret_sys_call:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) ld [%curptr + TI_FLAGS], %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) cmp %o0, -ERESTART_RESTARTBLOCK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) set PSR_C, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) bgeu 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) andcc %l6, _TIF_SYSCALL_TRACE, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) /* System call success, clear Carry condition code. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) andn %g3, %g2, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) clr %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) bne linux_syscall_trace2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) add %l1, 0x4, %l2 /* npc = npc+4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) st %l1, [%sp + STACKFRAME_SZ + PT_PC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) b ret_trap_entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) /* System call failure, set Carry condition code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) * Also, get abs(errno) to return to the process.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) sub %g0, %o0, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) or %g3, %g2, %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) st %o0, [%sp + STACKFRAME_SZ + PT_I0]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) mov 1, %l6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) bne linux_syscall_trace2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) add %l1, 0x4, %l2 /* npc = npc+4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) st %l1, [%sp + STACKFRAME_SZ + PT_PC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) b ret_trap_entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) linux_syscall_trace2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) mov 1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) call syscall_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) add %l1, 0x4, %l2 /* npc = npc+4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) st %l1, [%sp + STACKFRAME_SZ + PT_PC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) b ret_trap_entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) /* Saving and restoring the FPU state is best done from lowlevel code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) * void fpsave(unsigned long *fpregs, unsigned long *fsr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) * void *fpqueue, unsigned long *fpqdepth)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) .globl fpsave
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) fpsave:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) st %fsr, [%o1] ! this can trap on us if fpu is in bogon state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) ld [%o1], %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) set 0x2000, %g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) andcc %g1, %g4, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) be 2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) mov 0, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) /* We have an fpqueue to save. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) std %fq, [%o2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) fpsave_magic:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) st %fsr, [%o1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) ld [%o1], %g3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) andcc %g3, %g4, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) add %g2, 1, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) bne 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) add %o2, 8, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) st %g2, [%o3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) std %f0, [%o0 + 0x00]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) std %f2, [%o0 + 0x08]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) std %f4, [%o0 + 0x10]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) std %f6, [%o0 + 0x18]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) std %f8, [%o0 + 0x20]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) std %f10, [%o0 + 0x28]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) std %f12, [%o0 + 0x30]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) std %f14, [%o0 + 0x38]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) std %f16, [%o0 + 0x40]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) std %f18, [%o0 + 0x48]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) std %f20, [%o0 + 0x50]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) std %f22, [%o0 + 0x58]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) std %f24, [%o0 + 0x60]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) std %f26, [%o0 + 0x68]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) std %f28, [%o0 + 0x70]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) std %f30, [%o0 + 0x78]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) /* Thanks for Theo Deraadt and the authors of the Sprite/netbsd/openbsd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) * code for pointing out this possible deadlock, while we save state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) * above we could trap on the fsr store so our low level fpu trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) * code has to know how to deal with this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) fpsave_catch:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) b fpsave_magic + 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) st %fsr, [%o1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) fpsave_catch2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) b fpsave + 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) st %fsr, [%o1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) /* void fpload(unsigned long *fpregs, unsigned long *fsr); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) .globl fpload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) fpload:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) ldd [%o0 + 0x00], %f0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) ldd [%o0 + 0x08], %f2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) ldd [%o0 + 0x10], %f4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) ldd [%o0 + 0x18], %f6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) ldd [%o0 + 0x20], %f8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) ldd [%o0 + 0x28], %f10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) ldd [%o0 + 0x30], %f12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) ldd [%o0 + 0x38], %f14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) ldd [%o0 + 0x40], %f16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) ldd [%o0 + 0x48], %f18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) ldd [%o0 + 0x50], %f20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) ldd [%o0 + 0x58], %f22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) ldd [%o0 + 0x60], %f24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) ldd [%o0 + 0x68], %f26
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) ldd [%o0 + 0x70], %f28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) ldd [%o0 + 0x78], %f30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) ld [%o1], %fsr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) /* __ndelay and __udelay take two arguments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) * 0 - nsecs or usecs to delay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) * 1 - per_cpu udelay_val (loops per jiffy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) * Note that ndelay gives HZ times higher resolution but has a 10ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) * limit. udelay can handle up to 1s.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) .globl __ndelay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) __ndelay:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) save %sp, -STACKFRAME_SZ, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) mov %i0, %o0 ! round multiplier up so large ns ok
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) mov 0x1ae, %o1 ! 2**32 / (1 000 000 000 / HZ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) umul %o0, %o1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) rd %y, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) mov %i1, %o1 ! udelay_val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) umul %o0, %o1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) rd %y, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) ba delay_continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) mov %o1, %o0 ! >>32 later for better resolution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) .globl __udelay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) __udelay:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) save %sp, -STACKFRAME_SZ, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) mov %i0, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) sethi %hi(0x10c7), %o1 ! round multiplier up so large us ok
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) or %o1, %lo(0x10c7), %o1 ! 2**32 / 1 000 000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) umul %o0, %o1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) rd %y, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) mov %i1, %o1 ! udelay_val
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) umul %o0, %o1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) rd %y, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) sethi %hi(0x028f4b62), %l0 ! Add in rounding constant * 2**32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) or %g0, %lo(0x028f4b62), %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) addcc %o0, %l0, %o0 ! 2**32 * 0.009 999
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) bcs,a 3f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) add %o1, 0x01, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) mov HZ, %o0 ! >>32 earlier for wider range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) umul %o0, %o1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) rd %y, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) delay_continue:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) cmp %o0, 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) bne 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) subcc %o0, 1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) EXPORT_SYMBOL(__udelay)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) EXPORT_SYMBOL(__ndelay)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) /* Handle a software breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) /* We have to inform parent that child has stopped */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) .globl breakpoint_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) breakpoint_trap:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) rd %wim,%l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) st %i0, [%sp + STACKFRAME_SZ + PT_G0] ! for restarting syscalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) call sparc_breakpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) add %sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) #ifdef CONFIG_KGDB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) ENTRY(kgdb_trap_low)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) rd %wim,%l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) wr %l0, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) mov %l7, %o0 ! trap_level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) call kgdb_trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) add %sp, STACKFRAME_SZ, %o1 ! struct pt_regs *regs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) ENDPROC(kgdb_trap_low)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) .globl flush_patch_exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) flush_patch_exception:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) FLUSH_ALL_KERNEL_WINDOWS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) ldd [%o0], %o6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) jmpl %o7 + 0xc, %g0 ! see asm-sparc/processor.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) mov 1, %g1 ! signal EFAULT condition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) .globl kill_user_windows, kuw_patch1_7win
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) .globl kuw_patch1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) kuw_patch1_7win: sll %o3, 6, %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) /* No matter how much overhead this routine has in the worst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) * case scenario, it is several times better than taking the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) * traps with the old method of just doing flush_user_windows().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) kill_user_windows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) ld [%g6 + TI_UWINMASK], %o0 ! get current umask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) orcc %g0, %o0, %g0 ! if no bits set, we are done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) be 3f ! nothing to do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) rd %psr, %o5 ! must clear interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) or %o5, PSR_PIL, %o4 ! or else that could change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) wr %o4, 0x0, %psr ! the uwinmask state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) WRITE_PAUSE ! burn them cycles
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) ld [%g6 + TI_UWINMASK], %o0 ! get consistent state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) orcc %g0, %o0, %g0 ! did an interrupt come in?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) be 4f ! yep, we are done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) rd %wim, %o3 ! get current wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) srl %o3, 1, %o4 ! simulate a save
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) kuw_patch1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) sll %o3, 7, %o3 ! compute next wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) or %o4, %o3, %o3 ! result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) andncc %o0, %o3, %o0 ! clean this bit in umask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) bne kuw_patch1 ! not done yet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) srl %o3, 1, %o4 ! begin another save simulation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) wr %o3, 0x0, %wim ! set the new wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) st %g0, [%g6 + TI_UWINMASK] ! clear uwinmask
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) wr %o5, 0x0, %psr ! re-enable interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) WRITE_PAUSE ! burn baby burn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) retl ! return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) st %g0, [%g6 + TI_W_SAVED] ! no windows saved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) .globl restore_current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) restore_current:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) LOAD_CURRENT(g6, o0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) #ifdef CONFIG_PCIC_PCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270) #include <asm/pcic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) .globl linux_trap_ipi15_pcic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) linux_trap_ipi15_pcic:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) rd %wim, %l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) SAVE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) * First deactivate NMI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) * or we cannot drop ET, cannot get window spill traps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) * The busy loop is necessary because the PIO error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) * sometimes does not go away quickly and we trap again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) sethi %hi(pcic_regs), %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) ld [%o1 + %lo(pcic_regs)], %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) ! Get pending status for printouts later.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) ld [%o2 + PCI_SYS_INT_PENDING], %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) mov PCI_SYS_INT_PENDING_CLEAR_ALL, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) stb %o1, [%o2 + PCI_SYS_INT_PENDING_CLEAR]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) ld [%o2 + PCI_SYS_INT_PENDING], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) andcc %o1, ((PCI_SYS_INT_PENDING_PIO|PCI_SYS_INT_PENDING_PCI)>>24), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) bne 1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) or %l0, PSR_PIL, %l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299) wr %l4, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301) wr %l4, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) call pcic_nmi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) add %sp, STACKFRAME_SZ, %o1 ! struct pt_regs *regs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) RESTORE_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) .globl pcic_nmi_trap_patch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) pcic_nmi_trap_patch:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) sethi %hi(linux_trap_ipi15_pcic), %l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) jmpl %l3 + %lo(linux_trap_ipi15_pcic), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) rd %psr, %l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) .word 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315) #endif /* CONFIG_PCIC_PCI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) .globl flushw_all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) flushw_all:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) save %sp, -0x40, %sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) restore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) ENTRY(hard_smp_processor_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) 661: rd %tbr, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) srl %g1, 12, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) and %o0, 3, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) .section .cpuid_patch, "ax"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) /* Instruction location. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) .word 661b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) /* SUN4D implementation. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) lda [%g0] ASI_M_VIKING_TMP1, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) /* LEON implementation. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) rd %asr17, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) srl %o0, 0x1c, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) .previous
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) retl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) ENDPROC(hard_smp_processor_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) /* End of entry.S */