address space reorganization
RFC 1/1 address space reorganization
Hi,
This is a patch doing the memory layout changes I've suggested a few days ago on the list. It's still a static layout, I havn't changed it to adjust the frametable size at runtime. Doesn't break compatibility, the location of the ro MPT table and the size of xen's private address space is still the same (for non-PAE), so domains don't even notice this change ;)
Comments?
Gerd
==============================[ cut here ]==============================
Subject: [patch] address space reorganization
Shuffle around the memory blocks a bit ;)
Intention is to have largely the same memory layout in both PAE and non-PAE mode, so I moved the fixed-size stuff to the top, followed by the variable-sized stuff (frametable and linear page tables), and the domain-accessable machine-phys-table at the bottom.
Note that PAGE_OFFSET isn't the start address of xen's private memory area any more. Thats why the segment range checks are fixed up and use RO_MPT_VIRT_END now.
--- arch/x86/mm.c | 2 arch/x86/traps.c | 4 - arch/x86/x86_32/mm.c | 6 +- arch/x86/x86_32/seg_fixup.c | 6 +- arch/x86/x86_32/xen.lds | 2 include/asm-x86/config.h | 83 +++++++++++++++++++--------------- include/asm-x86/x86_32/page.h | 2 7 files changed, 59 insertions(+), 46 deletions(-)
arch/x86/x86_32/xen.lds +1 -1
@@ -11,7 +11,7 @@ PHDRS } SECTIONS { - . = 0xFC400000 + 0x100000; + . = 0xFF000000 + 0x100000; _text = .; /* Text and read-only data */ .text : { *(.text)
include/asm-x86/config.h +48 -35
97 lines not on this page · raw message
include/asm-x86/x86_32/page.h +1 -1
@@ -12,7 +12,7 @@#define L2_PAGETABLE_ENTRIES (1<<PAGETABLE_ORDER)#define ROOT_PAGETABLE_ENTRIES L2_PAGETABLE_ENTRIES -#define __PAGE_OFFSET (0xFC400000) +#define __PAGE_OFFSET (0xFF000000)#define PADDR_BITS 32#define VADDR_BITS 32
arch/x86/mm.c +1 -1
@@ -1634,7 +1634,7 @@ int do_mmuext_op(if ( ((ptr & (PAGE_SIZE -1 )) !=0 ) || (ents >8192 ) || ((ptr+ents*LDT_ENTRY_SIZE ) < ptr) || - ((ptr+ents*LDT_ENTRY_SIZE ) >PAGE_OFFSET ) ) + ((ptr+ents*LDT_ENTRY_SIZE ) >RO_MPT_VIRT_END ) ) { okay =0 ;MEM_LOG ("Bad args to SET_LDT: ptr=%p, ents=%p" , ptr, ents);
arch/x86/x86_32/seg_fixup.c +3 -3
@@ -145,7 +145,7 @@ int get_baselimit(u16 seg, unsigned long* Anything that looks like a truncated segment we assume ought really * to be a 4GB segment. DANGER! */ -if ( (PAGE_OFFSET - (*base + *limit)) <PAGE_SIZE ) +if ( (RO_MPT_VIRT_END - (*base + *limit)) <PAGE_SIZE ) *limit =0 ;return 1 ;
@@ -226,14 +226,14 @@ int fixup_seg(u16 seg, unsigned long offif ( ((base + limit) <PAGE_SIZE ) && (offset <= limit) ) {/* Flip to expands-up. */ - limit =PAGE_OFFSET - base; + limit =RO_MPT_VIRT_END - base; goto flip; } }else {/* Expands-up: All the way to Xen space? Assume 4GB if so. */ -if ( ((PAGE_OFFSET - (base + limit)) <PAGE_SIZE ) && +if ( ((RO_MPT_VIRT_END - (base + limit)) <PAGE_SIZE ) && (offset > limit) ) {/* Flip to expands-down. */
arch/x86/traps.c +2 -2
@@ -284,7 +284,7 @@ asmlinkage int do_page_fault(struct xen_return EXCRET_fault_fixed; } -if ( (addr <PAGE_OFFSET ) && +if ( (addr <RO_MPT_VIRT_END ) && ((regs->error_code &3 ) ==3 ) &&/* write-protection fault */ ptwr_do_page_fault (d, addr) ) {
@@ -1102,7 +1102,7 @@ long do_set_trap_table(trap_info_t *trap#if defined(__i386__)#define DB_VALID_ADDR (_a) \ - ((_a) <= (PAGE_OFFSET - 4)) + ((_a) <= (RO_MPT_VIRT_END - 4))#elif defined(__x86_64__)#define DB_VALID_ADDR (_a) \ ((_a) >= HYPERVISOR_VIRT_END) || ((_a) <= (HYPERVISOR_VIRT_START-8))
arch/x86/x86_32/mm.c +3 -3
@@ -248,7 +248,7 @@ int check_descriptor(struct desc_struct/* Check that base is at least a page away from Xen-private area. */ base = (b&(0xff <<24 )) | ((b&0xff )<<16 ) | (a>>16 ); -if ( base >= (PAGE_OFFSET -PAGE_SIZE ) ) +if ( base >= (RO_MPT_VIRT_END -PAGE_SIZE ) ) goto bad;/* Check and truncate the limit if necessary. */
@@ -281,9 +281,9 @@ int check_descriptor(struct desc_struct* limit == 0x00000 provides 4kB access (if G=1). */ if ( ((base + limit) <= base) || - ((base + limit) >PAGE_OFFSET ) ) + ((base + limit) >RO_MPT_VIRT_END ) ) { - limit =PAGE_OFFSET - base; + limit =RO_MPT_VIRT_END - base; truncate:if ( !(b & _SEGMENT_G) ) goto bad;/* too dangerous; too hard to work out... */