arch/x86/boot/compressed/misc.c
Source file repositories/reference/linux-study-clean/arch/x86/boot/compressed/misc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/boot/compressed/misc.c- Extension
.c- Size
- 14314 bytes
- Lines
- 538
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
misc.herror.h../string.h../voffset.hasm/bootparam_utils.hlinux/decompress/mm.h../../../../lib/decompress_inflate.c../../../../lib/decompress_bunzip2.c../../../../lib/decompress_unlzma.c../../../../lib/decompress_unxz.c../../../../lib/decompress_unlzo.c../../../../lib/decompress_unlz4.c../../../../lib/decompress_unzstd.c
Detected Declarations
function scrollfunction serial_putcharfunction __putstrfunction __putnumfunction __puthexfunction __putdecfunction handle_relocationsfunction handle_relocationsfunction decompress_kernelfunction parse_mem_encryptfunction early_sev_detectfunction image
Annotated Snippet
while (*str) {
if (*str == '\n')
serial_putchar('\r');
serial_putchar(*str++);
}
}
if (lines == 0 || cols == 0)
return;
x = boot_params_ptr->screen_info.orig_x;
y = boot_params_ptr->screen_info.orig_y;
while ((c = *s++) != '\0') {
if (c == '\n') {
x = 0;
if (++y >= lines) {
scroll();
y--;
}
} else {
vidmem[(x + cols * y) * 2] = c;
if (++x >= cols) {
x = 0;
if (++y >= lines) {
scroll();
y--;
}
}
}
}
boot_params_ptr->screen_info.orig_x = x;
boot_params_ptr->screen_info.orig_y = y;
pos = (x + cols * y) * 2; /* Update cursor position */
outb(14, vidport);
outb(0xff & (pos >> 9), vidport+1);
outb(15, vidport);
outb(0xff & (pos >> 1), vidport+1);
}
static noinline void __putnum(unsigned long value, unsigned int base,
int mindig)
{
char buf[8*sizeof(value)+1];
char *p;
p = buf + sizeof(buf);
*--p = '\0';
while (mindig-- > 0 || value) {
unsigned char digit = value % base;
digit += (digit >= 10) ? ('a'-10) : '0';
*--p = digit;
value /= base;
}
__putstr(p);
}
void __puthex(unsigned long value)
{
__putnum(value, 16, sizeof(value)*2);
}
void __putdec(unsigned long value)
{
__putnum(value, 10, 1);
}
#ifdef CONFIG_X86_NEED_RELOCS
static void handle_relocations(void *output, unsigned long output_len,
unsigned long virt_addr)
{
int *reloc;
unsigned long delta, map, ptr;
unsigned long min_addr = (unsigned long)output;
unsigned long max_addr = min_addr + (VO___bss_start - VO__text);
/*
* Calculate the delta between where vmlinux was linked to load
* and where it was actually loaded.
*/
delta = min_addr - LOAD_PHYSICAL_ADDR;
/*
* The kernel contains a table of relocation addresses. Those
* addresses have the final load address of the kernel in virtual
Annotation
- Immediate include surface: `misc.h`, `error.h`, `../string.h`, `../voffset.h`, `asm/bootparam_utils.h`, `linux/decompress/mm.h`, `../../../../lib/decompress_inflate.c`, `../../../../lib/decompress_bunzip2.c`.
- Detected declarations: `function scroll`, `function serial_putchar`, `function __putstr`, `function __putnum`, `function __puthex`, `function __putdec`, `function handle_relocations`, `function handle_relocations`, `function decompress_kernel`, `function parse_mem_encrypt`.
- 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.