The Linux kernel mapping fixed resolution

565

The new version of the kernel for stored in IDTR register is the kernel of IDT table of addresses to use fixed mapping of linear addresses, so here to fix the kernel mapping addressing mechanism to describe.

Firstly ,Fixed concept mapping

The initial part of the kernel linear addresses the fourth GB of physical memory mapping system. But at least 128 MB of linear addresses is always reserved for he, as the kernel using the linear address mapping of discontinuous memory allocation and fixation of linear addresses.

Secondly, fix-mapped linear address

Each fixed linear address mapping has fixed addresses the index of the structure to specify (part list only 32-bit mode).

enum fixed_addresses {
#ifdef CONFIG_X86_32
 FIX_HOLE,
 FIX_VDSO,
#else
 VSYSCALL_LAST_PAGE,
 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
  + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) – 1,
 VVAR_PAGE,
 VSYSCALL_HPET,
 #ifdef CONFIG_PARAVIRT_CLOCK
  PVCLOCK_FIXMAP_BEGIN,
  PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1,
 #endif
#endif
 FIX_DBGP_BASE,
 FIX_EARLYCON_MEM_BASE,
#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
 FIX_OHCI1394_BASE,
#endif
#ifdef CONFIG_X86_LOCAL_APIC
 FIX_APIC_BASE,  /* local (CPU) APIC) — required for SMP or not */
#endif
#ifdef CONFIG_X86_IO_APIC
 FIX_IO_APIC_BASE_0,
 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS – 1,
#endif
#ifdef CONFIG_X86_VISWS_APIC
 FIX_CO_CPU,     /* Cobalt timer */
 FIX_CO_APIC,    /* Cobalt APIC Redirection Table */
 FIX_LI_PCIA,    /* Lithium PCI Bridge A */
 FIX_LI_PCIB,    /* Lithium PCI Bridge B */
#endif
 FIX_RO_IDT,     /* Virtual mapping for read-only IDT */
#ifdef CONFIG_X86_32
 FIX_KMAP_BEGIN, /* reserved pte’s for temporary kernel mappings */
 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 #ifdef CONFIG_PCI_MMCONFIG
  FIX_PCIE_MCFG,
 #endif
#endif
#ifdef CONFIG_PARAVIRT
 FIX_PARAVIRT_BOOTMAP,
#endif
 FIX_TEXT_POKE1, /* reserve 2 pages for text_poke() */
 FIX_TEXT_POKE0, /* first page is last, because allocation is backward */
#ifdef  CONFIG_X86_INTEL_MID
 FIX_LNW_VRTC,
#endif
 __end_of_permanent_fixed_addresses,

#define NR_FIX_BTMAPS           64
#define FIX_BTMAPS_SLOTS        4
#define TOTAL_FIX_BTMAPS        (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)

 FIX_BTMAP_END =
 (__end_of_permanent_fixed_addresses ^
 (__end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS – 1)) &
 -PTRS_PER_PTE
 ? __end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS –
 (__end_of_permanent_fixed_addresses & (TOTAL_FIX_BTMAPS – 1))
 : __end_of_permanent_fixed_addresses,
  
 FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS – 1,
#ifdef CONFIG_X86_32
 FIX_WP_TEST,
#endif
#ifdef CONFIG_INTEL_TXT
 FIX_TBOOT_BASE,
#endif
 __end_of_fixed_addresses
};

Thirdly,Fixed mapping of linear addresses

The kernel using the set fixmap (independence idx, phys) and set fixmap nocache (independence idx, phys) fixed to establish the mapping of linear addresses to physical addresses. Through the clear fixmap lifting independence idx fixed by the mapping of linear addresses.

telecomate.com