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