move McKernel out of Linux kernel virtual

This commit is contained in:
Balazs Gerofi
2018-02-19 10:41:12 +09:00
committed by Masamichi Takagi
parent 5fcbfa2eb5
commit cae6b9f154
4 changed files with 44 additions and 5 deletions

View File

@ -42,10 +42,24 @@
#define USER_END 0x0000800000000000UL
#define TASK_UNMAPPED_BASE 0x00002AAAAAA00000UL
/*
* Canonical negative addresses (i.e., the smallest kernel virtual address)
* on x86 64 bit mode (in its most restricted 48 bit format) starts from
* 0xffff800000000000, but Linux starts mapping physical memory at 0xffff880000000000.
* The 0x80000000000 long gap (8TBs, i.e., 16 PGD level entries in the page tables)
* is used for Xen hyervisor (see arch/x86/include/asm/page.h) and that is
* what we utilize for McKernel.
* This gives us the benefit of being able to use Linux kernel virtual
* addresses identically as in Linux.
*
* NOTE: update these also in eclair.c when modified!
*/
#define MAP_ST_START 0xffff800000000000UL
#define MAP_VMAP_START 0xfffff00000000000UL
#define MAP_FIXED_START 0xffffffff70000000UL
#define MAP_KERNEL_START 0xffffffff80000000UL
#define MAP_VMAP_START 0xffff850000000000UL
#define MAP_FIXED_START 0xffff860000000000UL
#define MAP_KERNEL_START 0xffff870000000000UL
#define LINUX_PAGE_OFFSET 0xffff880000000000UL
#define STACK_TOP(region) ((region)->user_end)
#define MAP_VMAP_SIZE 0x0000000100000000UL

View File

@ -2539,6 +2539,30 @@ static void init_normal_area(struct page_table *pt)
virt += LARGE_PAGE_SIZE;
}
}
static void init_linux_kernel_mapping(struct page_table *pt)
{
unsigned long map_start, map_end, phys;
void *virt;
/* Map 2 TB for now */
map_start = 0;
map_end = 0x20000000000;
virt = (void *)LINUX_PAGE_OFFSET;
kprintf("Linux kernel virtual: 0x%lx - 0x%lx -> 0x%lx - 0x%lx\n",
LINUX_PAGE_OFFSET, LINUX_PAGE_OFFSET + map_end, 0, map_end);
for (phys = map_start; phys < map_end; phs += LARGE_PAGE_SIZE) {
if (set_pt_large_page(pt, virt, phys, PTATTR_WRITABLE) != 0) {
kprintf("%s: error setting mapping for 0x%lx\n",
__func__, virt);
}
virt += LARGE_PAGE_SIZE;
}
}
void init_text_area(struct page_table *pt)
{
unsigned long __end, phys, virt;
@ -2627,6 +2651,7 @@ void init_page_table(void)
/* Normal memory area */
init_normal_area(init_pt);
init_linux_kernel_mapping(init_pt);
init_fixed_area(init_pt);
init_low_area(init_pt);
init_text_area(init_pt);

2
ihk

Submodule ihk updated: 779390b27b...e783a654b4

View File

@ -5,7 +5,7 @@ PHDRS
}
SECTIONS
{
. = 0xffffffff80001000;
. = 0xffff870000001000;
_head = .;
.text : {