arch/mips/lib/strnlen_user.S
Source file repositories/reference/linux-study-clean/arch/mips/lib/strnlen_user.S
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/lib/strnlen_user.S- Extension
.S- Size
- 1441 bytes
- Lines
- 65
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
Dependency Surface
linux/export.hasm/asm.hasm/asm-offsets.hasm/regdef.h
Detected Declarations
export __strnlen_user_asm
Annotated Snippet
#include <linux/export.h>
#include <asm/asm.h>
#include <asm/asm-offsets.h>
#include <asm/regdef.h>
#define EX(insn,reg,addr,handler) \
9: insn reg, addr; \
.section __ex_table,"a"; \
PTR_WD 9b, handler; \
.previous
/*
* Return the size of a string including the ending NUL character up to a
* maximum of a1 or 0 in case of error.
*
* Note: for performance reasons we deliberately accept that a user may
* make strlen_user and strnlen_user access the first few KSEG0
* bytes. There's nothing secret there. On 64-bit accessing beyond
* the maximum is a tad hairier ...
*/
LEAF(__strnlen_user_asm)
move v0, a0
PTR_ADDU a1, a0 # stop pointer
1:
#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
.set noat
li AT, 1
#endif
beq v0, a1, 1f # limit reached?
#ifdef CONFIG_EVA
.set push
.set eva
EX(lbe, t0, (v0), .Lfault)
.set pop
#else
EX(lb, t0, (v0), .Lfault)
#endif
.set noreorder
bnez t0, 1b
1:
#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
PTR_ADDIU v0, 1
#else
PTR_ADDU v0, AT
.set at
#endif
.set reorder
PTR_SUBU v0, a0
jr ra
END(__strnlen_user_asm)
.Lfault:
move v0, zero
jr ra
EXPORT_SYMBOL(__strnlen_user_asm)
Annotation
- Immediate include surface: `linux/export.h`, `asm/asm.h`, `asm/asm-offsets.h`, `asm/regdef.h`.
- Detected declarations: `export __strnlen_user_asm`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: integration implementation candidate.
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.