arch/x86/include/asm/desc.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/desc.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/desc.h- Extension
.h- Size
- 11618 bytes
- Lines
- 454
- 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
asm/desc_defs.hasm/ldt.hasm/mmu.hasm/fixmap.hasm/irq_vectors.hasm/cpu_entry_area.hlinux/debug_locks.hlinux/smp.hlinux/percpu.hasm/paravirt.h
Detected Declarations
struct gdt_pagefunction fill_ldtfunction get_cpu_gdt_paddrfunction pack_gatefunction desc_emptyfunction paravirt_alloc_ldtfunction native_write_ldt_entryfunction native_write_gdt_entryfunction set_tssldt_descriptorfunction __set_tss_descfunction native_set_ldtfunction native_load_gdtfunction native_load_idtfunction native_store_gdtfunction store_idtfunction native_gdt_invalidatefunction native_idt_invalidatefunction native_load_tr_descfunction native_load_tr_descfunction native_store_trfunction native_load_tlsfunction force_reload_TRfunction refresh_tss_limitfunction limitfunction LDT_zerofunction clear_LDTfunction get_desc_basefunction set_desc_basefunction get_desc_limitfunction set_desc_limitfunction init_idt_datafunction idt_init_descfunction idt_setup_early_pf
Annotated Snippet
struct gdt_page {
struct desc_struct gdt[GDT_ENTRIES];
} __attribute__((aligned(PAGE_SIZE)));
DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);
/* Provide the original GDT */
static inline struct desc_struct *get_cpu_gdt_rw(unsigned int cpu)
{
return per_cpu(gdt_page, cpu).gdt;
}
/* Provide the current original GDT */
static inline struct desc_struct *get_current_gdt_rw(void)
{
return this_cpu_ptr(&gdt_page)->gdt;
}
/* Provide the fixmap address of the remapped GDT */
static inline struct desc_struct *get_cpu_gdt_ro(int cpu)
{
return (struct desc_struct *)&get_cpu_entry_area(cpu)->gdt;
}
/* Provide the current read-only GDT */
static inline struct desc_struct *get_current_gdt_ro(void)
{
return get_cpu_gdt_ro(smp_processor_id());
}
/* Provide the physical address of the GDT page. */
static inline phys_addr_t get_cpu_gdt_paddr(unsigned int cpu)
{
return per_cpu_ptr_to_phys(get_cpu_gdt_rw(cpu));
}
static inline void pack_gate(gate_desc *gate, unsigned type, unsigned long func,
unsigned dpl, unsigned ist, unsigned seg)
{
gate->offset_low = (u16) func;
gate->bits.p = 1;
gate->bits.dpl = dpl;
gate->bits.zero = 0;
gate->bits.type = type;
gate->offset_middle = (u16) (func >> 16);
#ifdef CONFIG_X86_64
gate->segment = __KERNEL_CS;
gate->bits.ist = ist;
gate->reserved = 0;
gate->offset_high = (u32) (func >> 32);
#else
gate->segment = seg;
gate->bits.ist = 0;
#endif
}
static inline int desc_empty(const void *ptr)
{
const u32 *desc = ptr;
return !(desc[0] | desc[1]);
}
#ifdef CONFIG_PARAVIRT_XXL
#include <asm/paravirt.h>
#else
#define load_TR_desc() native_load_tr_desc()
#define load_gdt(dtr) native_load_gdt(dtr)
#define load_idt(dtr) native_load_idt(dtr)
#define load_tr(tr) asm volatile("ltr %0"::"m" (tr))
#define load_ldt(ldt) asm volatile("lldt %0"::"m" (ldt))
#define store_gdt(dtr) native_store_gdt(dtr)
#define store_tr(tr) (tr = native_store_tr())
#define load_TLS(t, cpu) native_load_tls(t, cpu)
#define set_ldt native_set_ldt
#define write_ldt_entry(dt, entry, desc) native_write_ldt_entry(dt, entry, desc)
#define write_gdt_entry(dt, entry, desc, type) native_write_gdt_entry(dt, entry, desc, type)
#define write_idt_entry(dt, entry, g) native_write_idt_entry(dt, entry, g)
static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries)
{
}
static inline void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries)
{
}
#endif /* CONFIG_PARAVIRT_XXL */
Annotation
- Immediate include surface: `asm/desc_defs.h`, `asm/ldt.h`, `asm/mmu.h`, `asm/fixmap.h`, `asm/irq_vectors.h`, `asm/cpu_entry_area.h`, `linux/debug_locks.h`, `linux/smp.h`.
- Detected declarations: `struct gdt_page`, `function fill_ldt`, `function get_cpu_gdt_paddr`, `function pack_gate`, `function desc_empty`, `function paravirt_alloc_ldt`, `function native_write_ldt_entry`, `function native_write_gdt_entry`, `function set_tssldt_descriptor`, `function __set_tss_desc`.
- 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.