arch/nios2/kernel/entry.S

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

File Facts

System
Linux kernel
Corpus path
arch/nios2/kernel/entry.S
Extension
.S
Size
15143 bytes
Lines
575
Domain
Architecture Layer
Bucket
arch/nios2
Inferred role
Architecture Layer: arch/nios2
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 <linux/sys.h>
#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/asm-macros.h>
#include <asm/thread_info.h>
#include <asm/errno.h>
#include <asm/setup.h>
#include <asm/entry.h>
#include <asm/unistd.h>
#include <asm/processor.h>

.macro GET_THREAD_INFO reg
.if THREAD_SIZE & 0xffff0000
	andhi	\reg, sp, %hi(~(THREAD_SIZE-1))
.else
	addi	\reg, r0, %lo(~(THREAD_SIZE-1))
	and	\reg, \reg, sp
.endif
.endm

.macro	kuser_cmpxchg_check
	/*
	 * Make sure our user space atomic helper is restarted if it was
	 * interrupted in a critical region.
	 * ea-4 = address of interrupted insn (ea must be preserved).
	 * sp = saved regs.
	 * cmpxchg_ldw = first critical insn, cmpxchg_stw = last critical insn.
	 * If ea <= cmpxchg_stw and ea > cmpxchg_ldw then saved EA is set to
	 * cmpxchg_ldw + 4.
	*/
	/* et = cmpxchg_stw + 4 */
	movui   et, (KUSER_BASE + 4 + (cmpxchg_stw - __kuser_helper_start))
	bgtu	ea, et, 1f

	subi	et, et, (cmpxchg_stw - cmpxchg_ldw) /* et = cmpxchg_ldw + 4 */
	bltu	ea, et, 1f
	stw	et, PT_EA(sp)	/* fix up EA */
	mov	ea, et
1:
.endm

.section .rodata
.align 4
exception_table:
	.word unhandled_exception	/* 0 - Reset */
	.word unhandled_exception	/* 1 - Processor-only Reset */
	.word external_interrupt	/* 2 - Interrupt */
	.word handle_trap		/* 3 - Trap Instruction */

	.word instruction_trap		/* 4 - Unimplemented instruction */
	.word handle_illegal		/* 5 - Illegal instruction */
	.word handle_unaligned		/* 6 - Misaligned data access */
	.word handle_unaligned		/* 7 - Misaligned destination address */

	.word handle_diverror		/* 8 - Division error */
	.word protection_exception_ba	/* 9 - Supervisor-only instr. address */
	.word protection_exception_instr /* 10 - Supervisor only instruction */
	.word protection_exception_ba	/* 11 - Supervisor only data address */

	.word unhandled_exception	/* 12 - Double TLB miss (data) */
	.word protection_exception_pte	/* 13 - TLB permission violation (x) */
	.word protection_exception_pte	/* 14 - TLB permission violation (r) */
	.word protection_exception_pte	/* 15 - TLB permission violation (w) */

	.word unhandled_exception	/* 16 - MPU region violation */

trap_table:
	.word	handle_system_call	/* 0  */
	.word	handle_trap_1		/* 1  */
	.word	handle_trap_2		/* 2  */

Annotation

Implementation Notes