arch/sparc/kernel/rtrap_32.S

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

File Facts

System
Linux kernel
Corpus path
arch/sparc/kernel/rtrap_32.S
Extension
.S
Size
5767 bytes
Lines
266
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/page.h>
#include <asm/ptrace.h>
#include <asm/psr.h>
#include <asm/asi.h>
#include <asm/smp.h>
#include <asm/contregs.h>
#include <asm/winmacro.h>
#include <asm/asmmacro.h>
#include <asm/thread_info.h>

#define t_psr     l0
#define t_pc      l1
#define t_npc     l2
#define t_wim     l3
#define twin_tmp1 l4
#define glob_tmp  g4
#define curptr    g6

	/* 7 WINDOW SPARC PATCH INSTRUCTIONS */
	.globl	rtrap_7win_patch1, rtrap_7win_patch2, rtrap_7win_patch3
	.globl	rtrap_7win_patch4, rtrap_7win_patch5
rtrap_7win_patch1:	srl	%t_wim, 0x6, %glob_tmp
rtrap_7win_patch2:	and	%glob_tmp, 0x7f, %glob_tmp
rtrap_7win_patch3:	srl	%g1, 7, %g2
rtrap_7win_patch4:	srl	%g2, 6, %g2
rtrap_7win_patch5:	and	%g1, 0x7f, %g1
	/* END OF PATCH INSTRUCTIONS */

	/* We need to check for a few things which are:
	 * 1) The need to call schedule() because this
	 *    processes quantum is up.
	 * 2) Pending signals for this process, if any
	 *    exist we need to call do_signal() to do
	 *    the needy.
	 *
	 * Else we just check if the rett would land us
	 * in an invalid window, if so we need to grab
	 * it off the user/kernel stack first.
	 */

	.globl	ret_trap_entry, rtrap_patch1, rtrap_patch2
	.globl	rtrap_patch3, rtrap_patch4, rtrap_patch5
	.globl	ret_trap_lockless_ipi
ret_trap_entry:
ret_trap_lockless_ipi:
	andcc	%t_psr, PSR_PS, %g0
	sethi	%hi(PSR_SYSCALL), %g1
	be	1f
	 andn	%t_psr, %g1, %t_psr

	wr	%t_psr, 0x0, %psr
	b	ret_trap_kernel
	 nop

1:
	ld	[%curptr + TI_FLAGS], %g2
	andcc	%g2, (_TIF_NEED_RESCHED), %g0
	be	signal_p
	 nop

	call	schedule
	 nop

	ld	[%curptr + TI_FLAGS], %g2
signal_p:
	andcc	%g2, _TIF_DO_NOTIFY_RESUME_MASK, %g0
	bz,a	ret_trap_continue
	 ld	[%sp + STACKFRAME_SZ + PT_PSR], %t_psr

	mov	%g2, %o2

Annotation

Implementation Notes