arch/csky/kernel/traps.c
Source file repositories/reference/linux-study-clean/arch/csky/kernel/traps.c
File Facts
- System
- Linux kernel
- Corpus path
arch/csky/kernel/traps.c- Extension
.c- Size
- 5760 bytes
- Lines
- 264
- Domain
- Architecture Layer
- Bucket
- arch/csky
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/sched.hlinux/signal.hlinux/kernel.hlinux/mm.hlinux/module.hlinux/user.hlinux/string.hlinux/linkage.hlinux/init.hlinux/ptrace.hlinux/kallsyms.hlinux/rtc.hlinux/uaccess.hlinux/kprobes.hlinux/kdebug.hlinux/sched/debug.hasm/setup.hasm/traps.hasm/pgalloc.hasm/siginfo.hasm/mmu_context.habi/fpu.h
Detected Declarations
function pre_trap_initfunction trap_initfunction diefunction do_trapfunction do_trap_errorfunction do_trap_misalignedfunction do_trap_bkptfunction do_trap_illinsnfunction do_trap_fpefunction do_trap_privfunction trap_c
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
#include <linux/cpu.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/user.h>
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <linux/kallsyms.h>
#include <linux/rtc.h>
#include <linux/uaccess.h>
#include <linux/kprobes.h>
#include <linux/kdebug.h>
#include <linux/sched/debug.h>
#include <asm/setup.h>
#include <asm/traps.h>
#include <asm/pgalloc.h>
#include <asm/siginfo.h>
#include <asm/mmu_context.h>
#ifdef CONFIG_CPU_HAS_FPU
#include <abi/fpu.h>
#endif
int show_unhandled_signals = 1;
/* Defined in entry.S */
asmlinkage void csky_trap(void);
asmlinkage void csky_systemcall(void);
asmlinkage void csky_cmpxchg(void);
asmlinkage void csky_get_tls(void);
asmlinkage void csky_irq(void);
asmlinkage void csky_pagefault(void);
/* Defined in head.S */
asmlinkage void _start_smp_secondary(void);
void __init pre_trap_init(void)
{
int i;
mtcr("vbr", vec_base);
for (i = 1; i < 128; i++)
VEC_INIT(i, csky_trap);
}
void __init trap_init(void)
{
VEC_INIT(VEC_AUTOVEC, csky_irq);
/* setup trap0 trap2 trap3 */
VEC_INIT(VEC_TRAP0, csky_systemcall);
VEC_INIT(VEC_TRAP2, csky_cmpxchg);
VEC_INIT(VEC_TRAP3, csky_get_tls);
/* setup MMU TLB exception */
VEC_INIT(VEC_TLBINVALIDL, csky_pagefault);
VEC_INIT(VEC_TLBINVALIDS, csky_pagefault);
VEC_INIT(VEC_TLBMODIFIED, csky_pagefault);
#ifdef CONFIG_CPU_HAS_FPU
init_fpu();
#endif
#ifdef CONFIG_SMP
mtcr("cr<28, 0>", virt_to_phys(vec_base));
VEC_INIT(VEC_RESET, (void *)virt_to_phys(_start_smp_secondary));
#endif
}
static DEFINE_SPINLOCK(die_lock);
void die(struct pt_regs *regs, const char *str)
{
static int die_counter;
int ret;
oops_enter();
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/sched.h`, `linux/signal.h`, `linux/kernel.h`, `linux/mm.h`, `linux/module.h`, `linux/user.h`, `linux/string.h`.
- Detected declarations: `function pre_trap_init`, `function trap_init`, `function die`, `function do_trap`, `function do_trap_error`, `function do_trap_misaligned`, `function do_trap_bkpt`, `function do_trap_illinsn`, `function do_trap_fpe`, `function do_trap_priv`.
- Atlas domain: Architecture Layer / arch/csky.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.