arch/csky/kernel/entry.S

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

File Facts

System
Linux kernel
Corpus path
arch/csky/kernel/entry.S
Extension
.S
Size
5019 bytes
Lines
275
Domain
Architecture Layer
Bucket
arch/csky
Inferred role
Architecture Layer: arch/csky
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

// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.

#include <linux/linkage.h>
#include <abi/entry.h>
#include <abi/pgtable-bits.h>
#include <asm/errno.h>
#include <asm/setup.h>
#include <asm/unistd.h>
#include <asm/asm-offsets.h>
#include <linux/threads.h>
#include <asm/page.h>
#include <asm/thread_info.h>

.macro	zero_fp
#ifdef CONFIG_STACKTRACE
	movi	r8, 0
#endif
.endm

.macro	context_tracking
#ifdef CONFIG_CONTEXT_TRACKING_USER
	mfcr	a0, epsr
	btsti	a0, 31
	bt	1f
	jbsr	user_exit_callable
	ldw	a0, (sp, LSAVE_A0)
	ldw	a1, (sp, LSAVE_A1)
	ldw	a2, (sp, LSAVE_A2)
	ldw	a3, (sp, LSAVE_A3)
#if defined(__CSKYABIV1__)
	ldw	r6, (sp, LSAVE_A4)
	ldw	r7, (sp, LSAVE_A5)
#endif
1:
#endif
.endm

.text
ENTRY(csky_pagefault)
	SAVE_ALL 0
	zero_fp
	context_tracking
	psrset  ee
	mov     a0, sp
	jbsr    do_page_fault
	jmpi    ret_from_exception

ENTRY(csky_systemcall)
	SAVE_ALL TRAP0_SIZE
	zero_fp
	context_tracking
	psrset  ee, ie

	lrw     r9, __NR_syscalls
	cmphs   syscallid, r9		/* Check nr of syscall */
	bt      ret_from_exception

	lrw     r9, sys_call_table
	ixw     r9, syscallid
	ldw     syscallid, (r9)
	cmpnei  syscallid, 0
	bf      ret_from_exception

	mov     r9, sp
	bmaski  r10, THREAD_SHIFT
	andn    r9, r10
	ldw     r10, (r9, TINFO_FLAGS)
	lrw	r9, _TIF_SYSCALL_WORK
	and	r10, r9
	cmpnei	r10, 0

Annotation

Implementation Notes