Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * rtrap.S: Return from Sparc trap low-level code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <asm/psr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <asm/asi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <asm/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <asm/contregs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/winmacro.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <asm/asmmacro.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <asm/thread_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define t_psr     l0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define t_pc      l1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define t_npc     l2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define t_wim     l3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define twin_tmp1 l4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define glob_tmp  g4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define curptr    g6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	/* 7 WINDOW SPARC PATCH INSTRUCTIONS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	.globl	rtrap_7win_patch1, rtrap_7win_patch2, rtrap_7win_patch3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	.globl	rtrap_7win_patch4, rtrap_7win_patch5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) rtrap_7win_patch1:	srl	%t_wim, 0x6, %glob_tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) rtrap_7win_patch2:	and	%glob_tmp, 0x7f, %glob_tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) rtrap_7win_patch3:	srl	%g1, 7, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) rtrap_7win_patch4:	srl	%g2, 6, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) rtrap_7win_patch5:	and	%g1, 0x7f, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	/* END OF PATCH INSTRUCTIONS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	/* We need to check for a few things which are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	 * 1) The need to call schedule() because this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	 *    processes quantum is up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	 * 2) Pending signals for this process, if any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	 *    exist we need to call do_signal() to do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	 *    the needy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	 * Else we just check if the rett would land us
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	 * in an invalid window, if so we need to grab
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	 * it off the user/kernel stack first.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	.globl	ret_trap_entry, rtrap_patch1, rtrap_patch2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	.globl	rtrap_patch3, rtrap_patch4, rtrap_patch5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	.globl	ret_trap_lockless_ipi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) ret_trap_entry:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) ret_trap_lockless_ipi:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	andcc	%t_psr, PSR_PS, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	sethi	%hi(PSR_SYSCALL), %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	be	1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	 andn	%t_psr, %g1, %t_psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	wr	%t_psr, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	b	ret_trap_kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	ld	[%curptr + TI_FLAGS], %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	andcc	%g2, (_TIF_NEED_RESCHED), %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	be	signal_p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	call	schedule
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	ld	[%curptr + TI_FLAGS], %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) signal_p:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	andcc	%g2, _TIF_DO_NOTIFY_RESUME_MASK, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	bz,a	ret_trap_continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	 ld	[%sp + STACKFRAME_SZ + PT_PSR], %t_psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	mov	%g2, %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	mov	%l5, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	call	do_notify_resume
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	 add	%sp, STACKFRAME_SZ, %o0	! pt_regs ptr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	b	signal_p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	 ld	[%curptr + TI_FLAGS], %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) ret_trap_continue:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	sethi	%hi(PSR_SYSCALL), %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	andn	%t_psr, %g1, %t_psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	wr	%t_psr, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	ld	[%curptr + TI_W_SAVED], %twin_tmp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	orcc	%g0, %twin_tmp1, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	be	ret_trap_nobufwins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	wr	%t_psr, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	mov	1, %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	call	try_to_clear_window_buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	 add	%sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	b	signal_p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 ld	[%curptr + TI_FLAGS], %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ret_trap_nobufwins:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	/* Load up the user's out registers so we can pull
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	 * a window from the stack, if necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	LOAD_PT_INS(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	/* If there are already live user windows in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	 * set we can return from trap safely.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	ld	[%curptr + TI_UWINMASK], %twin_tmp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	orcc	%g0, %twin_tmp1, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	bne	ret_trap_userwins_ok
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		/* Calculate new %wim, we have to pull a register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		 * window from the users stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ret_trap_pull_one_window:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		rd	%wim, %t_wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		sll	%t_wim, 0x1, %twin_tmp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) rtrap_patch1:	srl	%t_wim, 0x7, %glob_tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		or	%glob_tmp, %twin_tmp1, %glob_tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) rtrap_patch2:	and	%glob_tmp, 0xff, %glob_tmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		wr	%glob_tmp, 0x0, %wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	/* Here comes the architecture specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	 * branch to the user stack checking routine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	 * for return from traps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	b	srmmu_rett_stackchk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 andcc	%fp, 0x7, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) ret_trap_userwins_ok:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	or	%t_pc, %t_npc, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	andcc	%g2, 0x3, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	sethi	%hi(PSR_SYSCALL), %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	be	1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 andn	%t_psr, %g2, %t_psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	b	ret_trap_unaligned_pc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 add	%sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	LOAD_PT_YREG(sp, g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	LOAD_PT_GLOBALS(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	wr	%t_psr, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	jmp	%t_pc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	rett	%t_npc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) ret_trap_unaligned_pc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	ld	[%sp + STACKFRAME_SZ + PT_PC], %o1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	ld	[%sp + STACKFRAME_SZ + PT_NPC], %o2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	ld	[%sp + STACKFRAME_SZ + PT_PSR], %o3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	wr	%t_wim, 0x0, %wim		! or else...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	wr	%t_psr, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	call	do_memaccess_unaligned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	b	signal_p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 ld	[%curptr + TI_FLAGS], %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) ret_trap_kernel:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		/* Will the rett land us in the invalid window? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		mov	2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		sll	%g1, %t_psr, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) rtrap_patch3:	srl	%g1, 8, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		or	%g1, %g2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		rd	%wim, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		andcc	%g2, %g1, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		be	1f		! Nope, just return from the trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		 sll	%g2, 0x1, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		/* We have to grab a window before returning. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) rtrap_patch4:	srl	%g2, 7,  %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		or	%g1, %g2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) rtrap_patch5:	and	%g1, 0xff, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	wr	%g1, 0x0, %wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	/* Grrr, make sure we load from the right %sp... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	LOAD_PT_ALL(sp, t_psr, t_pc, t_npc, g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	restore	%g0, %g0, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	LOAD_WINDOW(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	b	2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	 save	%g0, %g0, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	/* Reload the entire frame in case this is from a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	 * kernel system call or whatever...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	LOAD_PT_ALL(sp, t_psr, t_pc, t_npc, g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	sethi	%hi(PSR_SYSCALL), %twin_tmp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	andn	%t_psr, %twin_tmp1, %t_psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	wr	%t_psr, 0x0, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	jmp	%t_pc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	rett	%t_npc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ret_trap_user_stack_is_bolixed:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	wr	%t_wim, 0x0, %wim
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	wr	%t_psr, PSR_ET, %psr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	WRITE_PAUSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	call	window_ret_fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	 add	%sp, STACKFRAME_SZ, %o0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	b	signal_p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	 ld	[%curptr + TI_FLAGS], %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.globl	srmmu_rett_stackchk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) srmmu_rett_stackchk:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	bne	ret_trap_user_stack_is_bolixed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	 sethi   %hi(PAGE_OFFSET), %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	cmp	%g1, %fp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	bleu	ret_trap_user_stack_is_bolixed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	 mov	AC_M_SFSR, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) LEON_PI(lda	[%g1] ASI_LEON_MMUREGS, %g0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) SUN_PI_(lda	[%g1] ASI_M_MMUREGS, %g0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) LEON_PI(lda	[%g0] ASI_LEON_MMUREGS, %g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) SUN_PI_(lda	[%g0] ASI_M_MMUREGS, %g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	or	%g1, 0x2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) LEON_PI(sta	%g1, [%g0] ASI_LEON_MMUREGS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) SUN_PI_(sta	%g1, [%g0] ASI_M_MMUREGS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	restore	%g0, %g0, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	LOAD_WINDOW(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	save	%g0, %g0, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	andn	%g1, 0x2, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) LEON_PI(sta	%g1, [%g0] ASI_LEON_MMUREGS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) SUN_PI_(sta	%g1, [%g0] ASI_M_MMUREGS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	mov	AC_M_SFAR, %g2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) LEON_PI(lda	[%g2] ASI_LEON_MMUREGS, %g2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) SUN_PI_(lda	[%g2] ASI_M_MMUREGS, %g2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	mov	AC_M_SFSR, %g1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) LEON_PI(lda	[%g1] ASI_LEON_MMUREGS, %g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) SUN_PI_(lda	[%g1] ASI_M_MMUREGS, %g1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	andcc	%g1, 0x2, %g0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	be	ret_trap_userwins_ok
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	 nop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	b,a	ret_trap_user_stack_is_bolixed