arch/x86/lib/kaslr.c
Source file repositories/reference/linux-study-clean/arch/x86/lib/kaslr.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/lib/kaslr.c- Extension
.c- Size
- 2275 bytes
- Lines
- 99
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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.
Dependency Surface
asm/asm.hasm/kaslr.hasm/tsc.hasm/archrandom.hasm/e820/api.hasm/shared/io.hasm/cpufeature.hasm/setup.h
Detected Declarations
function i8254function kaslr_get_random_long
Annotated Snippet
if (rdrand_long(&raw)) {
random ^= raw;
use_i8254 = false;
}
}
if (has_cpuflag(X86_FEATURE_TSC)) {
if (purpose)
debug_putstr(" RDTSC");
raw = rdtsc();
random ^= raw;
use_i8254 = false;
}
if (use_i8254) {
if (purpose)
debug_putstr(" i8254");
random ^= i8254();
}
/* Circular multiply for better bit diffusion */
asm(_ASM_MUL "%3"
: "=a" (random), "=d" (raw)
: "a" (random), "rm" (mix_const));
random += raw;
if (purpose)
debug_putstr("...\n");
return random;
}
Annotation
- Immediate include surface: `asm/asm.h`, `asm/kaslr.h`, `asm/tsc.h`, `asm/archrandom.h`, `asm/e820/api.h`, `asm/shared/io.h`, `asm/cpufeature.h`, `asm/setup.h`.
- Detected declarations: `function i8254`, `function kaslr_get_random_long`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source 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.