1 /* $Id: entry.S,v 1.144 2002/02/09 19:49:30 davem Exp $
2 * arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points.
4 * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
10 #include <linux/config.h>
11 #include <linux/errno.h>
16 #include <asm/ptrace.h>
18 #include <asm/signal.h>
19 #include <asm/pgtable.h>
20 #include <asm/processor.h>
21 #include <asm/visasm.h>
22 #include <asm/estate.h>
23 #include <asm/auxio.h>
24 #include <asm/sfafsr.h>
28 #define NR_SYSCALLS 284 /* Each OS is different... */
33 .globl sparc64_vpte_patchme1
34 .globl sparc64_vpte_patchme2
36 * On a second level vpte miss, check whether the original fault is to the OBP
37 * range (note that this is only possible for instruction miss, data misses to
38 * obp range do not use vpte). If so, go back directly to the faulting address.
39 * This is because we want to read the tpc, otherwise we have no way of knowing
40 * the 8k aligned faulting address if we are using >8k kernel pagesize. This
41 * also ensures no vpte range addresses are dropped into tlb while obp is
42 * executing (see inherit_locked_prom_mappings() rant).
45 /* Note that kvmap below has verified that the address is
46 * in the range MODULES_VADDR --> VMALLOC_END already. So
47 * here we need only check if it is an OBP address or not.
49 sethi %hi(LOW_OBP_ADDRESS), %g5
51 blu,pn %xcc, sparc64_vpte_patchme1
55 blu,pn %xcc, obp_iaddr_patch
58 /* These two instructions are patched by paginig_init(). */
59 sparc64_vpte_patchme1:
61 sparc64_vpte_patchme2:
64 /* With kernel PGD in %g5, branch back into dtlb_backend. */
65 ba,pt %xcc, sparc64_kpte_continue
66 andn %g1, 0x3, %g1 /* Finish PMD offset adjustment. */
69 /* Restore previous TAG_ACCESS, %g5 is zero, and we will
70 * skip over the trap instruction so that the top level
71 * TLB miss handler will thing this %g5 value is just an
72 * invalid PTE, thus branching to full fault processing.
75 stxa %g4, [%g1 + %g1] ASI_DMMU
78 .globl obp_iaddr_patch
80 /* These two instructions patched by inherit_prom_mappings(). */
84 /* Behave as if we are at TL0. */
86 rdpr %tpc, %g4 /* Find original faulting iaddr */
87 srlx %g4, 13, %g4 /* Throw out context bits */
88 sllx %g4, 13, %g4 /* g4 has vpn + ctx0 now */
90 /* Restore previous TAG_ACCESS. */
92 stxa %g4, [%g1 + %g1] ASI_IMMU
99 /* Load PMD, is it valid? */
100 lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5
104 /* Get PTE offset. */
110 ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5
111 brgez,pn %g5, longpath
114 /* TLB load and return from trap. */
115 stxa %g5, [%g0] ASI_ITLB_DATA_IN
118 .globl obp_daddr_patch
120 /* These two instructions patched by inherit_prom_mappings(). */
124 /* Get PMD offset. */
129 /* Load PMD, is it valid? */
130 lduwa [%g5 + %g6] ASI_PHYS_USE_EC, %g5
134 /* Get PTE offset. */
140 ldxa [%g5 + %g6] ASI_PHYS_USE_EC, %g5
141 brgez,pn %g5, longpath
144 /* TLB load and return from trap. */
145 stxa %g5, [%g0] ASI_DTLB_DATA_IN
149 * On a first level data miss, check whether this is to the OBP range (note
150 * that such accesses can be made by prom, as well as by kernel using
151 * prom_getproperty on "address"), and if so, do not use vpte access ...
152 * rather, use information saved during inherit_prom_mappings() using 8k
157 sethi %hi(MODULES_VADDR), %g5
159 blu,pn %xcc, longpath
160 mov (VMALLOC_END >> 24), %g5
163 bgeu,pn %xcc, longpath
167 sethi %hi(LOW_OBP_ADDRESS), %g5
169 blu,pn %xcc, kvmap_vmalloc_addr
173 blu,pn %xcc, obp_daddr_patch
177 /* If we get here, a vmalloc addr was accessed, load kernel VPTE. */
178 ldxa [%g3 + %g6] ASI_N, %g5
179 brgez,pn %g5, longpath
182 /* PTE is valid, load into TLB and return from trap. */
183 stxa %g5, [%g0] ASI_DTLB_DATA_IN ! Reload TLB
186 /* This is trivial with the new code... */
189 sethi %hi(TSTATE_PEF), %g4 ! IEU0
195 andcc %g5, FPRS_FEF, %g0
199 /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */
202 109: or %g7, %lo(109b), %g7
204 ba,a,pt %xcc, rtrap_clr_l6
206 1: ldub [%g6 + TI_FPSAVED], %g5 ! Load Group
207 wr %g0, FPRS_FEF, %fprs ! LSU Group+4bubbles
208 andcc %g5, FPRS_FEF, %g0 ! IEU1 Group
209 be,a,pt %icc, 1f ! CTI
211 ldx [%g6 + TI_GSR], %g7 ! Load Group
212 1: andcc %g5, FPRS_DL, %g0 ! IEU1
213 bne,pn %icc, 2f ! CTI
215 andcc %g5, FPRS_DU, %g0 ! IEU1 Group
216 bne,pn %icc, 1f ! CTI
246 b,pt %xcc, fpdis_exit2
248 1: mov SECONDARY_CONTEXT, %g3
249 add %g6, TI_FPREGS + 0x80, %g1
252 ldxa [%g3] ASI_DMMU, %g5
255 stxa %g2, [%g3] ASI_DMMU
257 add %g6, TI_FPREGS + 0xc0, %g2
260 ldda [%g1] ASI_BLK_S, %f32 ! grrr, where is ASI_BLK_NUCLEUS 8-(
261 ldda [%g2] ASI_BLK_S, %f48
273 b,pt %xcc, fpdis_exit
275 2: andcc %g5, FPRS_DU, %g0
278 mov SECONDARY_CONTEXT, %g3
280 ldxa [%g3] ASI_DMMU, %g5
281 add %g6, TI_FPREGS, %g1
284 stxa %g2, [%g3] ASI_DMMU
286 add %g6, TI_FPREGS + 0x40, %g2
287 faddd %f32, %f34, %f36
288 fmuld %f32, %f34, %f38
289 ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-(
290 ldda [%g2] ASI_BLK_S, %f16
291 faddd %f32, %f34, %f40
292 fmuld %f32, %f34, %f42
293 faddd %f32, %f34, %f44
294 fmuld %f32, %f34, %f46
295 faddd %f32, %f34, %f48
296 fmuld %f32, %f34, %f50
297 faddd %f32, %f34, %f52
298 fmuld %f32, %f34, %f54
299 faddd %f32, %f34, %f56
300 fmuld %f32, %f34, %f58
301 faddd %f32, %f34, %f60
302 fmuld %f32, %f34, %f62
304 ba,pt %xcc, fpdis_exit
306 3: mov SECONDARY_CONTEXT, %g3
307 add %g6, TI_FPREGS, %g1
308 ldxa [%g3] ASI_DMMU, %g5
311 stxa %g2, [%g3] ASI_DMMU
314 ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-(
315 ldda [%g1 + %g2] ASI_BLK_S, %f16
317 ldda [%g1] ASI_BLK_S, %f32
318 ldda [%g1 + %g2] ASI_BLK_S, %f48
321 stxa %g5, [%g3] ASI_DMMU
325 ldx [%g6 + TI_XFSR], %fsr
327 or %g3, %g4, %g3 ! anal...
329 wr %g0, FPRS_FEF, %fprs ! clean DU/DL bits
335 add %sp, PTREGS_OFF, %o0
339 .globl do_fpother_check_fitos
341 do_fpother_check_fitos:
342 sethi %hi(fp_other_bounce - 4), %g7
343 or %g7, %lo(fp_other_bounce - 4), %g7
345 /* NOTE: Need to preserve %g7 until we fully commit
346 * to the fitos fixup.
348 stx %fsr, [%g6 + TI_XFSR]
350 andcc %g3, TSTATE_PRIV, %g0
351 bne,pn %xcc, do_fptrap_after_fsr
353 ldx [%g6 + TI_XFSR], %g3
356 cmp %g1, 2 ! Unfinished FP-OP
357 bne,pn %xcc, do_fptrap_after_fsr
358 sethi %hi(1 << 23), %g1 ! Inexact
360 bne,pn %xcc, do_fptrap_after_fsr
362 lduwa [%g1] ASI_AIUP, %g3 ! This cannot ever fail
363 #define FITOS_MASK 0xc1f83fe0
364 #define FITOS_COMPARE 0x81a01880
365 sethi %hi(FITOS_MASK), %g1
366 or %g1, %lo(FITOS_MASK), %g1
368 sethi %hi(FITOS_COMPARE), %g2
369 or %g2, %lo(FITOS_COMPARE), %g2
371 bne,pn %xcc, do_fptrap_after_fsr
373 std %f62, [%g6 + TI_FPREGS + (62 * 4)]
374 sethi %hi(fitos_table_1), %g1
376 or %g1, %lo(fitos_table_1), %g1
379 ba,pt %xcc, fitos_emul_continue
416 sethi %hi(fitos_table_2), %g1
418 or %g1, %lo(fitos_table_2), %g1
422 ba,pt %xcc, fitos_emul_fini
459 ldd [%g6 + TI_FPREGS + (62 * 4)], %f62
465 stx %fsr, [%g6 + TI_XFSR]
467 ldub [%g6 + TI_FPSAVED], %g3
470 stb %g3, [%g6 + TI_FPSAVED]
472 stx %g3, [%g6 + TI_GSR]
473 mov SECONDARY_CONTEXT, %g3
474 ldxa [%g3] ASI_DMMU, %g5
477 stxa %g2, [%g3] ASI_DMMU
479 add %g6, TI_FPREGS, %g2
480 andcc %g1, FPRS_DL, %g0
483 stda %f0, [%g2] ASI_BLK_S
484 stda %f16, [%g2 + %g3] ASI_BLK_S
485 andcc %g1, FPRS_DU, %g0
488 stda %f32, [%g2] ASI_BLK_S
489 stda %f48, [%g2 + %g3] ASI_BLK_S
490 5: mov SECONDARY_CONTEXT, %g1
492 stxa %g5, [%g1] ASI_DMMU
498 sethi %hi(CTX_CHEETAH_PLUS_CTX0), %g2
500 .globl cheetah_plus_patch_fpdis
501 cheetah_plus_patch_fpdis:
502 /* We configure the dTLB512_0 for 4MB pages and the
503 * dTLB512_1 for 8K pages when in context zero.
505 sethi %hi(cplus_fptrap_1), %o0
506 lduw [%o0 + %lo(cplus_fptrap_1)], %o1
508 set cplus_fptrap_insn_1, %o2
511 set cplus_fptrap_insn_2, %o2
514 set cplus_fptrap_insn_3, %o2
517 set cplus_fptrap_insn_4, %o2
524 /* The registers for cross calls will be:
526 * DATA 0: [low 32-bits] Address of function to call, jmp to this
527 * [high 32-bits] MMU Context Argument 0, place in %g5
528 * DATA 1: Address Argument 1, place in %g6
529 * DATA 2: Address Argument 2, place in %g7
531 * With this method we can do most of the cross-call tlb/cache
532 * flushing very quickly.
534 * Current CPU's IRQ worklist table is locked into %g1,
542 ldxa [%g3 + %g0] ASI_INTR_R, %g3
543 sethi %hi(KERNBASE), %g4
545 bgeu,pn %xcc, do_ivec_xcall
547 stxa %g0, [%g0] ASI_INTR_RECEIVE
550 sethi %hi(ivector_table), %g2
552 or %g2, %lo(ivector_table), %g2
554 ldub [%g3 + 0x04], %g4 /* pil */
559 lduw [%g6 + %g4], %g5 /* g5 = irq_work(cpu, pil) */
560 stw %g5, [%g3 + 0x00] /* bucket->irq_chain = g5 */
561 stw %g3, [%g6 + %g4] /* irq_work(cpu, pil) = bucket */
562 wr %g2, 0x0, %set_softint
566 ldxa [%g1 + %g0] ASI_INTR_R, %g1
570 ldxa [%g7 + %g0] ASI_INTR_R, %g7
571 stxa %g0, [%g0] ASI_INTR_RECEIVE
580 .globl save_alternate_globals
581 save_alternate_globals: /* %o0 = save_area */
583 andn %o5, PSTATE_IE, %o1
584 wrpr %o1, PSTATE_AG, %pstate
585 stx %g0, [%o0 + 0x00]
586 stx %g1, [%o0 + 0x08]
587 stx %g2, [%o0 + 0x10]
588 stx %g3, [%o0 + 0x18]
589 stx %g4, [%o0 + 0x20]
590 stx %g5, [%o0 + 0x28]
591 stx %g6, [%o0 + 0x30]
592 stx %g7, [%o0 + 0x38]
593 wrpr %o1, PSTATE_IG, %pstate
594 stx %g0, [%o0 + 0x40]
595 stx %g1, [%o0 + 0x48]
596 stx %g2, [%o0 + 0x50]
597 stx %g3, [%o0 + 0x58]
598 stx %g4, [%o0 + 0x60]
599 stx %g5, [%o0 + 0x68]
600 stx %g6, [%o0 + 0x70]
601 stx %g7, [%o0 + 0x78]
602 wrpr %o1, PSTATE_MG, %pstate
603 stx %g0, [%o0 + 0x80]
604 stx %g1, [%o0 + 0x88]
605 stx %g2, [%o0 + 0x90]
606 stx %g3, [%o0 + 0x98]
607 stx %g4, [%o0 + 0xa0]
608 stx %g5, [%o0 + 0xa8]
609 stx %g6, [%o0 + 0xb0]
610 stx %g7, [%o0 + 0xb8]
611 wrpr %o5, 0x0, %pstate
615 .globl restore_alternate_globals
616 restore_alternate_globals: /* %o0 = save_area */
618 andn %o5, PSTATE_IE, %o1
619 wrpr %o1, PSTATE_AG, %pstate
620 ldx [%o0 + 0x00], %g0
621 ldx [%o0 + 0x08], %g1
622 ldx [%o0 + 0x10], %g2
623 ldx [%o0 + 0x18], %g3
624 ldx [%o0 + 0x20], %g4
625 ldx [%o0 + 0x28], %g5
626 ldx [%o0 + 0x30], %g6
627 ldx [%o0 + 0x38], %g7
628 wrpr %o1, PSTATE_IG, %pstate
629 ldx [%o0 + 0x40], %g0
630 ldx [%o0 + 0x48], %g1
631 ldx [%o0 + 0x50], %g2
632 ldx [%o0 + 0x58], %g3
633 ldx [%o0 + 0x60], %g4
634 ldx [%o0 + 0x68], %g5
635 ldx [%o0 + 0x70], %g6
636 ldx [%o0 + 0x78], %g7
637 wrpr %o1, PSTATE_MG, %pstate
638 ldx [%o0 + 0x80], %g0
639 ldx [%o0 + 0x88], %g1
640 ldx [%o0 + 0x90], %g2
641 ldx [%o0 + 0x98], %g3
642 ldx [%o0 + 0xa0], %g4
643 ldx [%o0 + 0xa8], %g5
644 ldx [%o0 + 0xb0], %g6
645 ldx [%o0 + 0xb8], %g7
646 wrpr %o5, 0x0, %pstate
652 ldx [%o0 + PT_V9_TSTATE], %o1
656 stx %o1, [%o0 + PT_V9_G1]
658 ldx [%o0 + PT_V9_TSTATE], %o1
659 ldx [%o0 + PT_V9_G1], %o2
660 or %g0, %ulo(TSTATE_ICC), %o3
667 stx %o1, [%o0 + PT_V9_TSTATE]
669 .globl utrap, utrap_ill
670 utrap: brz,pn %g1, etrap
675 andn %l6, TSTATE_CWP, %l6
676 wrpr %l6, %l7, %tstate
683 add %sp, PTREGS_OFF, %o0
687 /* XXX Here is stuff we still need to write... -DaveM XXX */
688 .globl netbsd_syscall
693 /* We need to carefully read the error status, ACK
694 * the errors, prevent recursive traps, and pass the
695 * information on to C code for logging.
697 * We pass the AFAR in as-is, and we encode the status
698 * information as described in asm-sparc64/sfafsr.h
700 .globl __spitfire_access_error
701 __spitfire_access_error:
702 /* Disable ESTATE error reporting so that we do not
703 * take recursive traps and RED state the processor.
705 stxa %g0, [%g0] ASI_ESTATE_ERROR_EN
709 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
711 /* __spitfire_cee_trap branches here with AFSR in %g4 and
712 * UDBE_CE in %g1. It only clears ESTATE_ERR_CE in the
713 * ESTATE Error Enable register.
715 __spitfire_cee_trap_continue:
716 ldxa [%g0] ASI_AFAR, %g5 ! Get AFAR
719 and %g3, 0x1ff, %g3 ! Paranoia
720 sllx %g3, SFSTAT_TRAP_TYPE_SHIFT, %g3
726 sllx %g3, SFSTAT_TL_GT_ONE_SHIFT, %g3
730 /* Read in the UDB error register state, clearing the
731 * sticky error bits as-needed. We only clear them if
732 * the UE bit is set. Likewise, __spitfire_cee_trap
733 * below will only do so if the CE bit is set.
735 * NOTE: UltraSparc-I/II have high and low UDB error
736 * registers, corresponding to the two UDB units
737 * present on those chips. UltraSparc-IIi only
738 * has a single UDB, called "SDB" in the manual.
739 * For IIi the upper UDB register always reads
740 * as zero so for our purposes things will just
741 * work with the checks below.
743 1: ldxa [%g0] ASI_UDBH_ERROR_R, %g3
744 and %g3, 0x3ff, %g7 ! Paranoia
745 sllx %g7, SFSTAT_UDBH_SHIFT, %g7
747 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
750 stxa %g3, [%g0] ASI_UDB_ERROR_W
754 ldxa [%g3] ASI_UDBL_ERROR_R, %g3
755 and %g3, 0x3ff, %g7 ! Paranoia
756 sllx %g7, SFSTAT_UDBL_SHIFT, %g7
758 andcc %g3, %g1, %g3 ! UDBE_UE or UDBE_CE
762 stxa %g3, [%g7] ASI_UDB_ERROR_W
765 1: /* Ok, now that we've latched the error state,
766 * clear the sticky bits in the AFSR.
768 stxa %g4, [%g0] ASI_AFSR
783 1: ba,pt %xcc, etrap_irq
788 call spitfire_access_error
789 add %sp, PTREGS_OFF, %o0
793 /* This is the trap handler entry point for ECC correctable
794 * errors. They are corrected, but we listen for the trap
795 * so that the event can be logged.
797 * Disrupting errors are either:
798 * 1) single-bit ECC errors during UDB reads to system
800 * 2) data parity errors during write-back events
802 * As far as I can make out from the manual, the CEE trap
803 * is only for correctable errors during memory read
804 * accesses by the front-end of the processor.
806 * The code below is only for trap level 1 CEE events,
807 * as it is the only situation where we can safely record
808 * and log. For trap level >1 we just clear the CE bit
809 * in the AFSR and return.
811 * This is just like __spiftire_access_error above, but it
812 * specifically handles correctable errors. If an
813 * uncorrectable error is indicated in the AFSR we
814 * will branch directly above to __spitfire_access_error
815 * to handle it instead. Uncorrectable therefore takes
816 * priority over correctable, and the error logging
817 * C code will notice this case by inspecting the
820 .globl __spitfire_cee_trap
822 ldxa [%g0] ASI_AFSR, %g4 ! Get AFSR
824 sllx %g3, SFAFSR_UE_SHIFT, %g3
825 andcc %g4, %g3, %g0 ! Check for UE
826 bne,pn %xcc, __spitfire_access_error
829 /* Ok, in this case we only have a correctable error.
830 * Indicate we only wish to capture that state in register
831 * %g1, and we only disable CE error reporting unlike UE
832 * handling which disables all errors.
834 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g3
835 andn %g3, ESTATE_ERR_CE, %g3
836 stxa %g3, [%g0] ASI_ESTATE_ERROR_EN
839 /* Preserve AFSR in %g4, indicate UDB state to capture in %g1 */
840 ba,pt %xcc, __spitfire_cee_trap_continue
843 .globl __spitfire_data_access_exception
844 .globl __spitfire_data_access_exception_tl1
845 __spitfire_data_access_exception_tl1:
847 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
850 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
851 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
852 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
855 cmp %g3, 0x80 ! first win spill/fill trap
857 cmp %g3, 0xff ! last win spill/fill trap
860 ba,pt %xcc, winfix_dax
862 1: sethi %hi(109f), %g7
864 109: or %g7, %lo(109b), %g7
867 call spitfire_data_access_exception_tl1
868 add %sp, PTREGS_OFF, %o0
872 __spitfire_data_access_exception:
874 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
877 ldxa [%g3] ASI_DMMU, %g4 ! Get SFSR
878 ldxa [%g5] ASI_DMMU, %g5 ! Get SFAR
879 stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit
883 109: or %g7, %lo(109b), %g7
886 call spitfire_data_access_exception
887 add %sp, PTREGS_OFF, %o0
891 .globl __spitfire_insn_access_exception
892 .globl __spitfire_insn_access_exception_tl1
893 __spitfire_insn_access_exception_tl1:
895 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
897 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
898 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
899 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
903 109: or %g7, %lo(109b), %g7
906 call spitfire_insn_access_exception_tl1
907 add %sp, PTREGS_OFF, %o0
911 __spitfire_insn_access_exception:
913 wrpr %g4, PSTATE_MG|PSTATE_AG, %pstate
915 ldxa [%g3] ASI_IMMU, %g4 ! Get SFSR
916 rdpr %tpc, %g5 ! IMMU has no SFAR, use TPC
917 stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit
921 109: or %g7, %lo(109b), %g7
924 call spitfire_insn_access_exception
925 add %sp, PTREGS_OFF, %o0
929 /* These get patched into the trap table at boot time
930 * once we know we have a cheetah processor.
932 .globl cheetah_fecc_trap_vector, cheetah_fecc_trap_vector_tl1
933 cheetah_fecc_trap_vector:
935 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
936 andn %g1, DCU_DC | DCU_IC, %g1
937 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
939 sethi %hi(cheetah_fast_ecc), %g2
940 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
942 cheetah_fecc_trap_vector_tl1:
944 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
945 andn %g1, DCU_DC | DCU_IC, %g1
946 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
948 sethi %hi(cheetah_fast_ecc), %g2
949 jmpl %g2 + %lo(cheetah_fast_ecc), %g0
951 .globl cheetah_cee_trap_vector, cheetah_cee_trap_vector_tl1
952 cheetah_cee_trap_vector:
954 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
955 andn %g1, DCU_IC, %g1
956 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
958 sethi %hi(cheetah_cee), %g2
959 jmpl %g2 + %lo(cheetah_cee), %g0
961 cheetah_cee_trap_vector_tl1:
963 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
964 andn %g1, DCU_IC, %g1
965 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
967 sethi %hi(cheetah_cee), %g2
968 jmpl %g2 + %lo(cheetah_cee), %g0
970 .globl cheetah_deferred_trap_vector, cheetah_deferred_trap_vector_tl1
971 cheetah_deferred_trap_vector:
973 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
974 andn %g1, DCU_DC | DCU_IC, %g1;
975 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
977 sethi %hi(cheetah_deferred_trap), %g2
978 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
980 cheetah_deferred_trap_vector_tl1:
982 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1;
983 andn %g1, DCU_DC | DCU_IC, %g1;
984 stxa %g1, [%g0] ASI_DCU_CONTROL_REG;
986 sethi %hi(cheetah_deferred_trap), %g2
987 jmpl %g2 + %lo(cheetah_deferred_trap), %g0
990 /* Cheetah+ specific traps. These are for the new I/D cache parity
991 * error traps. The first argument to cheetah_plus_parity_handler
992 * is encoded as follows:
994 * Bit0: 0=dcache,1=icache
995 * Bit1: 0=recoverable,1=unrecoverable
997 .globl cheetah_plus_dcpe_trap_vector, cheetah_plus_dcpe_trap_vector_tl1
998 cheetah_plus_dcpe_trap_vector:
1000 sethi %hi(do_cheetah_plus_data_parity), %g7
1001 jmpl %g7 + %lo(do_cheetah_plus_data_parity), %g0
1008 do_cheetah_plus_data_parity:
1012 call cheetah_plus_parity_error
1013 add %sp, PTREGS_OFF, %o1
1017 cheetah_plus_dcpe_trap_vector_tl1:
1019 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
1020 sethi %hi(do_dcpe_tl1), %g3
1021 jmpl %g3 + %lo(do_dcpe_tl1), %g0
1027 .globl cheetah_plus_icpe_trap_vector, cheetah_plus_icpe_trap_vector_tl1
1028 cheetah_plus_icpe_trap_vector:
1030 sethi %hi(do_cheetah_plus_insn_parity), %g7
1031 jmpl %g7 + %lo(do_cheetah_plus_insn_parity), %g0
1038 do_cheetah_plus_insn_parity:
1042 call cheetah_plus_parity_error
1043 add %sp, PTREGS_OFF, %o1
1047 cheetah_plus_icpe_trap_vector_tl1:
1049 wrpr PSTATE_IG | PSTATE_PEF | PSTATE_PRIV, %pstate
1050 sethi %hi(do_icpe_tl1), %g3
1051 jmpl %g3 + %lo(do_icpe_tl1), %g0
1057 /* If we take one of these traps when tl >= 1, then we
1058 * jump to interrupt globals. If some trap level above us
1059 * was also using interrupt globals, we cannot recover.
1060 * We may use all interrupt global registers except %g6.
1062 .globl do_dcpe_tl1, do_icpe_tl1
1064 rdpr %tl, %g1 ! Save original trap level
1065 mov 1, %g2 ! Setup TSTATE checking loop
1066 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
1067 1: wrpr %g2, %tl ! Set trap level to check
1068 rdpr %tstate, %g4 ! Read TSTATE for this level
1069 andcc %g4, %g3, %g0 ! Interrupt globals in use?
1070 bne,a,pn %xcc, do_dcpe_tl1_fatal ! Yep, irrecoverable
1071 wrpr %g1, %tl ! Restore original trap level
1072 add %g2, 1, %g2 ! Next trap level
1073 cmp %g2, %g1 ! Hit them all yet?
1074 ble,pt %icc, 1b ! Not yet
1076 wrpr %g1, %tl ! Restore original trap level
1077 do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
1078 /* Reset D-cache parity */
1079 sethi %hi(1 << 16), %g1 ! D-cache size
1080 mov (1 << 5), %g2 ! D-cache line size
1081 sub %g1, %g2, %g1 ! Move down 1 cacheline
1082 1: srl %g1, 14, %g3 ! Compute UTAG
1084 stxa %g3, [%g1] ASI_DCACHE_UTAG
1086 sub %g2, 8, %g3 ! 64-bit data word within line
1088 stxa %g0, [%g1 + %g3] ASI_DCACHE_DATA
1090 subcc %g3, 8, %g3 ! Next 64-bit data word
1093 subcc %g1, %g2, %g1 ! Next cacheline
1096 ba,pt %xcc, dcpe_icpe_tl1_common
1101 ba,pt %xcc, etraptl1
1102 1: or %g7, %lo(1b), %g7
1104 call cheetah_plus_parity_error
1105 add %sp, PTREGS_OFF, %o1
1110 rdpr %tl, %g1 ! Save original trap level
1111 mov 1, %g2 ! Setup TSTATE checking loop
1112 sethi %hi(TSTATE_IG), %g3 ! TSTATE mask bit
1113 1: wrpr %g2, %tl ! Set trap level to check
1114 rdpr %tstate, %g4 ! Read TSTATE for this level
1115 andcc %g4, %g3, %g0 ! Interrupt globals in use?
1116 bne,a,pn %xcc, do_icpe_tl1_fatal ! Yep, irrecoverable
1117 wrpr %g1, %tl ! Restore original trap level
1118 add %g2, 1, %g2 ! Next trap level
1119 cmp %g2, %g1 ! Hit them all yet?
1120 ble,pt %icc, 1b ! Not yet
1122 wrpr %g1, %tl ! Restore original trap level
1123 do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
1125 sethi %hi(1 << 15), %g1 ! I-cache size
1126 mov (1 << 5), %g2 ! I-cache line size
1128 1: or %g1, (2 << 3), %g3
1129 stxa %g0, [%g3] ASI_IC_TAG
1134 ba,pt %xcc, dcpe_icpe_tl1_common
1139 ba,pt %xcc, etraptl1
1140 1: or %g7, %lo(1b), %g7
1142 call cheetah_plus_parity_error
1143 add %sp, PTREGS_OFF, %o1
1147 dcpe_icpe_tl1_common:
1148 /* Flush D-cache, re-enable D/I caches in DCU and finally
1149 * retry the trapping instruction.
1151 sethi %hi(1 << 16), %g1 ! D-cache size
1152 mov (1 << 5), %g2 ! D-cache line size
1154 1: stxa %g0, [%g1] ASI_DCACHE_TAG
1159 ldxa [%g0] ASI_DCU_CONTROL_REG, %g1
1160 or %g1, (DCU_DC | DCU_IC), %g1
1161 stxa %g1, [%g0] ASI_DCU_CONTROL_REG
1165 /* Capture I/D/E-cache state into per-cpu error scoreboard.
1167 * %g1: (TL>=0) ? 1 : 0
1172 * %g6: current thread ptr
1175 __cheetah_log_error:
1176 /* Put "TL1" software bit into AFSR. */
1181 /* Get log entry pointer for this cpu at this trap level. */
1182 BRANCH_IF_JALAPENO(g2,g3,50f)
1183 ldxa [%g0] ASI_SAFARI_CONFIG, %g2
1188 50: ldxa [%g0] ASI_JBUS_CONFIG, %g2
1192 60: sllx %g2, 9, %g2
1193 sethi %hi(cheetah_error_log), %g3
1194 ldx [%g3 + %lo(cheetah_error_log)], %g3
1202 /* %g1 holds pointer to the top of the logging scoreboard */
1203 ldx [%g1 + 0x0], %g7
1208 stx %g4, [%g1 + 0x0]
1209 stx %g5, [%g1 + 0x8]
1212 /* %g1 now points to D-cache logging area */
1213 set 0x3ff8, %g2 /* DC_addr mask */
1214 and %g5, %g2, %g2 /* DC_addr bits of AFAR */
1216 or %g3, 1, %g3 /* PHYS tag + valid */
1218 10: ldxa [%g2] ASI_DCACHE_TAG, %g7
1219 cmp %g3, %g7 /* TAG match? */
1223 /* Yep, what we want, capture state. */
1224 stx %g2, [%g1 + 0x20]
1225 stx %g7, [%g1 + 0x28]
1227 /* A membar Sync is required before and after utag access. */
1229 ldxa [%g2] ASI_DCACHE_UTAG, %g7
1231 stx %g7, [%g1 + 0x30]
1232 ldxa [%g2] ASI_DCACHE_SNOOP_TAG, %g7
1233 stx %g7, [%g1 + 0x38]
1236 12: ldxa [%g2 + %g3] ASI_DCACHE_DATA, %g7
1238 add %g3, (1 << 5), %g3
1246 13: sethi %hi(1 << 14), %g7
1255 /* %g1 now points to I-cache logging area */
1256 20: set 0x1fe0, %g2 /* IC_addr mask */
1257 and %g5, %g2, %g2 /* IC_addr bits of AFAR */
1258 sllx %g2, 1, %g2 /* IC_addr[13:6]==VA[12:5] */
1259 srlx %g5, (13 - 8), %g3 /* Make PTAG */
1260 andn %g3, 0xff, %g3 /* Mask off undefined bits */
1262 21: ldxa [%g2] ASI_IC_TAG, %g7
1268 /* Yep, what we want, capture state. */
1269 stx %g2, [%g1 + 0x40]
1270 stx %g7, [%g1 + 0x48]
1271 add %g2, (1 << 3), %g2
1272 ldxa [%g2] ASI_IC_TAG, %g7
1273 add %g2, (1 << 3), %g2
1274 stx %g7, [%g1 + 0x50]
1275 ldxa [%g2] ASI_IC_TAG, %g7
1276 add %g2, (1 << 3), %g2
1277 stx %g7, [%g1 + 0x60]
1278 ldxa [%g2] ASI_IC_TAG, %g7
1279 stx %g7, [%g1 + 0x68]
1280 sub %g2, (3 << 3), %g2
1281 ldxa [%g2] ASI_IC_STAG, %g7
1282 stx %g7, [%g1 + 0x58]
1286 22: ldxa [%g2 + %g3] ASI_IC_INSTR, %g7
1288 add %g3, (1 << 3), %g3
1296 23: sethi %hi(1 << 14), %g7
1305 /* %g1 now points to E-cache logging area */
1306 30: andn %g5, (32 - 1), %g2
1307 stx %g2, [%g1 + 0x20]
1308 ldxa [%g2] ASI_EC_TAG_DATA, %g7
1309 stx %g7, [%g1 + 0x28]
1310 ldxa [%g2] ASI_EC_R, %g0
1313 31: ldxa [%g3] ASI_EC_DATA, %g7
1314 stx %g7, [%g1 + %g3]
1327 ba,pt %xcc, c_deferred
1329 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
1330 * in the trap table. That code has done a memory barrier
1331 * and has disabled both the I-cache and D-cache in the DCU
1332 * control register. The I-cache is disabled so that we may
1333 * capture the corrupted cache line, and the D-cache is disabled
1334 * because corrupt data may have been placed there and we don't
1335 * want to reference it.
1337 * %g1 is one if this trap occurred at %tl >= 1.
1339 * Next, we turn off error reporting so that we don't recurse.
1341 .globl cheetah_fast_ecc
1343 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1344 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
1345 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1348 /* Fetch and clear AFSR/AFAR */
1349 ldxa [%g0] ASI_AFSR, %g4
1350 ldxa [%g0] ASI_AFAR, %g5
1351 stxa %g4, [%g0] ASI_AFSR
1354 ba,pt %xcc, __cheetah_log_error
1360 ba,pt %xcc, etrap_irq
1364 call cheetah_fecc_handler
1365 add %sp, PTREGS_OFF, %o0
1366 ba,a,pt %xcc, rtrap_irq
1368 /* Our caller has disabled I-cache and performed membar Sync. */
1371 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1372 andn %g2, ESTATE_ERROR_CEEN, %g2
1373 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1376 /* Fetch and clear AFSR/AFAR */
1377 ldxa [%g0] ASI_AFSR, %g4
1378 ldxa [%g0] ASI_AFAR, %g5
1379 stxa %g4, [%g0] ASI_AFSR
1382 ba,pt %xcc, __cheetah_log_error
1388 ba,pt %xcc, etrap_irq
1392 call cheetah_cee_handler
1393 add %sp, PTREGS_OFF, %o0
1394 ba,a,pt %xcc, rtrap_irq
1396 /* Our caller has disabled I-cache+D-cache and performed membar Sync. */
1397 .globl cheetah_deferred_trap
1398 cheetah_deferred_trap:
1399 ldxa [%g0] ASI_ESTATE_ERROR_EN, %g2
1400 andn %g2, ESTATE_ERROR_NCEEN | ESTATE_ERROR_CEEN, %g2
1401 stxa %g2, [%g0] ASI_ESTATE_ERROR_EN
1404 /* Fetch and clear AFSR/AFAR */
1405 ldxa [%g0] ASI_AFSR, %g4
1406 ldxa [%g0] ASI_AFAR, %g5
1407 stxa %g4, [%g0] ASI_AFSR
1410 ba,pt %xcc, __cheetah_log_error
1416 ba,pt %xcc, etrap_irq
1420 call cheetah_deferred_handler
1421 add %sp, PTREGS_OFF, %o0
1422 ba,a,pt %xcc, rtrap_irq
1427 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
1429 sethi %hi(109f), %g7
1431 109: or %g7, %lo(109b), %g7
1433 add %sp, PTREGS_OFF, %o0
1442 /* Setup %g4/%g5 now as they are used in the
1447 ldxa [%g4] ASI_DMMU, %g4
1448 ldxa [%g3] ASI_DMMU, %g5
1449 stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit
1451 bgu,pn %icc, winfix_mna
1454 1: sethi %hi(109f), %g7
1456 109: or %g7, %lo(109b), %g7
1459 call mem_address_unaligned
1460 add %sp, PTREGS_OFF, %o0
1466 sethi %hi(109f), %g7
1468 ldxa [%g4] ASI_DMMU, %g5
1469 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
1472 ldxa [%g4] ASI_DMMU, %g4
1474 109: or %g7, %lo(109b), %g7
1478 add %sp, PTREGS_OFF, %o0
1484 sethi %hi(109f), %g7
1486 ldxa [%g4] ASI_DMMU, %g5
1487 stxa %g0, [%g4] ASI_DMMU ! Clear FaultValid bit
1490 ldxa [%g4] ASI_DMMU, %g4
1492 109: or %g7, %lo(109b), %g7
1496 add %sp, PTREGS_OFF, %o0
1500 .globl breakpoint_trap
1502 call sparc_breakpoint
1503 add %sp, PTREGS_OFF, %o0
1507 #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
1508 defined(CONFIG_SOLARIS_EMUL_MODULE)
1509 /* SunOS uses syscall zero as the 'indirect syscall' it looks
1510 * like indir_syscall(scall_num, arg0, arg1, arg2...); etc.
1511 * This is complete brain damage.
1517 cmp %o0, NR_SYSCALLS
1520 sethi %hi(sunos_nosys), %l6
1522 or %l6, %lo(sunos_nosys), %l6
1523 1: sethi %hi(sunos_sys_table), %l7
1524 or %l7, %lo(sunos_sys_table), %l7
1525 lduw [%l7 + %o0], %l6
1539 stx %o0, [%sp + PTREGS_OFF + PT_V9_I1]
1540 b,pt %xcc, ret_sys_call
1541 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1543 /* SunOS getuid() returns uid in %o0 and euid in %o1 */
1546 call sys32_geteuid16
1549 stx %o0, [%sp + PTREGS_OFF + PT_V9_I1]
1550 b,pt %xcc, ret_sys_call
1551 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1553 /* SunOS getgid() returns gid in %o0 and egid in %o1 */
1556 call sys32_getegid16
1559 stx %o0, [%sp + PTREGS_OFF + PT_V9_I1]
1560 b,pt %xcc, ret_sys_call
1561 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1564 /* SunOS's execv() call only specifies the argv argument, the
1565 * environment settings are the same as the calling processes.
1569 sethi %hi(sparc_execve), %g1
1570 ba,pt %xcc, execve_merge
1571 or %g1, %lo(sparc_execve), %g1
1572 #ifdef CONFIG_COMPAT
1575 stx %g0, [%sp + PTREGS_OFF + PT_V9_I2]
1578 sethi %hi(sparc32_execve), %g1
1579 or %g1, %lo(sparc32_execve), %g1
1584 add %sp, PTREGS_OFF, %o0
1586 .globl sys_pipe, sys_sigpause, sys_nis_syscall
1587 .globl sys_sigsuspend, sys_rt_sigsuspend
1588 .globl sys_rt_sigreturn
1590 .globl sys_sigaltstack
1592 sys_pipe: ba,pt %xcc, sparc_pipe
1593 add %sp, PTREGS_OFF, %o0
1594 sys_nis_syscall:ba,pt %xcc, c_sys_nis_syscall
1595 add %sp, PTREGS_OFF, %o0
1596 sys_memory_ordering:
1597 ba,pt %xcc, sparc_memory_ordering
1598 add %sp, PTREGS_OFF, %o1
1599 sys_sigaltstack:ba,pt %xcc, do_sigaltstack
1600 add %i6, STACK_BIAS, %o2
1601 #ifdef CONFIG_COMPAT
1602 .globl sys32_sigstack
1603 sys32_sigstack: ba,pt %xcc, do_sys32_sigstack
1605 .globl sys32_sigaltstack
1607 ba,pt %xcc, do_sys32_sigaltstack
1611 sys_sigsuspend: add %sp, PTREGS_OFF, %o0
1613 add %o7, 1f-.-4, %o7
1615 sys_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */
1616 add %sp, PTREGS_OFF, %o2
1617 call do_rt_sigsuspend
1618 add %o7, 1f-.-4, %o7
1620 #ifdef CONFIG_COMPAT
1621 .globl sys32_rt_sigsuspend
1622 sys32_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */
1624 add %sp, PTREGS_OFF, %o2
1625 call do_rt_sigsuspend32
1626 add %o7, 1f-.-4, %o7
1628 /* NOTE: %o0 has a correct value already */
1629 sys_sigpause: add %sp, PTREGS_OFF, %o1
1631 add %o7, 1f-.-4, %o7
1633 #ifdef CONFIG_COMPAT
1634 .globl sys32_sigreturn
1636 add %sp, PTREGS_OFF, %o0
1638 add %o7, 1f-.-4, %o7
1642 add %sp, PTREGS_OFF, %o0
1643 call do_rt_sigreturn
1644 add %o7, 1f-.-4, %o7
1646 #ifdef CONFIG_COMPAT
1647 .globl sys32_rt_sigreturn
1649 add %sp, PTREGS_OFF, %o0
1650 call do_rt_sigreturn32
1651 add %o7, 1f-.-4, %o7
1654 sys_ptrace: add %sp, PTREGS_OFF, %o0
1656 add %o7, 1f-.-4, %o7
1659 1: ldx [%curptr + TI_FLAGS], %l5
1660 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1663 add %sp, PTREGS_OFF, %o0
1670 /* This is how fork() was meant to be done, 8 instruction entry.
1672 * I questioned the following code briefly, let me clear things
1673 * up so you must not reason on it like I did.
1675 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
1676 * need it here because the only piece of window state we copy to
1677 * the child is the CWP register. Even if the parent sleeps,
1678 * we are safe because we stuck it into pt_regs of the parent
1679 * so it will not change.
1681 * XXX This raises the question, whether we can do the same on
1682 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
1683 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
1684 * XXX fork_kwim in UREG_G1 (global registers are considered
1685 * XXX volatile across a system call in the sparc ABI I think
1686 * XXX if it isn't we can use regs->y instead, anyone who depends
1687 * XXX upon the Y register being preserved across a fork deserves
1690 * In fact we should take advantage of that fact for other things
1691 * during system calls...
1693 .globl sys_fork, sys_vfork, sys_clone, sparc_exit
1694 .globl ret_from_syscall
1696 sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
1697 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
1698 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
1699 ba,pt %xcc, sys_clone
1705 ba,pt %xcc, sparc_do_fork
1706 add %sp, PTREGS_OFF, %o2
1708 /* Clear current_thread_info()->new_child, and
1709 * check performance counter stuff too.
1711 stb %g0, [%g6 + TI_NEW_CHILD]
1712 ldx [%g6 + TI_FLAGS], %l0
1715 andcc %l0, _TIF_PERFCTR, %g0
1718 ldx [%g6 + TI_PCR], %o7
1721 /* Blackbird errata workaround. See commentary in
1722 * smp.c:smp_percpu_timer_interrupt() for more
1728 99: wr %g0, %g0, %pic
1731 1: b,pt %xcc, ret_sys_call
1732 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
1733 sparc_exit: wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV), %pstate
1737 wrpr %g3, 0x0, %cansave
1738 wrpr %g0, 0x0, %otherwin
1739 wrpr %g0, (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE), %pstate
1740 ba,pt %xcc, sys_exit
1741 stb %g0, [%g6 + TI_WSAVED]
1743 linux_sparc_ni_syscall:
1744 sethi %hi(sys_ni_syscall), %l7
1746 or %l7, %lo(sys_ni_syscall), %l7
1748 linux_syscall_trace32:
1749 add %sp, PTREGS_OFF, %o0
1759 linux_syscall_trace:
1760 add %sp, PTREGS_OFF, %o0
1771 /* Linux 32-bit and SunOS system calls enter here... */
1773 .globl linux_sparc_syscall32
1774 linux_sparc_syscall32:
1775 /* Direct access to user regs, much faster. */
1776 cmp %g1, NR_SYSCALLS ! IEU1 Group
1777 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1778 srl %i0, 0, %o0 ! IEU0
1779 sll %g1, 2, %l4 ! IEU0 Group
1780 srl %i4, 0, %o4 ! IEU1
1781 lduw [%l7 + %l4], %l7 ! Load
1782 srl %i1, 0, %o1 ! IEU0 Group
1783 ldx [%curptr + TI_FLAGS], %l0 ! Load
1785 srl %i5, 0, %o5 ! IEU1
1786 srl %i2, 0, %o2 ! IEU0 Group
1787 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1788 bne,pn %icc, linux_syscall_trace32 ! CTI
1790 call %l7 ! CTI Group brk forced
1791 srl %i3, 0, %o3 ! IEU0
1794 /* Linux native and SunOS system calls enter here... */
1796 .globl linux_sparc_syscall, ret_sys_call
1797 linux_sparc_syscall:
1798 /* Direct access to user regs, much faster. */
1799 cmp %g1, NR_SYSCALLS ! IEU1 Group
1800 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1802 sll %g1, 2, %l4 ! IEU0 Group
1804 lduw [%l7 + %l4], %l7 ! Load
1805 4: mov %i2, %o2 ! IEU0 Group
1806 ldx [%curptr + TI_FLAGS], %l0 ! Load
1809 mov %i4, %o4 ! IEU0 Group
1810 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1811 bne,pn %icc, linux_syscall_trace ! CTI Group
1813 2: call %l7 ! CTI Group brk forced
1817 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1819 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
1820 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
1822 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
1825 /* Check if force_successful_syscall_return()
1828 ldub [%curptr + TI_SYS_NOERROR], %l0
1832 stb %g0, [%curptr + TI_SYS_NOERROR]
1835 cmp %o0, -ERESTART_RESTARTBLOCK
1837 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
1839 /* System call success, clear Carry condition code. */
1841 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
1842 bne,pn %icc, linux_syscall_trace2
1843 add %l1, 0x4, %l2 ! npc = npc+4
1844 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1845 ba,pt %xcc, rtrap_clr_l6
1846 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1849 /* System call failure, set Carry condition code.
1850 * Also, get abs(errno) to return to the process.
1852 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
1855 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1857 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
1858 bne,pn %icc, linux_syscall_trace2
1859 add %l1, 0x4, %l2 ! npc = npc+4
1860 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1863 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1864 linux_syscall_trace2:
1865 add %sp, PTREGS_OFF, %o0
1868 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1870 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1873 .globl __flushw_user
1878 1: save %sp, -128, %sp
1884 restore %g0, %g0, %g0