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.

Dependency Surface

Detected Declarations

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

Implementation Notes