diff --git a/arch/arm64/kernel/include/arch-memory.h b/arch/arm64/kernel/include/arch-memory.h index eaccf9e5..05e1af5f 100644 --- a/arch/arm64/kernel/include/arch-memory.h +++ b/arch/arm64/kernel/include/arch-memory.h @@ -34,7 +34,7 @@ void panic(const char *); */ /* early alloc area address */ /* START:_end, SIZE:512 pages */ -#define MAP_EARLY_ALLOC_SHIFT 9 +#define MAP_EARLY_ALLOC_SHIFT 5 #define MAP_EARLY_ALLOC_SIZE (UL(1) << (PAGE_SHIFT + MAP_EARLY_ALLOC_SHIFT)) #ifndef __ASSEMBLY__ @@ -55,7 +55,10 @@ extern char _end[]; # define MAP_BOOT_PARAM_END (MAP_BOOT_PARAM + MAP_BOOT_PARAM_SIZE) #endif /* !__ASSEMBLY__ */ -#if (VA_BITS == 39 && GRANULE_SIZE == _SZ4KB) +/* + * MAP_KERNEL_START is HOST MODULES_END - 8MiB + */ +#if (VA_BITS == 39 && GRANULE_SIZE == _SZ4KB) /* ARM64_MEMORY_LAYOUT=1 */ # # define LD_TASK_UNMAPPED_BASE UL(0x0000000400000000) # define TASK_UNMAPPED_BASE UL(0x0000000800000000) @@ -64,9 +67,9 @@ extern char _end[]; # define MAP_VMAP_SIZE UL(0x0000000100000000) # define MAP_FIXED_START UL(0xffffffbffbdfd000) # define MAP_ST_START UL(0xffffffc000000000) -# define MAP_KERNEL_START UL(0xffffffffff800000) +# define MAP_KERNEL_START UL(0xffffff8007800000) # -#elif (VA_BITS == 42 && GRANULE_SIZE == _SZ64KB) +#elif (VA_BITS == 42 && GRANULE_SIZE == _SZ64KB) /* ARM64_MEMORY_LAYOUT=3 */ # # define LD_TASK_UNMAPPED_BASE UL(0x0000002000000000) # define TASK_UNMAPPED_BASE UL(0x0000004000000000) @@ -75,9 +78,9 @@ extern char _end[]; # define MAP_VMAP_SIZE UL(0x0000000100000000) # define MAP_FIXED_START UL(0xfffffdfffbdd0000) # define MAP_ST_START UL(0xfffffe0000000000) -# define MAP_KERNEL_START UL(0xffffffffe0000000) +# define MAP_KERNEL_START UL(0xfffffc0007800000) # -#elif (VA_BITS == 48 && GRANULE_SIZE == _SZ4KB) +#elif (VA_BITS == 48 && GRANULE_SIZE == _SZ4KB) /* ARM64_MEMORY_LAYOUT=2 */ # # define LD_TASK_UNMAPPED_BASE UL(0x0000080000000000) # define TASK_UNMAPPED_BASE UL(0x0000100000000000) @@ -86,9 +89,9 @@ extern char _end[]; # define MAP_VMAP_SIZE UL(0x0000000100000000) # define MAP_FIXED_START UL(0xffff7ffffbdfd000) # define MAP_ST_START UL(0xffff800000000000) -# define MAP_KERNEL_START UL(0xffffffffff800000) +# define MAP_KERNEL_START UL(0xffff000007800000) # -#elif (VA_BITS == 48 && GRANULE_SIZE == _SZ64KB) +#elif (VA_BITS == 48 && GRANULE_SIZE == _SZ64KB) /* ARM64_MEMORY_LAYOUT=4 */ # # define LD_TASK_UNMAPPED_BASE UL(0x0000080000000000) # define TASK_UNMAPPED_BASE UL(0x0000100000000000) @@ -97,7 +100,7 @@ extern char _end[]; # define MAP_VMAP_SIZE UL(0x0000000100000000) # define MAP_FIXED_START UL(0xffff7ffffbdd0000) # define MAP_ST_START UL(0xffff800000000000) -# define MAP_KERNEL_START UL(0xffffffffe0000000) +# define MAP_KERNEL_START UL(0xffff000007800000) # #else # error address space is not defined. diff --git a/arch/arm64/kernel/memory.c b/arch/arm64/kernel/memory.c index fa5fc304..901112a8 100644 --- a/arch/arm64/kernel/memory.c +++ b/arch/arm64/kernel/memory.c @@ -3334,10 +3334,10 @@ unsigned long virt_to_phys(void *v) { unsigned long va = (unsigned long)v; - if (MAP_KERNEL_START <= va) { - return va - MAP_KERNEL_START + arm64_kernel_phys_base; + if (va >= MAP_ST_START) { + return va - MAP_ST_START; } - return va - MAP_ST_START; + return va - MAP_KERNEL_START + arm64_kernel_phys_base; } void *phys_to_virt(unsigned long p) diff --git a/executer/user/arch/arm64/arch-eclair.c b/executer/user/arch/arm64/arch-eclair.c index 5f8ac8bb..038bb475 100644 --- a/executer/user/arch/arm64/arch-eclair.c +++ b/executer/user/arch/arm64/arch-eclair.c @@ -55,13 +55,14 @@ uintptr_t virt_to_phys(uintptr_t va) { extern uintptr_t kernel_base; + if (va >= MAP_ST) { + return (va - MAP_ST); + } + if (va >= MAP_KERNEL) { return (va - MAP_KERNEL + kernel_base); } - if (va >= MAP_ST) { - return (va - MAP_ST); - } return NOPHYS; } /* virt_to_phys() */ #endif /* POSTK_DEBUG_ARCH_DEP_34 */ diff --git a/executer/user/arch/arm64/include/arch-eclair.h b/executer/user/arch/arm64/include/arch-eclair.h index 9452ec0b..757dc2c5 100644 --- a/executer/user/arch/arm64/include/arch-eclair.h +++ b/executer/user/arch/arm64/include/arch-eclair.h @@ -6,15 +6,15 @@ # # if (CONFIG_ARM64_VA_BITS == 42) # /* VA_BITS=42, 64K_PAGE address */ -# define MAP_KERNEL 0xffffffffe0000000 +# define MAP_KERNEL 0xfffffc0007800000 # define MAP_ST 0xfffffe0000000000 -# define MAP_KERNEL_TEXT "0xffffffffe0000000" +# define MAP_KERNEL_TEXT "0xfffffc0007800000" # # elif (CONFIG_ARM64_VA_BITS == 48) # /* VA_BITS=48, 64K_PAGE address */ -# define MAP_KERNEL 0xffffffffe0000000 +# define MAP_KERNEL 0xffff000007800000 # define MAP_ST 0xffff800000000000 -# define MAP_KERNEL_TEXT "0xffffffffe0000000" +# define MAP_KERNEL_TEXT "0xffff000007800000" # # else # @@ -26,15 +26,15 @@ # # if (CONFIG_ARM64_VA_BITS == 39) # /* VA_BITS=39, 4K_PAGE address */ -# define MAP_KERNEL 0xffffffffff800000 +# define MAP_KERNEL 0xffffff8007800000 # define MAP_ST 0xffffffc000000000 -# define MAP_KERNEL_TEXT "0xffffffffff800000" +# define MAP_KERNEL_TEXT "0xffffff8007800000" # # elif (CONFIG_ARM64_VA_BITS == 48) # /* VA_BITS=48, 4K_PAGE address */ -# define MAP_KERNEL 0xffffffffff800000 +# define MAP_KERNEL 0xffff000007800000 # define MAP_ST 0xffff800000000000 -# define MAP_KERNEL_TEXT "0xffffffffff800000" +# define MAP_KERNEL_TEXT "0xffff000007800000" # # else # diff --git a/ihk b/ihk index 283b10e1..6da480a5 160000 --- a/ihk +++ b/ihk @@ -1 +1 @@ -Subproject commit 283b10e18f2e4c722948f367d7dda0f3e35b950e +Subproject commit 6da480a5352d4865871f783eb305b7ed837dc86f diff --git a/kernel/config/smp-arm64_type1.lds b/kernel/config/smp-arm64_type1.lds index c2cd83bd..dbaaaef8 100644 --- a/kernel/config/smp-arm64_type1.lds +++ b/kernel/config/smp-arm64_type1.lds @@ -6,7 +6,7 @@ PHDRS } SECTIONS { - . = 0xffffffffff800000; /* KERNEL_START */ + . = 0xffffff8007800000; /* KERNEL_START */ _head = .; .text : { diff --git a/kernel/config/smp-arm64_type2.lds b/kernel/config/smp-arm64_type2.lds index 97182b3b..f4b49bcf 100644 --- a/kernel/config/smp-arm64_type2.lds +++ b/kernel/config/smp-arm64_type2.lds @@ -6,7 +6,7 @@ PHDRS } SECTIONS { - . = 0xffffffffff800000; /* KERNEL_START */ + . = 0xffff000007800000; /* KERNEL_START */ _head = .; .text : { diff --git a/kernel/config/smp-arm64_type3.lds b/kernel/config/smp-arm64_type3.lds index 7add4e20..af327411 100644 --- a/kernel/config/smp-arm64_type3.lds +++ b/kernel/config/smp-arm64_type3.lds @@ -6,7 +6,7 @@ PHDRS } SECTIONS { - . = 0xffffffffe0000000; /* KERNEL_START */ + . = 0xfffffc0007800000; /* KERNEL_START */ _head = .; .text : { diff --git a/kernel/config/smp-arm64_type4.lds b/kernel/config/smp-arm64_type4.lds index 85b97d60..2b91defa 100644 --- a/kernel/config/smp-arm64_type4.lds +++ b/kernel/config/smp-arm64_type4.lds @@ -6,7 +6,7 @@ PHDRS } SECTIONS { - . = 0xffffffffe0000000; /* KERNEL_START */ + . = 0xffff000007800000; /* KERNEL_START */ _head = .; .text : {