arch/csky/abiv2/mcount.S
Source file repositories/reference/linux-study-clean/arch/csky/abiv2/mcount.S
File Facts
- System
- Linux kernel
- Corpus path
arch/csky/abiv2/mcount.S- Extension
.S- Size
- 3565 bytes
- Lines
- 212
- 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
linux/linkage.hasm/ftrace.habi/entry.hasm/asm-offsets.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
#include <linux/linkage.h>
#include <asm/ftrace.h>
#include <abi/entry.h>
#include <asm/asm-offsets.h>
/*
* csky-gcc with -pg will put the following asm after prologue:
* push r15
* jsri _mcount
*
* stack layout after mcount_enter in _mcount():
*
* current sp => 0:+-------+
* | a0-a3 | -> must save all argument regs
* +16:+-------+
* | lr | -> _mcount lr (instrumente function's pc)
* +20:+-------+
* | fp=r8 | -> instrumented function fp
* +24:+-------+
* | plr | -> instrumented function lr (parent's pc)
* +-------+
*/
.macro mcount_enter
subi sp, 24
stw a0, (sp, 0)
stw a1, (sp, 4)
stw a2, (sp, 8)
stw a3, (sp, 12)
stw lr, (sp, 16)
stw r8, (sp, 20)
.endm
.macro mcount_exit
ldw a0, (sp, 0)
ldw a1, (sp, 4)
ldw a2, (sp, 8)
ldw a3, (sp, 12)
ldw t1, (sp, 16)
ldw r8, (sp, 20)
ldw lr, (sp, 24)
addi sp, 28
jmp t1
.endm
.macro mcount_enter_regs
subi sp, 8
stw lr, (sp, 0)
stw r8, (sp, 4)
SAVE_REGS_FTRACE
.endm
.macro mcount_exit_regs
RESTORE_REGS_FTRACE
subi sp, 152
ldw t1, (sp, 4)
addi sp, 152
ldw r8, (sp, 4)
ldw lr, (sp, 8)
addi sp, 12
jmp t1
.endm
.macro save_return_regs
subi sp, 16
stw a0, (sp, 0)
stw a1, (sp, 4)
stw a2, (sp, 8)
Annotation
- Immediate include surface: `linux/linkage.h`, `asm/ftrace.h`, `abi/entry.h`, `asm/asm-offsets.h`.
- Atlas domain: Architecture Layer / arch/csky.
- Implementation status: atlas-only.
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.