ia64/xen-unstable

changeset 11606:1824ee11fc53

[IA64] pickled code fix

Do the pickling based on xen_heap_start, rather than __va/__pa. The
__va/__pa approach doesn't work as some systems do not have their heap
located within the 4GB window.

Signed-off-by: Jes Sorensen <jes@sgi.com>
author awilliam@xenbuild.aw
date Sun Sep 24 14:01:35 2006 -0600 (2006-09-24)
parents 432f978d1cd1
children 5292d57b0771
files xen/arch/ia64/xen/xensetup.c xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/xen/arch/ia64/xen/xensetup.c	Sun Sep 24 13:10:13 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/xensetup.c	Sun Sep 24 14:01:35 2006 -0600
     1.3 @@ -84,6 +84,7 @@ unsigned int opt_xenheap_megabytes = XEN
     1.4  unsigned long xenheap_size = XENHEAP_DEFAULT_SIZE;
     1.5  extern long running_on_sim;
     1.6  unsigned long xen_pstart;
     1.7 +void *xen_heap_start;
     1.8  
     1.9  static int
    1.10  xen_count_pages(u64 start, u64 end, void *arg)
    1.11 @@ -245,7 +246,6 @@ md_overlaps(efi_memory_desc_t *md, unsig
    1.12  void start_kernel(void)
    1.13  {
    1.14      char *cmdline;
    1.15 -    void *heap_start;
    1.16      unsigned long nr_pages;
    1.17      unsigned long dom0_memory_start, dom0_memory_size;
    1.18      unsigned long dom0_initrd_start, dom0_initrd_size;
    1.19 @@ -392,10 +392,10 @@ void start_kernel(void)
    1.20      printf("find_memory: efi_memmap_walk returns max_page=%lx\n",max_page);
    1.21      efi_print();
    1.22  
    1.23 -    heap_start = memguard_init(ia64_imva(&_end));
    1.24 -    printf("Before heap_start: %p\n", heap_start);
    1.25 -    heap_start = __va(init_boot_allocator(__pa(heap_start)));
    1.26 -    printf("After heap_start: %p\n", heap_start);
    1.27 +    xen_heap_start = memguard_init(ia64_imva(&_end));
    1.28 +    printf("Before xen_heap_start: %p\n", xen_heap_start);
    1.29 +    xen_heap_start = __va(init_boot_allocator(__pa(xen_heap_start)));
    1.30 +    printf("After xen_heap_start: %p\n", xen_heap_start);
    1.31  
    1.32      efi_memmap_walk(filter_rsvd_memory, init_boot_pages);
    1.33      efi_memmap_walk(xen_count_pages, &nr_pages);
    1.34 @@ -413,10 +413,10 @@ void start_kernel(void)
    1.35  
    1.36      end_boot_allocator();
    1.37  
    1.38 -    init_xenheap_pages(__pa(heap_start), xenheap_phys_end);
    1.39 +    init_xenheap_pages(__pa(xen_heap_start), xenheap_phys_end);
    1.40      printk("Xen heap: %luMB (%lukB)\n",
    1.41 -	(xenheap_phys_end-__pa(heap_start)) >> 20,
    1.42 -	(xenheap_phys_end-__pa(heap_start)) >> 10);
    1.43 +	(xenheap_phys_end-__pa(xen_heap_start)) >> 20,
    1.44 +	(xenheap_phys_end-__pa(xen_heap_start)) >> 10);
    1.45  
    1.46      late_setup_arch(&cmdline);
    1.47  
     2.1 --- a/xen/include/asm-ia64/mm.h	Sun Sep 24 13:10:13 2006 -0600
     2.2 +++ b/xen/include/asm-ia64/mm.h	Sun Sep 24 14:01:35 2006 -0600
     2.3 @@ -117,10 +117,14 @@ struct page_info
     2.4  #define IS_XEN_HEAP_FRAME(_pfn) ((page_to_maddr(_pfn) < xenheap_phys_end) \
     2.5  				 && (page_to_maddr(_pfn) >= xen_pstart))
     2.6  
     2.7 -static inline struct domain *unpickle_domptr(u32 _d)
     2.8 -{ return (_d == 0) ? NULL : __va(_d); }
     2.9 +extern void *xen_heap_start;
    2.10 +#define __pickle(a)	((unsigned long)a - (unsigned long)xen_heap_start)
    2.11 +#define __unpickle(a)	(void *)(a + xen_heap_start)
    2.12 +
    2.13 +static inline struct domain *unpickle_domptr(u64 _d)
    2.14 +{ return (_d == 0) ? NULL : __unpickle(_d); }
    2.15  static inline u32 pickle_domptr(struct domain *_d)
    2.16 -{ return (_d == NULL) ? 0 : (u32)__pa(_d); }
    2.17 +{ return (_d == NULL) ? 0 : (u32)__pickle(_d); }
    2.18  
    2.19  #define page_get_owner(_p)	(unpickle_domptr((_p)->u.inuse._domain))
    2.20  #define page_set_owner(_p, _d)	((_p)->u.inuse._domain = pickle_domptr(_d))