arch/riscv/lib/clear_page.S
Source file repositories/reference/linux-study-clean/arch/riscv/lib/clear_page.S
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/lib/clear_page.S- Extension
.S- Size
- 1556 bytes
- Lines
- 75
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- 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/linkage.hlinux/export.hasm/asm.hasm/alternative-macros.hasm/hwcap.hasm/insn-def.hasm/page.h
Detected Declarations
export clear_page
Annotated Snippet
#include <linux/linkage.h>
#include <linux/export.h>
#include <asm/asm.h>
#include <asm/alternative-macros.h>
#include <asm/hwcap.h>
#include <asm/insn-def.h>
#include <asm/page.h>
#define CBOZ_ALT(order, old, new) \
ALTERNATIVE(old, new, 0, \
((order) << 16) | RISCV_ISA_EXT_ZICBOZ, \
CONFIG_RISCV_ISA_ZICBOZ)
/* void clear_page(void *page) */
SYM_FUNC_START(clear_page)
li a2, PAGE_SIZE
/*
* If Zicboz isn't present, or somehow has a block
* size larger than 4K, then fallback to memset.
*/
CBOZ_ALT(12, "j .Lno_zicboz", "nop")
lw a1, riscv_cboz_block_size
add a2, a0, a2
.Lzero_loop:
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(11, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(10, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(9, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBOZ_ALT(8, "bltu a0, a2, .Lzero_loop; ret", "nop; nop")
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
CBO_ZERO(a0)
add a0, a0, a1
bltu a0, a2, .Lzero_loop
ret
.Lno_zicboz:
li a1, 0
tail __memset
SYM_FUNC_END(clear_page)
EXPORT_SYMBOL(clear_page)
Annotation
- Immediate include surface: `linux/linkage.h`, `linux/export.h`, `asm/asm.h`, `asm/alternative-macros.h`, `asm/hwcap.h`, `asm/insn-def.h`, `asm/page.h`.
- Detected declarations: `export clear_page`.
- Atlas domain: Architecture Layer / arch/riscv.
- 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.