x86: remove usage of CONFIG_KERNEL_LINK_IN_VIRT
There is no need to use this kconfig, as the phys-to-virt offset is enough to figure out if the kernel is linked in virtual address space in gen_mmu.py. For code, use Z_VM_KERNEL instead. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
4c7bde4311
commit
273a5e670b
4 changed files with 8 additions and 15 deletions
|
@ -219,7 +219,7 @@ static const struct paging_level paging_levels[] = {
|
|||
*/
|
||||
#define NUM_PT_VIRT ((PT_VIRT_END - PT_VIRT_START) / PT_AREA)
|
||||
|
||||
#ifdef CONFIG_KERNEL_LINK_IN_VIRT
|
||||
#ifdef Z_VM_KERNEL
|
||||
/* When linking in virtual address space, the physical address space
|
||||
* also needs to be mapped as platform is booted via physical address
|
||||
* and various structures needed by boot (e.g. GDT, IDT) must be
|
||||
|
@ -238,7 +238,7 @@ static const struct paging_level paging_levels[] = {
|
|||
#define NUM_PT_PHYS ((PT_PHYS_END - PT_PHYS_START) / PT_AREA)
|
||||
#else
|
||||
#define NUM_PT_PHYS 0
|
||||
#endif /* CONFIG_KERNEL_LINK_IN_VIRT */
|
||||
#endif /* Z_VM_KERNEL */
|
||||
|
||||
#define NUM_PT (NUM_PT_VIRT + NUM_PT_PHYS)
|
||||
|
||||
|
@ -253,14 +253,14 @@ static const struct paging_level paging_levels[] = {
|
|||
*/
|
||||
#define NUM_PD_VIRT ((PD_VIRT_END - PD_VIRT_START) / PD_AREA)
|
||||
|
||||
#ifdef CONFIG_KERNEL_LINK_IN_VIRT
|
||||
#ifdef Z_VM_KERNEL
|
||||
#define PD_PHYS_START ((uintptr_t)ROUND_DOWN(SRAM_ADDR, PD_AREA))
|
||||
#define PD_PHYS_END ((uintptr_t)ROUND_UP(SRAM_ADDR + SRAM_SIZE, PD_AREA))
|
||||
|
||||
#define NUM_PD_PHYS ((PD_PHYS_END - PD_PHYS_START) / PD_AREA)
|
||||
#else
|
||||
#define NUM_PD_PHYS 0
|
||||
#endif /* CONFIG_KERNEL_LINK_IN_VIRT */
|
||||
#endif /* Z_VM_KERNEL */
|
||||
|
||||
#define NUM_PD (NUM_PD_VIRT + NUM_PD_PHYS)
|
||||
#else
|
||||
|
|
|
@ -574,7 +574,7 @@ def main():
|
|||
# Map the zephyr image
|
||||
pt.map(image_base, image_size, map_flags | ENTRY_RW)
|
||||
|
||||
if isdef("CONFIG_KERNEL_LINK_IN_VIRT"):
|
||||
if virt_to_phys_offset != 0:
|
||||
pt.reserve_unaligned(sram_base, sram_size)
|
||||
|
||||
mapped_kernel_phys_base = mapped_kernel_base + virt_to_phys_offset
|
||||
|
@ -611,19 +611,19 @@ def main():
|
|||
flags = FLAG_P | ENTRY_US | ENTRY_RW
|
||||
pt.set_region_perms("_image_text", flags)
|
||||
|
||||
if isdef("CONFIG_KERNEL_LINK_IN_VIRT") and virt_to_phys_offset != 0:
|
||||
if virt_to_phys_offset != 0:
|
||||
pt.set_region_perms("_image_text", flags, use_offset=True)
|
||||
else:
|
||||
flags = FLAG_P | ENTRY_US
|
||||
pt.set_region_perms("_image_text", flags)
|
||||
|
||||
if isdef("CONFIG_KERNEL_LINK_IN_VIRT") and virt_to_phys_offset != 0:
|
||||
if virt_to_phys_offset != 0:
|
||||
pt.set_region_perms("_image_text", flags, use_offset=True)
|
||||
|
||||
flags = FLAG_P | ENTRY_US | ENTRY_XD
|
||||
pt.set_region_perms("_image_rodata", flags)
|
||||
|
||||
if isdef("CONFIG_KERNEL_LINK_IN_VIRT") and virt_to_phys_offset != 0:
|
||||
if virt_to_phys_offset != 0:
|
||||
pt.set_region_perms("_image_rodata", flags, use_offset=True)
|
||||
|
||||
if isdef("CONFIG_COVERAGE_GCOV") and isdef("CONFIG_USERSPACE"):
|
||||
|
|
|
@ -22,4 +22,3 @@ CONFIG_SRAM_OFFSET=0x100000
|
|||
CONFIG_KERNEL_VM_SIZE=0x400000
|
||||
CONFIG_KERNEL_VM_BASE=0x40000000
|
||||
CONFIG_KERNEL_VM_OFFSET=0x100000
|
||||
CONFIG_KERNEL_LINK_IN_VIRT=y
|
||||
|
|
|
@ -11,12 +11,6 @@
|
|||
* By default, the kernel is linked at its physical address and all addresses
|
||||
* are in RAM.
|
||||
*
|
||||
* If CONFIG_KERNEL_LINK_IN_VIRT is enabled, the kernel is linked at
|
||||
* the virtual address space defined by CONFIG_KERNEL_VM_BASE,
|
||||
* and CONFIG_KERNEL_VM_SIZE. CONFIG_KERNEL_VM_OFFSET defines the offset of
|
||||
* the start of virtual address space to place the kernel. This allows
|
||||
* the kernel to have a bigger address space.
|
||||
*
|
||||
* If CONFIG_XIP is enabled, then another MEMORY region is declared for ROM,
|
||||
* and this is where the Zephyr image is booted from. The linker LMAs and VMAs
|
||||
* are set up, such that read/write data/bss have their VMA addresses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue