direct-io.hg

changeset 8513:299d6ff8fdb2

Allow HYPERVISOR_VIRT_START/END public definitions to be
used in assembly files. Check that the public and private
definitions of these constants match up at run time.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jan 09 11:31:19 2006 +0100 (2006-01-09)
parents b866ed85fad3
children 8af1199488d3
files xen/arch/x86/boot/x86_32.S xen/arch/x86/setup.c xen/include/asm-x86/config.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/xen.h xen/include/xen/config.h
line diff
     1.1 --- a/xen/arch/x86/boot/x86_32.S	Sat Jan 07 18:17:13 2006 +0100
     1.2 +++ b/xen/arch/x86/boot/x86_32.S	Mon Jan 09 11:31:19 2006 +0100
     1.3 @@ -100,7 +100,7 @@ 1:      mov     %eax,__PAGE_OFFSET>>18(%
     1.4  1:      stosl   /* low mappings cover as much physmem as possible */
     1.5          add     $4,%edi
     1.6          add     $(1<<L2_PAGETABLE_SHIFT),%eax
     1.7 -        cmp     $__HYPERVISOR_VIRT_START+0xe3,%eax
     1.8 +        cmp     $HYPERVISOR_VIRT_START+0xe3,%eax
     1.9          jne     1b
    1.10  #else
    1.11          /* Initialize low and high mappings of all memory with 4MB pages */
    1.12 @@ -113,7 +113,7 @@ 1:      mov     %eax,__PAGE_OFFSET>>20(%
    1.13          jne     1b
    1.14  1:      stosl   /* low mappings cover as much physmem as possible */
    1.15          add     $(1<<L2_PAGETABLE_SHIFT),%eax
    1.16 -        cmp     $__HYPERVISOR_VIRT_START+0xe3,%eax
    1.17 +        cmp     $HYPERVISOR_VIRT_START+0xe3,%eax
    1.18          jne     1b
    1.19  #endif
    1.20          
     2.1 --- a/xen/arch/x86/setup.c	Sat Jan 07 18:17:13 2006 +0100
     2.2 +++ b/xen/arch/x86/setup.c	Mon Jan 09 11:31:19 2006 +0100
     2.3 @@ -343,6 +343,12 @@ void __init __start_xen(multiboot_info_t
     2.4      BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     2.5      BUG_ON(sizeof(vcpu_info_t) != 64);
     2.6  
     2.7 +    /* __foo are defined in public headers. Check they match internal defs. */
     2.8 +    BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
     2.9 +#ifdef HYPERVISOR_VIRT_END
    2.10 +    BUG_ON(__HYPERVISOR_VIRT_END   != HYPERVISOR_VIRT_END);
    2.11 +#endif
    2.12 +
    2.13      init_frametable();
    2.14  
    2.15      end_boot_allocator();
     3.1 --- a/xen/include/asm-x86/config.h	Sat Jan 07 18:17:13 2006 +0100
     3.2 +++ b/xen/include/asm-x86/config.h	Mon Jan 09 11:31:19 2006 +0100
     3.3 @@ -248,12 +248,10 @@ extern unsigned long _end; /* standard E
     3.4  
     3.5  #ifdef CONFIG_X86_PAE
     3.6  /* Hypervisor owns top 168MB of virtual address space. */
     3.7 -# define __HYPERVISOR_VIRT_START  0xF5800000
     3.8 -# define HYPERVISOR_VIRT_START   (0xF5800000UL)
     3.9 +#define HYPERVISOR_VIRT_START   mk_unsigned_long(0xF5800000)
    3.10  #else
    3.11  /* Hypervisor owns top 64MB of virtual address space. */
    3.12 -# define __HYPERVISOR_VIRT_START  0xFC000000
    3.13 -# define HYPERVISOR_VIRT_START   (0xFC000000UL)
    3.14 +#define HYPERVISOR_VIRT_START   mk_unsigned_long(0xFC000000)
    3.15  #endif
    3.16  
    3.17  #define L2_PAGETABLE_FIRST_XEN_SLOT \
     4.1 --- a/xen/include/public/arch-x86_32.h	Sat Jan 07 18:17:13 2006 +0100
     4.2 +++ b/xen/include/public/arch-x86_32.h	Mon Jan 09 11:31:19 2006 +0100
     4.3 @@ -49,10 +49,15 @@
     4.4   * machine->physical mapping table starts at this address, read-only.
     4.5   */
     4.6  #ifdef CONFIG_X86_PAE
     4.7 -# define HYPERVISOR_VIRT_START (0xF5800000UL)
     4.8 +#define __HYPERVISOR_VIRT_START 0xF5800000
     4.9  #else
    4.10 -# define HYPERVISOR_VIRT_START (0xFC000000UL)
    4.11 +#define __HYPERVISOR_VIRT_START 0xFC000000
    4.12  #endif
    4.13 +
    4.14 +#ifndef HYPERVISOR_VIRT_START
    4.15 +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
    4.16 +#endif
    4.17 +
    4.18  #ifndef machine_to_phys_mapping
    4.19  #define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
    4.20  #endif
    4.21 @@ -137,7 +142,7 @@ typedef struct {
    4.22      unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
    4.23  } arch_vcpu_info_t;
    4.24  
    4.25 -#endif
    4.26 +#endif /* !__ASSEMBLY__ */
    4.27  
    4.28  #endif
    4.29  
     5.1 --- a/xen/include/public/arch-x86_64.h	Sat Jan 07 18:17:13 2006 +0100
     5.2 +++ b/xen/include/public/arch-x86_64.h	Mon Jan 09 11:31:19 2006 +0100
     5.3 @@ -59,9 +59,12 @@
     5.4  /* And the trap vector is... */
     5.5  #define TRAP_INSTR "syscall"
     5.6  
     5.7 +#define __HYPERVISOR_VIRT_START 0xFFFF800000000000
     5.8 +#define __HYPERVISOR_VIRT_END   0xFFFF880000000000
     5.9 +
    5.10  #ifndef HYPERVISOR_VIRT_START
    5.11 -#define HYPERVISOR_VIRT_START (0xFFFF800000000000UL)
    5.12 -#define HYPERVISOR_VIRT_END   (0xFFFF880000000000UL)
    5.13 +#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
    5.14 +#define HYPERVISOR_VIRT_END   mk_unsigned_long(__HYPERVISOR_VIRT_END)
    5.15  #endif
    5.16  
    5.17  /* Maximum number of virtual CPUs in multi-processor guests. */
     6.1 --- a/xen/include/public/xen.h	Sat Jan 07 18:17:13 2006 +0100
     6.2 +++ b/xen/include/public/xen.h	Mon Jan 09 11:31:19 2006 +0100
     6.3 @@ -426,6 +426,15 @@ typedef uint64_t cpumap_t;
     6.4  
     6.5  typedef uint8_t xen_domain_handle_t[16];
     6.6  
     6.7 +/* Turn a plain number into a C unsigned long constant. */
     6.8 +#define __mk_unsigned_long(x) x ## UL
     6.9 +#define mk_unsigned_long(x) __mk_unsigned_long(x)
    6.10 +
    6.11 +#else /* __ASSEMBLY__ */
    6.12 +
    6.13 +/* In assembly code we cannot use C numeric constant suffixes. */
    6.14 +#define mk_unsigned_long(x) x
    6.15 +
    6.16  #endif /* !__ASSEMBLY__ */
    6.17  
    6.18  #endif /* __XEN_PUBLIC_XEN_H__ */
     7.1 --- a/xen/include/xen/config.h	Sat Jan 07 18:17:13 2006 +0100
     7.2 +++ b/xen/include/xen/config.h	Mon Jan 09 11:31:19 2006 +0100
     7.3 @@ -43,4 +43,13 @@
     7.4  #define __STR(...) #__VA_ARGS__
     7.5  #define STR(...) __STR(__VA_ARGS__)
     7.6  
     7.7 +#ifndef __ASSEMBLY__
     7.8 +/* Turn a plain number into a C unsigned long constant. */
     7.9 +#define __mk_unsigned_long(x) x ## UL
    7.10 +#define mk_unsigned_long(x) __mk_unsigned_long(x)
    7.11 +#else /* __ASSEMBLY__ */
    7.12 +/* In assembly code we cannot use C numeric constant suffixes. */
    7.13 +#define mk_unsigned_long(x) x
    7.14 +#endif /* !__ASSEMBLY__ */
    7.15 +
    7.16  #endif /* __XEN_CONFIG_H__ */