From: Jan Kiszka Date: Fri, 1 Jan 2016 12:19:29 +0000 (+0100) Subject: inmates: x86: Move loader page tables into rodata section X-Git-Url: https://rtime.felk.cvut.cz/gitweb/jailhouse.git/commitdiff_plain/b75dcd5d51ad99c92afd73c13f240e6d2534e1ee inmates: x86: Move loader page tables into rodata section This enables the linker to compact the output a bit more, saving between 1500 bytes (32 bit) and 3300 bytes (64 bit) in the F-segment. Signed-off-by: Jan Kiszka --- diff --git a/inmates/lib/x86/header-32.S b/inmates/lib/x86/header-32.S index 17fa5b6..31a39fb 100644 --- a/inmates/lib/x86/header-32.S +++ b/inmates/lib/x86/header-32.S @@ -47,7 +47,7 @@ start32: or $X86_CR4_PSE,%eax mov %eax,%cr4 - mov $loader_pdpt + FSEGMENT_BASE,%eax + mov $loader_pdpt,%eax mov %eax,%cr3 mov $(X86_CR0_PG | X86_CR0_WP | X86_CR0_PE),%eax @@ -131,6 +131,9 @@ gdt_ptr: .short gdt_ptr - loader_gdt - 1 .long loader_gdt + FSEGMENT_BASE + + .section ".rodata" + .align(4096) .global loader_pdpt loader_pdpt: diff --git a/inmates/lib/x86/header.S b/inmates/lib/x86/header.S index af8e918..f3037dc 100644 --- a/inmates/lib/x86/header.S +++ b/inmates/lib/x86/header.S @@ -50,7 +50,7 @@ start32: or $X86_CR4_PAE,%eax mov %eax,%cr4 - mov $pml4 + FSEGMENT_BASE,%eax + mov $pml4,%eax mov %eax,%cr3 movl $MSR_MTRR_DEF_TYPE,%ecx @@ -136,13 +136,16 @@ gdt_ptr: .short gdt_ptr - gdt - 1 .long gdt + FSEGMENT_BASE + + .section ".rodata" + .align(4096) pml4: - .quad pdpt + FSEGMENT_BASE + 0x003 + .quad pdpt + 0x003 .align(4096) pdpt: - .quad pd + FSEGMENT_BASE + 0x003 + .quad pd + 0x003 .align(4096) pd: