From: "Jan Beulich" Subject: [PATCH RFC 9/9] x86: construct static part of 1:1 mapping at build time Date: Thu, 24 May 2012 14:07:25 +0100 Message-ID: <4FBE4EAD0200007800085E4B@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3618CA9D.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3618CA9D.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... rather than at boot time, removing unnecessary redundancy between EFI and legacy boot code. Signed-off-by: Jan Beulich --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -109,14 +109,11 @@ __start: bt $29,%edx jnc bad_cpu /* Initialise L2 identity-map and xen page table entries (16MB). = */ - mov $sym_phys(l2_identmap),%edi mov $sym_phys(l2_xenmap),%esi mov $sym_phys(l2_bootmap),%edx mov $0x1e3,%eax /* PRESENT+RW+A+D+2MB+GLOBAL = */ mov $8,%ecx -1: mov %eax,(%edi) - add $8,%edi - mov %eax,(%esi) +1: mov %eax,(%esi) add $8,%esi mov %eax,(%edx) add $8,%edx @@ -148,54 +145,11 @@ __start: mov %eax,sym_phys(idle_pg_table) + l4_table_offset(DIRECTMAP_V= IRT_START)*8 mov $(sym_phys(l3_xenmap)+7),%eax mov %eax,sym_phys(idle_pg_table) + l4_table_offset(XEN_VIRT_ST= ART)*8 -#else - /* Initialize low and high mappings of memory with 2MB pages */ - mov $sym_phys(idle_pg_table_l2),%edi - mov $0xe3,%eax /* PRESENT+RW+A+D+2MB */ -1: mov %eax,__PAGE_OFFSET>>18(%edi) /* high mapping */ - stosl /* low mapping */ - add $4,%edi - add $(1<>18) #endif =20 /* Apply relocations to bootstrap trampoline. */ @@ -241,3 +195,25 @@ __high_start: #else #include "x86_32.S" #endif + + .section .data.page_aligned, "aw", @progbits + .p2align PAGE_SHIFT +/* + * Mapping of first 2 megabytes of memory. This is mapped with 4kB = mappings + * to avoid type conflicts with fixed-range MTRRs covering the lowest = megabyte + * of physical memory. In any case the VGA hole should be mapped with = type UC. + */ + .globl l1_identmap +l1_identmap: + pfn =3D 0 + .rept L1_PAGETABLE_ENTRIES + /* VGA hole (0xa0000-0xc0000) should be mapped UC. */ + .if pfn >=3D 0xa0 && pfn < 0xc0 + .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR_NOCACHE | MAP_SMALL_PA= GES + .else + .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES + .endif + .long 0 + pfn =3D pfn + 1 + .endr + .size l1_identmap, . - l1_identmap --- a/xen/arch/x86/boot/x86_32.S +++ b/xen/arch/x86/boot/x86_32.S @@ -108,3 +108,24 @@ ENTRY(boot_cpu_gdt_table) .fill (PER_CPU_GDT_ENTRY - FLAT_RING3_DS / 8 - 1), 8, 0 .quad 0x0000910000000000 /* per-CPU entry (limit =3D=3D cpu) = */ .align PAGE_SIZE,0 + +#define PAGE_HYPERVISOR __PAGE_HYPERVISOR +#define PAGE_HYPERVISOR_NOCACHE __PAGE_HYPERVISOR_NOCACHE + +/* Mapping of first 16 megabytes of memory. */ + .globl idle_pg_table_l2 +idle_pg_table_l2: + range =3D 8 + .irp count, l2_linear_offset(__PAGE_OFFSET), \ + (4 * L2_PAGETABLE_ENTRIES - l2_linear_offset(__PAGE_OF= FSET) - 1) + .long sym_phys(l1_identmap) + PAGE_HYPERVISOR, 0 + pfn =3D 1 << PAGETABLE_ORDER + .rept range - 1 + .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE, 0 + pfn =3D pfn + (1 << PAGETABLE_ORDER) + .endr + .fill \count - range, 8, 0 + range =3D DIRECTMAP_MBYTES / 2 + .endr + .long sym_phys(l1_fixmap) + PAGE_HYPERVISOR, 0 + .size idle_pg_table_l2, . - idle_pg_table_l2 --- a/xen/arch/x86/boot/x86_64.S +++ b/xen/arch/x86/boot/x86_64.S @@ -127,3 +127,15 @@ ENTRY(boot_cpu_compat_gdt_table) .fill (PER_CPU_GDT_ENTRY - __HYPERVISOR_CS32 / 8 - 1), 8, 0 .quad 0x0000910000000000 /* per-CPU entry (limit =3D=3D cpu) = */ .align PAGE_SIZE, 0 + +/* Mapping of first 16 megabytes of memory. */ + .globl l2_identmap +l2_identmap: + .quad 0 + pfn =3D 1 << PAGETABLE_ORDER + .rept 7 + .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE + pfn =3D pfn + (1 << PAGETABLE_ORDER) + .endr + .fill 4 * L2_PAGETABLE_ENTRIES - 8, 8, 0 + .size l2_identmap, . - l2_identmap --- a/xen/arch/x86/efi/boot.c +++ b/xen/arch/x86/efi/boot.c @@ -1119,8 +1119,6 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY unsigned int slot =3D (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; paddr_t addr =3D slot << L2_PAGETABLE_SHIFT; =20 - l2_identmap[i] =3D l2e_from_paddr(i << L2_PAGETABLE_SHIFT, - PAGE_HYPERVISOR|_PAGE_PSE); l2_identmap[slot] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_P= SE); l2_xenmap[i] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE); slot &=3D L2_PAGETABLE_ENTRIES - 1; @@ -1150,16 +1148,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY l4e_from_paddr((UINTN)l3_identmap, __PAGE_HYPERVISOR); idle_pg_table[l4_table_offset(XEN_VIRT_START)] =3D l4e_from_paddr((UINTN)l3_xenmap, __PAGE_HYPERVISOR); - /* Initialize 4kB mappings of first 2MB of memory. */ - for ( i =3D 0; i < L1_PAGETABLE_ENTRIES; ++i ) - { - unsigned int attr =3D PAGE_HYPERVISOR|MAP_SMALL_PAGES; - - /* VGA hole (0xa0000-0xc0000) should be mapped UC. */ - if ( i >=3D 0xa0 && i < 0xc0 ) - attr |=3D _PAGE_PCD; - l1_identmap[i] =3D l1e_from_pfn(i, attr); - } + /* Hook 4kB mappings of first 2MB of memory into L2. */ l2_identmap[0] =3D l2e_from_paddr((UINTN)l1_identmap, __PAGE_HYPERVISO= R); =20 if ( gop ) --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -121,15 +121,6 @@ #include #include =20 -/* - * Mapping of first 2 or 4 megabytes of memory. This is mapped with 4kB - * mappings to avoid type conflicts with fixed-range MTRRs covering the - * lowest megabyte of physical memory. In any case the VGA hole should be - * mapped with type UC. - */ -l1_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - l1_identmap[L1_PAGETABLE_ENTRIES]; - /* Mapping of the fixmap space needed early. */ l1_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) l1_fixmap[L1_PAGETABLE_ENTRIES]; --- a/xen/arch/x86/x86_32/mm.c +++ b/xen/arch/x86/x86_32/mm.c @@ -31,9 +31,6 @@ #include #include =20 -l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES]; - unsigned int __read_mostly PAGE_HYPERVISOR =3D __PAGE_HYPERVISOR; unsigned int __read_mostly PAGE_HYPERVISOR_NOCACHE =3D __PAGE_HYPERVISOR_N= OCACHE; =20 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -56,8 +56,6 @@ l4_pgentry_t __attribute__ ((__section__ /* Enough page directories to map bottom 4GB of the memory map. */ l3_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) l3_identmap[L3_PAGETABLE_ENTRIES]; -l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - l2_identmap[4*L2_PAGETABLE_ENTRIES]; =20 /* Enough page directories to map the Xen text and static data. */ l3_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -1,15 +1,13 @@ #ifndef __X86_PAGE_H__ #define __X86_PAGE_H__ =20 +#include + /* * It is important that the masks are signed quantities. This ensures = that * the compiler sign-extends a 32-bit mask to 64 bits if that is = required. */ -#ifndef __ASSEMBLY__ -#define PAGE_SIZE (1L << PAGE_SHIFT) -#else -#define PAGE_SIZE (1 << PAGE_SHIFT) -#endif +#define PAGE_SIZE (_AC(1,L) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_FLAG_MASK (~0) =20 @@ -319,21 +317,22 @@ void paging_init(void); void setup_idle_pagetable(void); #endif /* !defined(__ASSEMBLY__) */ =20 -#define _PAGE_PRESENT 0x001U -#define _PAGE_RW 0x002U -#define _PAGE_USER 0x004U -#define _PAGE_PWT 0x008U -#define _PAGE_PCD 0x010U -#define _PAGE_ACCESSED 0x020U -#define _PAGE_DIRTY 0x040U -#define _PAGE_PAT 0x080U -#define _PAGE_PSE 0x080U -#define _PAGE_GLOBAL 0x100U -#define _PAGE_AVAIL0 0x200U -#define _PAGE_AVAIL1 0x400U -#define _PAGE_AVAIL2 0x800U -#define _PAGE_AVAIL 0xE00U -#define _PAGE_PSE_PAT 0x1000U +#define _PAGE_PRESENT _AC(0x001,U) +#define _PAGE_RW _AC(0x002,U) +#define _PAGE_USER _AC(0x004,U) +#define _PAGE_PWT _AC(0x008,U) +#define _PAGE_PCD _AC(0x010,U) +#define _PAGE_ACCESSED _AC(0x020,U) +#define _PAGE_DIRTY _AC(0x040,U) +#define _PAGE_PAT _AC(0x080,U) +#define _PAGE_PSE _AC(0x080,U) +#define _PAGE_GLOBAL _AC(0x100,U) +#define _PAGE_AVAIL0 _AC(0x200,U) +#define _PAGE_AVAIL1 _AC(0x400,U) +#define _PAGE_AVAIL2 _AC(0x800,U) +#define _PAGE_AVAIL _AC(0xE00,U) +#define _PAGE_PSE_PAT _AC(0x1000,U) +/* non-architectural flags */ #define _PAGE_PAGED 0x2000U #define _PAGE_SHARED 0x4000U =20 @@ -354,6 +353,8 @@ void setup_idle_pagetable(void); #define __PAGE_HYPERVISOR_NOCACHE \ (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED) =20 +#define MAP_SMALL_PAGES _PAGE_AVAIL0 /* don't use superpages mappings */ + #ifndef __ASSEMBLY__ =20 /* Allocator functions for Xen pagetables. */ @@ -367,7 +368,6 @@ l3_pgentry_t *virt_to_xen_l3e(unsigned l extern void set_pdx_range(unsigned long smfn, unsigned long emfn); =20 /* Map machine page range in Xen virtual address space. */ -#define MAP_SMALL_PAGES _PAGE_AVAIL0 /* don't use superpages for the = mapping */ int map_pages_to_xen( unsigned long virt, unsigned long mfn, --- /dev/null +++ b/xen/include/xen/const.h @@ -0,0 +1,24 @@ +/* const.h: Macros for dealing with constants. */ + +#ifndef __XEN_CONST_H__ +#define __XEN_CONST_H__ + +/* Some constant macros are used in both assembler and + * C code. Therefore we cannot annotate them always with + * 'UL' and other type specifiers unilaterally. We + * use the following macros to deal with this. + * + * Similarly, _AT() will cast an expression with a type in C, but + * leave it unchanged in asm. + */ + +#ifdef __ASSEMBLY__ +#define _AC(X,Y) X +#define _AT(T,X) X +#else +#define __AC(X,Y) (X##Y) +#define _AC(X,Y) __AC(X,Y) +#define _AT(T,X) ((T)(X)) +#endif + +#endif /* __XEN_CONST_H__ */ --=__Part3618CA9D.0__= Content-Type: text/plain; name="x86-build-ident-map.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-build-ident-map.patch" x86: construct static part of 1:1 mapping at build time=0A=0A... rather = than at boot time, removing unnecessary redundancy between=0AEFI and = legacy boot code.=0A=0ASigned-off-by: Jan Beulich =0A=0A= --- a/xen/arch/x86/boot/head.S=0A+++ b/xen/arch/x86/boot/head.S=0A@@ = -109,14 +109,11 @@ __start:=0A bt $29,%edx=0A jnc = bad_cpu=0A /* Initialise L2 identity-map and xen page table = entries (16MB). */=0A- mov $sym_phys(l2_identmap),%edi=0A = mov $sym_phys(l2_xenmap),%esi=0A mov $sym_phys(l2_bootmap= ),%edx=0A mov $0x1e3,%eax /* PRESENT+RW+A+D+2M= B+GLOBAL */=0A mov $8,%ecx=0A-1: mov %eax,(%edi)=0A- = add $8,%edi=0A- mov %eax,(%esi)=0A+1: mov = %eax,(%esi)=0A add $8,%esi=0A mov %eax,(%edx)=0A = add $8,%edx=0A@@ -148,54 +145,11 @@ __start:=0A mov = %eax,sym_phys(idle_pg_table) + l4_table_offset(DIRECTMAP_VIRT_START)*8=0A = mov $(sym_phys(l3_xenmap)+7),%eax=0A mov %eax,sym_ph= ys(idle_pg_table) + l4_table_offset(XEN_VIRT_START)*8=0A-#else=0A- = /* Initialize low and high mappings of memory with 2MB pages */=0A- = mov $sym_phys(idle_pg_table_l2),%edi=0A- mov $0xe3,%eax = /* PRESENT+RW+A+D+2MB */=0A-1: mov %eax,__PAGE_OFFSE= T>>18(%edi) /* high mapping */=0A- stosl = /* low mapping */=0A- add $4,%edi=0A- add = $(1<>18)=0A #endif=0A =0A = /* Apply relocations to bootstrap trampoline. */=0A@@ -241,3 +195,25 = @@ __high_start:=0A #else=0A #include "x86_32.S"=0A #endif=0A+=0A+ = .section .data.page_aligned, "aw", @progbits=0A+ .p2align PAGE_SHIFT= =0A+/*=0A+ * Mapping of first 2 megabytes of memory. This is mapped with = 4kB mappings=0A+ * to avoid type conflicts with fixed-range MTRRs covering = the lowest megabyte=0A+ * of physical memory. In any case the VGA hole = should be mapped with type UC.=0A+ */=0A+ .globl l1_identmap=0A+l1_i= dentmap:=0A+ pfn =3D 0=0A+ .rept L1_PAGETABLE_ENTRIES=0A+ = /* VGA hole (0xa0000-0xc0000) should be mapped UC. */=0A+ .if = pfn >=3D 0xa0 && pfn < 0xc0=0A+ .long (pfn << PAGE_SHIFT) | = PAGE_HYPERVISOR_NOCACHE | MAP_SMALL_PAGES=0A+ .else=0A+ = .long (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | MAP_SMALL_PAGES=0A+ = .endif=0A+ .long 0=0A+ pfn =3D pfn + 1=0A+ .endr=0A+ = .size l1_identmap, . - l1_identmap=0A--- a/xen/arch/x86/boot/x86_32.S= =0A+++ b/xen/arch/x86/boot/x86_32.S=0A@@ -108,3 +108,24 @@ ENTRY(boot_cpu_g= dt_table)=0A .fill (PER_CPU_GDT_ENTRY - FLAT_RING3_DS / 8 - 1), 8, = 0=0A .quad 0x0000910000000000 /* per-CPU entry (limit =3D=3D = cpu) */=0A .align PAGE_SIZE,0=0A+=0A+#define PAGE_HYPERVISOR = __PAGE_HYPERVISOR=0A+#define PAGE_HYPERVISOR_NOCACHE __PAGE_HYPERVISOR_NO= CACHE=0A+=0A+/* Mapping of first 16 megabytes of memory. */=0A+ = .globl idle_pg_table_l2=0A+idle_pg_table_l2:=0A+ range =3D 8=0A+ = .irp count, l2_linear_offset(__PAGE_OFFSET), \=0A+ = (4 * L2_PAGETABLE_ENTRIES - l2_linear_offset(__PAGE_OFFSET) - 1)=0A+ = .long sym_phys(l1_identmap) + PAGE_HYPERVISOR, 0=0A+ pfn =3D 1 << = PAGETABLE_ORDER=0A+ .rept range - 1=0A+ .long (pfn << = PAGE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE, 0=0A+ pfn =3D pfn + (1 = << PAGETABLE_ORDER)=0A+ .endr=0A+ .fill \count - range, 8, = 0=0A+ range =3D DIRECTMAP_MBYTES / 2=0A+ .endr=0A+ = .long sym_phys(l1_fixmap) + PAGE_HYPERVISOR, 0=0A+ .size idle_pg_tab= le_l2, . - idle_pg_table_l2=0A--- a/xen/arch/x86/boot/x86_64.S=0A+++ = b/xen/arch/x86/boot/x86_64.S=0A@@ -127,3 +127,15 @@ ENTRY(boot_cpu_compat_g= dt_table)=0A .fill (PER_CPU_GDT_ENTRY - __HYPERVISOR_CS32 / 8 - = 1), 8, 0=0A .quad 0x0000910000000000 /* per-CPU entry (limit = =3D=3D cpu) */=0A .align PAGE_SIZE, 0=0A+=0A+/* Mapping of = first 16 megabytes of memory. */=0A+ .globl l2_identmap=0A+l2_identm= ap:=0A+ .quad 0=0A+ pfn =3D 1 << PAGETABLE_ORDER=0A+ = .rept 7=0A+ .quad (pfn << PAGE_SHIFT) | PAGE_HYPERVISOR | = _PAGE_PSE=0A+ pfn =3D pfn + (1 << PAGETABLE_ORDER)=0A+ = .endr=0A+ .fill 4 * L2_PAGETABLE_ENTRIES - 8, 8, 0=0A+ .size = l2_identmap, . - l2_identmap=0A--- a/xen/arch/x86/efi/boot.c=0A+++ = b/xen/arch/x86/efi/boot.c=0A@@ -1119,8 +1119,6 @@ efi_start(EFI_HANDLE = ImageHandle, EFI_SY=0A unsigned int slot =3D (xen_phys_start >> = L2_PAGETABLE_SHIFT) + i;=0A paddr_t addr =3D slot << L2_PAGETABLE_S= HIFT;=0A =0A- l2_identmap[i] =3D l2e_from_paddr(i << L2_PAGETABLE_SH= IFT,=0A- PAGE_HYPERVISOR|_PAGE_PSE);= =0A l2_identmap[slot] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAG= E_PSE);=0A l2_xenmap[i] =3D l2e_from_paddr(addr, PAGE_HYPERVISOR|_P= AGE_PSE);=0A slot &=3D L2_PAGETABLE_ENTRIES - 1;=0A@@ -1150,16 = +1148,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY=0A l4e_from_pad= dr((UINTN)l3_identmap, __PAGE_HYPERVISOR);=0A idle_pg_table[l4_table_of= fset(XEN_VIRT_START)] =3D=0A l4e_from_paddr((UINTN)l3_xenmap, = __PAGE_HYPERVISOR);=0A- /* Initialize 4kB mappings of first 2MB of = memory. */=0A- for ( i =3D 0; i < L1_PAGETABLE_ENTRIES; ++i )=0A- = {=0A- unsigned int attr =3D PAGE_HYPERVISOR|MAP_SMALL_PAGES;=0A-=0A-= /* VGA hole (0xa0000-0xc0000) should be mapped UC. */=0A- = if ( i >=3D 0xa0 && i < 0xc0 )=0A- attr |=3D _PAGE_PCD;=0A- = l1_identmap[i] =3D l1e_from_pfn(i, attr);=0A- }=0A+ /* Hook 4kB = mappings of first 2MB of memory into L2. */=0A l2_identmap[0] =3D = l2e_from_paddr((UINTN)l1_identmap, __PAGE_HYPERVISOR);=0A =0A if ( gop = )=0A--- a/xen/arch/x86/mm.c=0A+++ b/xen/arch/x86/mm.c=0A@@ -121,15 +121,6 = @@=0A #include =0A #include =0A =0A-/*=0A- * = Mapping of first 2 or 4 megabytes of memory. This is mapped with 4kB=0A- * = mappings to avoid type conflicts with fixed-range MTRRs covering the=0A- * = lowest megabyte of physical memory. In any case the VGA hole should be=0A- = * mapped with type UC.=0A- */=0A-l1_pgentry_t __attribute__ ((__section__ = (".bss.page_aligned")))=0A- l1_identmap[L1_PAGETABLE_ENTRIES];=0A-=0A = /* Mapping of the fixmap space needed early. */=0A l1_pgentry_t __attribute= __ ((__section__ (".bss.page_aligned")))=0A l1_fixmap[L1_PAGETABLE_ENTR= IES];=0A--- a/xen/arch/x86/x86_32/mm.c=0A+++ b/xen/arch/x86/x86_32/mm.c=0A@= @ -31,9 +31,6 @@=0A #include =0A #include =0A= =0A-l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned")))=0A- = idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES];=0A-=0A unsigned int = __read_mostly PAGE_HYPERVISOR =3D __PAGE_HYPERVISOR;=0A unsigned = int __read_mostly PAGE_HYPERVISOR_NOCACHE =3D __PAGE_HYPERVISOR_NOCACHE;=0A= =0A--- a/xen/arch/x86/x86_64/mm.c=0A+++ b/xen/arch/x86/x86_64/mm.c=0A@@ = -56,8 +56,6 @@ l4_pgentry_t __attribute__ ((__section__=0A /* Enough page = directories to map bottom 4GB of the memory map. */=0A l3_pgentry_t = __attribute__ ((__section__ (".bss.page_aligned")))=0A l3_identmap[L3_P= AGETABLE_ENTRIES];=0A-l2_pgentry_t __attribute__ ((__section__ (".bss.page_= aligned")))=0A- l2_identmap[4*L2_PAGETABLE_ENTRIES];=0A =0A /* Enough = page directories to map the Xen text and static data. */=0A l3_pgentry_t = __attribute__ ((__section__ (".bss.page_aligned")))=0A--- a/xen/include/asm= -x86/page.h=0A+++ b/xen/include/asm-x86/page.h=0A@@ -1,15 +1,13 @@=0A = #ifndef __X86_PAGE_H__=0A #define __X86_PAGE_H__=0A =0A+#include =0A+=0A /*=0A * It is important that the masks are signed quantities. = This ensures that=0A * the compiler sign-extends a 32-bit mask to 64 bits = if that is required.=0A */=0A-#ifndef __ASSEMBLY__=0A-#define PAGE_SIZE = (1L << PAGE_SHIFT)=0A-#else=0A-#define PAGE_SIZE (1 << = PAGE_SHIFT)=0A-#endif=0A+#define PAGE_SIZE (_AC(1,L) << = PAGE_SHIFT)=0A #define PAGE_MASK (~(PAGE_SIZE-1))=0A #define = PAGE_FLAG_MASK (~0)=0A =0A@@ -319,21 +317,22 @@ void paging_init(void)= ;=0A void setup_idle_pagetable(void);=0A #endif /* !defined(__ASSEMBLY__) = */=0A =0A-#define _PAGE_PRESENT 0x001U=0A-#define _PAGE_RW = 0x002U=0A-#define _PAGE_USER 0x004U=0A-#define _PAGE_PWT = 0x008U=0A-#define _PAGE_PCD 0x010U=0A-#define _PAGE_ACCESSED = 0x020U=0A-#define _PAGE_DIRTY 0x040U=0A-#define _PAGE_PAT = 0x080U=0A-#define _PAGE_PSE 0x080U=0A-#define _PAGE_GLOBAL = 0x100U=0A-#define _PAGE_AVAIL0 0x200U=0A-#define _PAGE_AVAIL1 = 0x400U=0A-#define _PAGE_AVAIL2 0x800U=0A-#define _PAGE_AVAIL = 0xE00U=0A-#define _PAGE_PSE_PAT 0x1000U=0A+#define _PAGE_PRESENT = _AC(0x001,U)=0A+#define _PAGE_RW _AC(0x002,U)=0A+#define _PAGE_USER = _AC(0x004,U)=0A+#define _PAGE_PWT _AC(0x008,U)=0A+#define = _PAGE_PCD _AC(0x010,U)=0A+#define _PAGE_ACCESSED _AC(0x020,U)=0A+#defi= ne _PAGE_DIRTY _AC(0x040,U)=0A+#define _PAGE_PAT _AC(0x080,U)=0A+#d= efine _PAGE_PSE _AC(0x080,U)=0A+#define _PAGE_GLOBAL _AC(0x100,U)=0A= +#define _PAGE_AVAIL0 _AC(0x200,U)=0A+#define _PAGE_AVAIL1 _AC(0x400,U)= =0A+#define _PAGE_AVAIL2 _AC(0x800,U)=0A+#define _PAGE_AVAIL = _AC(0xE00,U)=0A+#define _PAGE_PSE_PAT _AC(0x1000,U)=0A+/* non-architectural= flags */=0A #define _PAGE_PAGED 0x2000U=0A #define _PAGE_SHARED = 0x4000U=0A =0A@@ -354,6 +353,8 @@ void setup_idle_pagetable(void);=0A = #define __PAGE_HYPERVISOR_NOCACHE \=0A (_PAGE_PRESENT | _PAGE_RW | = _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED)=0A =0A+#define MAP_SMALL_PAGES = _PAGE_AVAIL0 /* don't use superpages mappings */=0A+=0A #ifndef __ASSEMBLY_= _=0A =0A /* Allocator functions for Xen pagetables. */=0A@@ -367,7 +368,6 = @@ l3_pgentry_t *virt_to_xen_l3e(unsigned l=0A extern void set_pdx_range(un= signed long smfn, unsigned long emfn);=0A =0A /* Map machine page range in = Xen virtual address space. */=0A-#define MAP_SMALL_PAGES _PAGE_AVAIL0 /* = don't use superpages for the mapping */=0A int map_pages_to_xen(=0A = unsigned long virt,=0A unsigned long mfn,=0A--- /dev/null=0A+++ = b/xen/include/xen/const.h=0A@@ -0,0 +1,24 @@=0A+/* const.h: Macros for = dealing with constants. */=0A+=0A+#ifndef __XEN_CONST_H__=0A+#define = __XEN_CONST_H__=0A+=0A+/* Some constant macros are used in both assembler = and=0A+ * C code. Therefore we cannot annotate them always with=0A+ * = 'UL' and other type specifiers unilaterally. We=0A+ * use the following = macros to deal with this.=0A+ *=0A+ * Similarly, _AT() will cast an = expression with a type in C, but=0A+ * leave it unchanged in asm.=0A+ = */=0A+=0A+#ifdef __ASSEMBLY__=0A+#define _AC(X,Y) X=0A+#define = _AT(T,X) X=0A+#else=0A+#define __AC(X,Y) (X##Y)=0A+#define _AC(X,Y) = __AC(X,Y)=0A+#define _AT(T,X) ((T)(X))=0A+#endif=0A+=0A+#endif /* = __XEN_CONST_H__ */=0A --=__Part3618CA9D.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part3618CA9D.0__=--