arch/x86/include/asm/mmu_context.h
Source file repositories/reference/linux-study-clean/arch/x86/include/asm/mmu_context.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/include/asm/mmu_context.h- Extension
.h- Size
- 7594 bytes
- Lines
- 284
- 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
linux/atomic.hlinux/mm_types.hlinux/pkeys.htrace/events/tlb.hasm/tlbflush.hasm/paravirt.hasm/debugreg.hasm/gsseg.hasm/desc.hasm-generic/mmu_context.h
Detected Declarations
struct ldt_structfunction init_new_context_ldtfunction init_new_context_ldtfunction destroy_context_ldtfunction load_mm_ldtfunction switch_ldtfunction mm_lam_cr3_maskfunction dup_lamfunction mm_untag_maskfunction mm_reset_untag_maskfunction arch_pgtable_dma_compatfunction mm_lam_cr3_maskfunction dup_lamfunction init_new_contextfunction destroy_contextfunction arch_dup_pkeysfunction arch_dup_mmapfunction arch_exit_mmapfunction is_64bit_mmfunction is_64bit_mmfunction is_notrack_mmfunction set_notrack_mmfunction arch_vma_access_permitted
Annotated Snippet
struct ldt_struct {
/*
* Xen requires page-aligned LDTs with special permissions. This is
* needed to prevent us from installing evil descriptors such as
* call gates. On native, we could merge the ldt_struct and LDT
* allocations, but it's not worth trying to optimize.
*/
struct desc_struct *entries;
unsigned int nr_entries;
/*
* If PTI is in use, then the entries array is not mapped while we're
* in user mode. The whole array will be aliased at the addressed
* given by ldt_slot_va(slot). We use two slots so that we can allocate
* and map, and enable a new LDT without invalidating the mapping
* of an older, still-in-use LDT.
*
* slot will be -1 if this LDT doesn't have an alias mapping.
*/
int slot;
};
/*
* Used for LDT copy/destruction.
*/
static inline void init_new_context_ldt(struct mm_struct *mm)
{
mm->context.ldt = NULL;
init_rwsem(&mm->context.ldt_usr_sem);
}
int ldt_dup_context(struct mm_struct *oldmm, struct mm_struct *mm);
void destroy_context_ldt(struct mm_struct *mm);
void ldt_arch_exit_mmap(struct mm_struct *mm);
#else /* CONFIG_MODIFY_LDT_SYSCALL */
static inline void init_new_context_ldt(struct mm_struct *mm) { }
static inline int ldt_dup_context(struct mm_struct *oldmm,
struct mm_struct *mm)
{
return 0;
}
static inline void destroy_context_ldt(struct mm_struct *mm) { }
static inline void ldt_arch_exit_mmap(struct mm_struct *mm) { }
#endif
#ifdef CONFIG_MODIFY_LDT_SYSCALL
extern void load_mm_ldt(struct mm_struct *mm);
extern void switch_ldt(struct mm_struct *prev, struct mm_struct *next);
#else
static inline void load_mm_ldt(struct mm_struct *mm)
{
clear_LDT();
}
static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next)
{
DEBUG_LOCKS_WARN_ON(preemptible());
}
#endif
#ifdef CONFIG_ADDRESS_MASKING
static inline unsigned long mm_lam_cr3_mask(struct mm_struct *mm)
{
/*
* When switch_mm_irqs_off() is called for a kthread, it may race with
* LAM enablement. switch_mm_irqs_off() uses the LAM mask to do two
* things: populate CR3 and populate 'cpu_tlbstate.lam'. Make sure it
* reads a single value for both.
*/
return READ_ONCE(mm->context.lam_cr3_mask);
}
static inline void dup_lam(struct mm_struct *oldmm, struct mm_struct *mm)
{
mm->context.lam_cr3_mask = oldmm->context.lam_cr3_mask;
mm->context.untag_mask = oldmm->context.untag_mask;
}
#define mm_untag_mask mm_untag_mask
static inline unsigned long mm_untag_mask(struct mm_struct *mm)
{
return mm->context.untag_mask;
}
static inline void mm_reset_untag_mask(struct mm_struct *mm)
{
mm->context.untag_mask = -1UL;
}
#define arch_pgtable_dma_compat arch_pgtable_dma_compat
static inline bool arch_pgtable_dma_compat(struct mm_struct *mm)
{
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/mm_types.h`, `linux/pkeys.h`, `trace/events/tlb.h`, `asm/tlbflush.h`, `asm/paravirt.h`, `asm/debugreg.h`, `asm/gsseg.h`.
- Detected declarations: `struct ldt_struct`, `function init_new_context_ldt`, `function init_new_context_ldt`, `function destroy_context_ldt`, `function load_mm_ldt`, `function switch_ldt`, `function mm_lam_cr3_mask`, `function dup_lam`, `function mm_untag_mask`, `function mm_reset_untag_mask`.
- 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.