arch/sparc/kernel/rtrap_64.S

Source file repositories/reference/linux-study-clean/arch/sparc/kernel/rtrap_64.S

File Facts

System
Linux kernel
Corpus path
arch/sparc/kernel/rtrap_64.S
Extension
.S
Size
10382 bytes
Lines
379
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: arch/sparc
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <asm/asi.h>
#include <asm/pstate.h>
#include <asm/ptrace.h>
#include <asm/spitfire.h>
#include <asm/head.h>
#include <asm/visasm.h>
#include <asm/processor.h>

#ifdef CONFIG_CONTEXT_TRACKING_USER
# define SCHEDULE_USER schedule_user
#else
# define SCHEDULE_USER schedule
#endif

		.text
		.align			32
__handle_preemption:
		call			SCHEDULE_USER
661:		 wrpr			%g0, RTRAP_PSTATE, %pstate
		/* If userspace is using ADI, it could potentially pass
		 * a pointer with version tag embedded in it. To maintain
		 * the ADI security, we must re-enable PSTATE.mcde before
		 * we continue execution in the kernel for another thread.
		 */
		.section .sun_m7_1insn_patch, "ax"
		.word	661b
		 wrpr			%g0, RTRAP_PSTATE|PSTATE_MCDE, %pstate
		.previous
		ba,pt			%xcc, __handle_preemption_continue
		 wrpr			%g0, RTRAP_PSTATE_IRQOFF, %pstate

__handle_user_windows:
		add			%sp, PTREGS_OFF, %o0
		call			fault_in_user_windows
661:		 wrpr			%g0, RTRAP_PSTATE, %pstate
		/* If userspace is using ADI, it could potentially pass
		 * a pointer with version tag embedded in it. To maintain
		 * the ADI security, we must re-enable PSTATE.mcde before
		 * we continue execution in the kernel for another thread.
		 */
		.section .sun_m7_1insn_patch, "ax"
		.word	661b
		 wrpr			%g0, RTRAP_PSTATE|PSTATE_MCDE, %pstate
		.previous
		ba,pt			%xcc, __handle_preemption_continue
		 wrpr			%g0, RTRAP_PSTATE_IRQOFF, %pstate

__handle_userfpu:
		rd			%fprs, %l5
		andcc			%l5, FPRS_FEF, %g0
		sethi			%hi(TSTATE_PEF), %o0
		be,a,pn			%icc, __handle_userfpu_continue
		 andn			%l1, %o0, %l1
		ba,a,pt			%xcc, __handle_userfpu_continue

__handle_signal:
		mov			%l5, %o1
		add			%sp, PTREGS_OFF, %o0
		mov			%l0, %o2
		call			do_notify_resume
661:		 wrpr			%g0, RTRAP_PSTATE, %pstate
		/* If userspace is using ADI, it could potentially pass
		 * a pointer with version tag embedded in it. To maintain
		 * the ADI security, we must re-enable PSTATE.mcde before
		 * we continue execution in the kernel for another thread.
		 */
		.section .sun_m7_1insn_patch, "ax"
		.word	661b
		 wrpr			%g0, RTRAP_PSTATE|PSTATE_MCDE, %pstate
		.previous

Annotation

Implementation Notes