arch/alpha/kernel/entry.S

Source file repositories/reference/linux-study-clean/arch/alpha/kernel/entry.S

File Facts

System
Linux kernel
Corpus path
arch/alpha/kernel/entry.S
Extension
.S
Size
20443 bytes
Lines
929
Domain
Architecture Layer
Bucket
arch/alpha
Inferred role
Architecture Layer: arch/alpha
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/asm-offsets.h>
#include <asm/thread_info.h>
#include <asm/pal.h>
#include <asm/errno.h>
#include <asm/unistd.h>
#include <linux/errno.h>

	.text
	.set noat
	.cfi_sections	.debug_frame

.macro	CFI_START_OSF_FRAME	func
	.align	4
	.globl	\func
	.type	\func,@function
\func:
	.cfi_startproc simple
	.cfi_return_column 64
	.cfi_def_cfa	$sp, 48
	.cfi_rel_offset	64, 8
	.cfi_rel_offset	$gp, 16
	.cfi_rel_offset	$16, 24
	.cfi_rel_offset	$17, 32
	.cfi_rel_offset	$18, 40
.endm

.macro	CFI_END_OSF_FRAME	func
	.cfi_endproc
	.size	\func, . - \func
.endm

/*
 * SYSCALL_SKIP_RETURN_RESTART_GATE
 *
 * Used when syscall dispatch is skipped (seccomp/ptrace injected nr=-1).
 *  - Ensure we never return r0==-1 with a3==0 (success); convert to ENOSYS.
 *  - Gate whether syscall restart is allowed by preserving restart context
 *    only for ERESTART* returns. Result:
 *        $26 = 0  => restart allowed
 *        $26 = 1  => restart NOT allowed
 *        $18 = preserved syscall nr (regs->r2) if restart allowed, else 0
 */
.macro  SYSCALL_SKIP_RETURN_RESTART_GATE
	/* Fix up invalid "-1 success" return state. */
	ldq	$19, 72($sp)		/* a3 */
	bne	$19, 1f			/* already error => skip fixup */

	ldq	$20, 0($sp)		/* r0 */
	lda	$21, -1($31)
	cmpeq	$20, $21, $22
	beq	$22, 1f			/* r0 != -1 => skip fixup */


	lda	$20, ENOSYS($31)
	stq	$20, 0($sp)		/* r0 = ENOSYS */
	lda	$19, 1($31)
	stq	$19, 72($sp)		/* a3 = 1 */
1:
	/* Restart gating: success is never restartable here. */
	ldq	$19, 72($sp)		/* a3 */
	beq	$19, 3f			/* success => not restartable */

	ldq	$20, 0($sp)		/* r0 (positive errno if a3==1) */
	lda	$21, ERESTARTSYS($31)
	cmpeq	$20, $21, $22
	bne	$22, 2f
	lda	$21, ERESTARTNOINTR($31)
	cmpeq	$20, $21, $22
	bne	$22, 2f
	lda	$21, ERESTARTNOHAND($31)

Annotation

Implementation Notes