ia64/xen-unstable

changeset 13529:9a0b157a0ab0

[merge] with xen-unstable

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author Christian Limpach <Christian.Limpach@xensource.com>
date Fri Jan 19 15:11:44 2007 +0000 (2007-01-19)
parents 3c8bb086025e e9e327c3e81b
children dcb145f858e3
files extras/mini-os/time.c
line diff
     1.1 --- a/extras/mini-os/arch/x86/mm.c	Fri Jan 19 14:48:57 2007 +0000
     1.2 +++ b/extras/mini-os/arch/x86/mm.c	Fri Jan 19 15:11:44 2007 +0000
     1.3 @@ -61,6 +61,7 @@ void new_pt_frame(unsigned long *pt_pfn,
     1.4      mmu_update_t mmu_updates[1];
     1.5      struct mmuext_op pin_request;
     1.6      
     1.7 +    prot_e = prot_t = pincmd = 0;
     1.8      DEBUG("Allocating new L%d pt frame for pt_pfn=%lx, "
     1.9             "prev_l_mfn=%lx, offset=%lx", 
    1.10             level, *pt_pfn, prev_l_mfn, offset);
     2.1 --- a/extras/mini-os/arch/x86/sched.c	Fri Jan 19 14:48:57 2007 +0000
     2.2 +++ b/extras/mini-os/arch/x86/sched.c	Fri Jan 19 15:11:44 2007 +0000
     2.3 @@ -91,10 +91,11 @@ static void stack_push(struct thread *th
     2.4      *((unsigned long *)thread->sp) = value;
     2.5  }
     2.6  
     2.7 -struct thread* create_thread(char *name, void (*function)(void *), void *data)
     2.8 +/* Architecture specific setup of thread creation */
     2.9 +struct thread* arch_create_thread(char *name, void (*function)(void *),
    2.10 +                                  void *data)
    2.11  {
    2.12      struct thread *thread;
    2.13 -    unsigned long flags;
    2.14      
    2.15      thread = xmalloc(struct thread);
    2.16      /* Allocate 2 pages for stack, stack will be 2pages aligned */
    2.17 @@ -110,24 +111,9 @@ struct thread* create_thread(char *name,
    2.18      stack_push(thread, (unsigned long) function);
    2.19      stack_push(thread, (unsigned long) data);
    2.20      thread->ip = (unsigned long) thread_starter;
    2.21 -     
    2.22 -    /* Not runable, not exited, not sleeping */
    2.23 -    thread->flags = 0;
    2.24 -    thread->wakeup_time = 0LL;
    2.25 -    set_runnable(thread);
    2.26 -    local_irq_save(flags);
    2.27 -    if(idle_thread != NULL) {
    2.28 -        list_add_tail(&thread->thread_list, &idle_thread->thread_list); 
    2.29 -    } else if(function != idle_thread_fn)
    2.30 -    {
    2.31 -        printk("BUG: Not allowed to create thread before initialising scheduler.\n");
    2.32 -        BUG();
    2.33 -    }
    2.34 -    local_irq_restore(flags);
    2.35      return thread;
    2.36  }
    2.37  
    2.38 -
    2.39  void run_idle_thread(void)
    2.40  {
    2.41      /* Switch stacks and run the thread */ 
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/extras/mini-os/arch/x86/time.c	Fri Jan 19 15:11:44 2007 +0000
     3.3 @@ -0,0 +1,225 @@
     3.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
     3.5 + ****************************************************************************
     3.6 + * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
     3.7 + * (C) 2002-2003 - Keir Fraser - University of Cambridge 
     3.8 + * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
     3.9 + * (C) 2006 - Robert Kaiser - FH Wiesbaden
    3.10 + ****************************************************************************
    3.11 + *
    3.12 + *        File: time.c
    3.13 + *      Author: Rolf Neugebauer and Keir Fraser
    3.14 + *     Changes: Grzegorz Milos
    3.15 + *
    3.16 + * Description: Simple time and timer functions
    3.17 + *
    3.18 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    3.19 + * of this software and associated documentation files (the "Software"), to
    3.20 + * deal in the Software without restriction, including without limitation the
    3.21 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    3.22 + * sell copies of the Software, and to permit persons to whom the Software is
    3.23 + * furnished to do so, subject to the following conditions:
    3.24 + * 
    3.25 + * The above copyright notice and this permission notice shall be included in
    3.26 + * all copies or substantial portions of the Software.
    3.27 + * 
    3.28 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
    3.29 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    3.30 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
    3.31 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
    3.32 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
    3.33 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
    3.34 + * DEALINGS IN THE SOFTWARE.
    3.35 + */
    3.36 +
    3.37 +
    3.38 +#include <os.h>
    3.39 +#include <traps.h>
    3.40 +#include <types.h>
    3.41 +#include <hypervisor.h>
    3.42 +#include <events.h>
    3.43 +#include <time.h>
    3.44 +#include <lib.h>
    3.45 +
    3.46 +/************************************************************************
    3.47 + * Time functions
    3.48 + *************************************************************************/
    3.49 +
    3.50 +/* These are peridically updated in shared_info, and then copied here. */
    3.51 +struct shadow_time_info {
    3.52 +	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
    3.53 +	u64 system_timestamp;  /* Time, in nanosecs, since boot.    */
    3.54 +	u32 tsc_to_nsec_mul;
    3.55 +	u32 tsc_to_usec_mul;
    3.56 +	int tsc_shift;
    3.57 +	u32 version;
    3.58 +};
    3.59 +static struct timespec shadow_ts;
    3.60 +static u32 shadow_ts_version;
    3.61 +
    3.62 +static struct shadow_time_info shadow;
    3.63 +
    3.64 +
    3.65 +#ifndef rmb
    3.66 +#define rmb()  __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
    3.67 +#endif
    3.68 +
    3.69 +#define HANDLE_USEC_OVERFLOW(_tv)          \
    3.70 +    do {                                   \
    3.71 +        while ( (_tv)->tv_usec >= 1000000 ) \
    3.72 +        {                                  \
    3.73 +            (_tv)->tv_usec -= 1000000;      \
    3.74 +            (_tv)->tv_sec++;                \
    3.75 +        }                                  \
    3.76 +    } while ( 0 )
    3.77 +
    3.78 +static inline int time_values_up_to_date(void)
    3.79 +{
    3.80 +	struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time; 
    3.81 +
    3.82 +	return (shadow.version == src->version);
    3.83 +}
    3.84 +
    3.85 +
    3.86 +/*
    3.87 + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
    3.88 + * yielding a 64-bit result.
    3.89 + */
    3.90 +static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
    3.91 +{
    3.92 +	u64 product;
    3.93 +#ifdef __i386__
    3.94 +	u32 tmp1, tmp2;
    3.95 +#endif
    3.96 +
    3.97 +	if ( shift < 0 )
    3.98 +		delta >>= -shift;
    3.99 +	else
   3.100 +		delta <<= shift;
   3.101 +
   3.102 +#ifdef __i386__
   3.103 +	__asm__ (
   3.104 +		"mul  %5       ; "
   3.105 +		"mov  %4,%%eax ; "
   3.106 +		"mov  %%edx,%4 ; "
   3.107 +		"mul  %5       ; "
   3.108 +		"add  %4,%%eax ; "
   3.109 +		"xor  %5,%5    ; "
   3.110 +		"adc  %5,%%edx ; "
   3.111 +		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
   3.112 +		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
   3.113 +#else
   3.114 +	__asm__ (
   3.115 +		"mul %%rdx ; shrd $32,%%rdx,%%rax"
   3.116 +		: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
   3.117 +#endif
   3.118 +
   3.119 +	return product;
   3.120 +}
   3.121 +
   3.122 +
   3.123 +static unsigned long get_nsec_offset(void)
   3.124 +{
   3.125 +	u64 now, delta;
   3.126 +	rdtscll(now);
   3.127 +	delta = now - shadow.tsc_timestamp;
   3.128 +	return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift);
   3.129 +}
   3.130 +
   3.131 +
   3.132 +static void get_time_values_from_xen(void)
   3.133 +{
   3.134 +	struct vcpu_time_info    *src = &HYPERVISOR_shared_info->vcpu_info[0].time;
   3.135 +
   3.136 + 	do {
   3.137 +		shadow.version = src->version;
   3.138 +		rmb();
   3.139 +		shadow.tsc_timestamp     = src->tsc_timestamp;
   3.140 +		shadow.system_timestamp  = src->system_time;
   3.141 +		shadow.tsc_to_nsec_mul   = src->tsc_to_system_mul;
   3.142 +		shadow.tsc_shift         = src->tsc_shift;
   3.143 +		rmb();
   3.144 +	}
   3.145 +	while ((src->version & 1) | (shadow.version ^ src->version));
   3.146 +
   3.147 +	shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000;
   3.148 +}
   3.149 +
   3.150 +
   3.151 +
   3.152 +
   3.153 +/* monotonic_clock(): returns # of nanoseconds passed since time_init()
   3.154 + *		Note: This function is required to return accurate
   3.155 + *		time even in the absence of multiple timer ticks.
   3.156 + */
   3.157 +u64 monotonic_clock(void)
   3.158 +{
   3.159 +	u64 time;
   3.160 +	u32 local_time_version;
   3.161 +
   3.162 +	do {
   3.163 +		local_time_version = shadow.version;
   3.164 +		rmb();
   3.165 +		time = shadow.system_timestamp + get_nsec_offset();
   3.166 +        if (!time_values_up_to_date())
   3.167 +			get_time_values_from_xen();
   3.168 +		rmb();
   3.169 +	} while (local_time_version != shadow.version);
   3.170 +
   3.171 +	return time;
   3.172 +}
   3.173 +
   3.174 +static void update_wallclock(void)
   3.175 +{
   3.176 +	shared_info_t *s = HYPERVISOR_shared_info;
   3.177 +
   3.178 +	do {
   3.179 +		shadow_ts_version = s->wc_version;
   3.180 +		rmb();
   3.181 +		shadow_ts.ts_sec  = s->wc_sec;
   3.182 +		shadow_ts.ts_nsec = s->wc_nsec;
   3.183 +		rmb();
   3.184 +	}
   3.185 +	while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version));
   3.186 +}
   3.187 +
   3.188 +
   3.189 +void gettimeofday(struct timeval *tv)
   3.190 +{
   3.191 +    u64 nsec = monotonic_clock();
   3.192 +    nsec += shadow_ts.ts_nsec;
   3.193 +    
   3.194 +    
   3.195 +    tv->tv_sec = shadow_ts.ts_sec;
   3.196 +    tv->tv_sec += NSEC_TO_SEC(nsec);
   3.197 +    tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL);
   3.198 +}
   3.199 +
   3.200 +
   3.201 +void block_domain(s_time_t until)
   3.202 +{
   3.203 +    struct timeval tv;
   3.204 +    gettimeofday(&tv);
   3.205 +    if(monotonic_clock() < until)
   3.206 +    {
   3.207 +        HYPERVISOR_set_timer_op(until);
   3.208 +        HYPERVISOR_sched_op(SCHEDOP_block, 0);
   3.209 +    }
   3.210 +}
   3.211 +
   3.212 +
   3.213 +/*
   3.214 + * Just a dummy 
   3.215 + */
   3.216 +static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
   3.217 +{
   3.218 +    get_time_values_from_xen();
   3.219 +    update_wallclock();
   3.220 +}
   3.221 +
   3.222 +
   3.223 +
   3.224 +void init_time(void)
   3.225 +{
   3.226 +    printk("Initialising timer interface\n");
   3.227 +    bind_virq(VIRQ_TIMER, &timer_handler, NULL);
   3.228 +}
     4.1 --- a/extras/mini-os/include/sched.h	Fri Jan 19 14:48:57 2007 +0000
     4.2 +++ b/extras/mini-os/include/sched.h	Fri Jan 19 15:11:44 2007 +0000
     4.3 @@ -31,6 +31,9 @@ void idle_thread_fn(void *unused);
     4.4  
     4.5  #define switch_threads(prev, next) arch_switch_threads(prev, next)
     4.6   
     4.7 +    /* Architecture specific setup of thread creation. */
     4.8 +struct thread* arch_create_thread(char *name, void (*function)(void *),
     4.9 +                                  void *data);
    4.10  
    4.11  void init_sched(void);
    4.12  void run_idle_thread(void);
     5.1 --- a/extras/mini-os/lib/math.c	Fri Jan 19 14:48:57 2007 +0000
     5.2 +++ b/extras/mini-os/lib/math.c	Fri Jan 19 15:11:44 2007 +0000
     5.3 @@ -57,6 +57,10 @@
     5.4  
     5.5  #include <types.h>
     5.6  
     5.7 +	/* On ia64 these functions lead to crashes. These are replaced by
     5.8 +	 * assembler functions. */
     5.9 +#if !defined(__ia64__)
    5.10 +
    5.11  /*
    5.12   * Depending on the desired operation, we view a `long long' (aka quad_t) in
    5.13   * one or more of the following formats.
    5.14 @@ -380,3 +384,4 @@ u_quad_t
    5.15          return (r);
    5.16  }
    5.17  
    5.18 +#endif /* !defined(__ia64__) */
     6.1 --- a/extras/mini-os/lib/xmalloc.c	Fri Jan 19 14:48:57 2007 +0000
     6.2 +++ b/extras/mini-os/lib/xmalloc.c	Fri Jan 19 15:11:44 2007 +0000
     6.3 @@ -48,6 +48,12 @@ struct xmalloc_hdr
     6.4      /* Total including this hdr. */
     6.5      size_t size;
     6.6      struct list_head freelist;
     6.7 +#if defined(__ia64__)
     6.8 +		// Needed for ia64 as long as the align parameter in _xmalloc()
     6.9 +		// is not supported.
    6.10 +    uint64_t pad;
    6.11 +#endif
    6.12 +
    6.13  } __cacheline_aligned;
    6.14  
    6.15  static void maybe_split(struct xmalloc_hdr *hdr, size_t size, size_t block)
     7.1 --- a/extras/mini-os/netfront.c	Fri Jan 19 14:48:57 2007 +0000
     7.2 +++ b/extras/mini-os/netfront.c	Fri Jan 19 15:11:44 2007 +0000
     7.3 @@ -327,7 +327,6 @@ done:
     7.4      printk("backend at %s\n",backend);
     7.5      printk("mac is %s\n",mac);
     7.6  
     7.7 -    char *res;
     7.8      char path[256];
     7.9      sprintf(path,"%s/state",backend);
    7.10  
    7.11 @@ -336,7 +335,6 @@ done:
    7.12      xenbus_wait_for_value(path,"4");
    7.13  
    7.14      //free(backend);
    7.15 -    free(res);
    7.16  
    7.17      printk("**************************\n");
    7.18  
     8.1 --- a/extras/mini-os/sched.c	Fri Jan 19 14:48:57 2007 +0000
     8.2 +++ b/extras/mini-os/sched.c	Fri Jan 19 15:11:44 2007 +0000
     8.3 @@ -155,11 +155,27 @@ void schedule(void)
     8.4      if(prev != next) switch_threads(prev, next);
     8.5  }
     8.6  
     8.7 -
     8.8 -/* Gets run when a new thread is scheduled the first time ever, 
     8.9 -   defined in x86_[32/64].S */
    8.10 -extern void thread_starter(void);
    8.11 -
    8.12 +struct thread* create_thread(char *name, void (*function)(void *), void *data)
    8.13 +{
    8.14 +    struct thread *thread;
    8.15 +    unsigned long flags;
    8.16 +    /* Call architecture specific setup. */
    8.17 +    thread = arch_create_thread(name, function, data);
    8.18 +    /* Not runable, not exited, not sleeping */
    8.19 +    thread->flags = 0;
    8.20 +    thread->wakeup_time = 0LL;
    8.21 +    set_runnable(thread);
    8.22 +    local_irq_save(flags);
    8.23 +    if(idle_thread != NULL) {
    8.24 +        list_add_tail(&thread->thread_list, &idle_thread->thread_list); 
    8.25 +    } else if(function != idle_thread_fn)
    8.26 +    {
    8.27 +        printk("BUG: Not allowed to create thread before initialising scheduler.\n");
    8.28 +        BUG();
    8.29 +    }
    8.30 +    local_irq_restore(flags);
    8.31 +    return thread;
    8.32 +}
    8.33  
    8.34  void exit_thread(void)
    8.35  {
     9.1 --- a/extras/mini-os/time.c	Fri Jan 19 14:48:57 2007 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,225 +0,0 @@
     9.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
     9.5 - ****************************************************************************
     9.6 - * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
     9.7 - * (C) 2002-2003 - Keir Fraser - University of Cambridge 
     9.8 - * (C) 2005 - Grzegorz Milos - Intel Research Cambridge
     9.9 - * (C) 2006 - Robert Kaiser - FH Wiesbaden
    9.10 - ****************************************************************************
    9.11 - *
    9.12 - *        File: time.c
    9.13 - *      Author: Rolf Neugebauer and Keir Fraser
    9.14 - *     Changes: Grzegorz Milos
    9.15 - *
    9.16 - * Description: Simple time and timer functions
    9.17 - *
    9.18 - * Permission is hereby granted, free of charge, to any person obtaining a copy
    9.19 - * of this software and associated documentation files (the "Software"), to
    9.20 - * deal in the Software without restriction, including without limitation the
    9.21 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    9.22 - * sell copies of the Software, and to permit persons to whom the Software is
    9.23 - * furnished to do so, subject to the following conditions:
    9.24 - * 
    9.25 - * The above copyright notice and this permission notice shall be included in
    9.26 - * all copies or substantial portions of the Software.
    9.27 - * 
    9.28 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
    9.29 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    9.30 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
    9.31 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
    9.32 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
    9.33 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
    9.34 - * DEALINGS IN THE SOFTWARE.
    9.35 - */
    9.36 -
    9.37 -
    9.38 -#include <os.h>
    9.39 -#include <traps.h>
    9.40 -#include <types.h>
    9.41 -#include <hypervisor.h>
    9.42 -#include <events.h>
    9.43 -#include <time.h>
    9.44 -#include <lib.h>
    9.45 -
    9.46 -/************************************************************************
    9.47 - * Time functions
    9.48 - *************************************************************************/
    9.49 -
    9.50 -/* These are peridically updated in shared_info, and then copied here. */
    9.51 -struct shadow_time_info {
    9.52 -	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
    9.53 -	u64 system_timestamp;  /* Time, in nanosecs, since boot.    */
    9.54 -	u32 tsc_to_nsec_mul;
    9.55 -	u32 tsc_to_usec_mul;
    9.56 -	int tsc_shift;
    9.57 -	u32 version;
    9.58 -};
    9.59 -static struct timespec shadow_ts;
    9.60 -static u32 shadow_ts_version;
    9.61 -
    9.62 -static struct shadow_time_info shadow;
    9.63 -
    9.64 -
    9.65 -#ifndef rmb
    9.66 -#define rmb()  __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
    9.67 -#endif
    9.68 -
    9.69 -#define HANDLE_USEC_OVERFLOW(_tv)          \
    9.70 -    do {                                   \
    9.71 -        while ( (_tv)->tv_usec >= 1000000 ) \
    9.72 -        {                                  \
    9.73 -            (_tv)->tv_usec -= 1000000;      \
    9.74 -            (_tv)->tv_sec++;                \
    9.75 -        }                                  \
    9.76 -    } while ( 0 )
    9.77 -
    9.78 -static inline int time_values_up_to_date(void)
    9.79 -{
    9.80 -	struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time; 
    9.81 -
    9.82 -	return (shadow.version == src->version);
    9.83 -}
    9.84 -
    9.85 -
    9.86 -/*
    9.87 - * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
    9.88 - * yielding a 64-bit result.
    9.89 - */
    9.90 -static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
    9.91 -{
    9.92 -	u64 product;
    9.93 -#ifdef __i386__
    9.94 -	u32 tmp1, tmp2;
    9.95 -#endif
    9.96 -
    9.97 -	if ( shift < 0 )
    9.98 -		delta >>= -shift;
    9.99 -	else
   9.100 -		delta <<= shift;
   9.101 -
   9.102 -#ifdef __i386__
   9.103 -	__asm__ (
   9.104 -		"mul  %5       ; "
   9.105 -		"mov  %4,%%eax ; "
   9.106 -		"mov  %%edx,%4 ; "
   9.107 -		"mul  %5       ; "
   9.108 -		"add  %4,%%eax ; "
   9.109 -		"xor  %5,%5    ; "
   9.110 -		"adc  %5,%%edx ; "
   9.111 -		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
   9.112 -		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
   9.113 -#else
   9.114 -	__asm__ (
   9.115 -		"mul %%rdx ; shrd $32,%%rdx,%%rax"
   9.116 -		: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
   9.117 -#endif
   9.118 -
   9.119 -	return product;
   9.120 -}
   9.121 -
   9.122 -
   9.123 -static unsigned long get_nsec_offset(void)
   9.124 -{
   9.125 -	u64 now, delta;
   9.126 -	rdtscll(now);
   9.127 -	delta = now - shadow.tsc_timestamp;
   9.128 -	return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift);
   9.129 -}
   9.130 -
   9.131 -
   9.132 -static void get_time_values_from_xen(void)
   9.133 -{
   9.134 -	struct vcpu_time_info    *src = &HYPERVISOR_shared_info->vcpu_info[0].time;
   9.135 -
   9.136 - 	do {
   9.137 -		shadow.version = src->version;
   9.138 -		rmb();
   9.139 -		shadow.tsc_timestamp     = src->tsc_timestamp;
   9.140 -		shadow.system_timestamp  = src->system_time;
   9.141 -		shadow.tsc_to_nsec_mul   = src->tsc_to_system_mul;
   9.142 -		shadow.tsc_shift         = src->tsc_shift;
   9.143 -		rmb();
   9.144 -	}
   9.145 -	while ((src->version & 1) | (shadow.version ^ src->version));
   9.146 -
   9.147 -	shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000;
   9.148 -}
   9.149 -
   9.150 -
   9.151 -
   9.152 -
   9.153 -/* monotonic_clock(): returns # of nanoseconds passed since time_init()
   9.154 - *		Note: This function is required to return accurate
   9.155 - *		time even in the absence of multiple timer ticks.
   9.156 - */
   9.157 -u64 monotonic_clock(void)
   9.158 -{
   9.159 -	u64 time;
   9.160 -	u32 local_time_version;
   9.161 -
   9.162 -	do {
   9.163 -		local_time_version = shadow.version;
   9.164 -		rmb();
   9.165 -		time = shadow.system_timestamp + get_nsec_offset();
   9.166 -        if (!time_values_up_to_date())
   9.167 -			get_time_values_from_xen();
   9.168 -		rmb();
   9.169 -	} while (local_time_version != shadow.version);
   9.170 -
   9.171 -	return time;
   9.172 -}
   9.173 -
   9.174 -static void update_wallclock(void)
   9.175 -{
   9.176 -	shared_info_t *s = HYPERVISOR_shared_info;
   9.177 -
   9.178 -	do {
   9.179 -		shadow_ts_version = s->wc_version;
   9.180 -		rmb();
   9.181 -		shadow_ts.ts_sec  = s->wc_sec;
   9.182 -		shadow_ts.ts_nsec = s->wc_nsec;
   9.183 -		rmb();
   9.184 -	}
   9.185 -	while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version));
   9.186 -}
   9.187 -
   9.188 -
   9.189 -void gettimeofday(struct timeval *tv)
   9.190 -{
   9.191 -    u64 nsec = monotonic_clock();
   9.192 -    nsec += shadow_ts.ts_nsec;
   9.193 -    
   9.194 -    
   9.195 -    tv->tv_sec = shadow_ts.ts_sec;
   9.196 -    tv->tv_sec += NSEC_TO_SEC(nsec);
   9.197 -    tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL);
   9.198 -}
   9.199 -
   9.200 -
   9.201 -void block_domain(s_time_t until)
   9.202 -{
   9.203 -    struct timeval tv;
   9.204 -    gettimeofday(&tv);
   9.205 -    if(monotonic_clock() < until)
   9.206 -    {
   9.207 -        HYPERVISOR_set_timer_op(until);
   9.208 -        HYPERVISOR_sched_op(SCHEDOP_block, 0);
   9.209 -    }
   9.210 -}
   9.211 -
   9.212 -
   9.213 -/*
   9.214 - * Just a dummy 
   9.215 - */
   9.216 -static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
   9.217 -{
   9.218 -    get_time_values_from_xen();
   9.219 -    update_wallclock();
   9.220 -}
   9.221 -
   9.222 -
   9.223 -
   9.224 -void init_time(void)
   9.225 -{
   9.226 -    printk("Initialising timer interface\n");
   9.227 -    bind_virq(VIRQ_TIMER, &timer_handler, NULL);
   9.228 -}
    10.1 --- a/extras/mini-os/xenbus/xenbus.c	Fri Jan 19 14:48:57 2007 +0000
    10.2 +++ b/extras/mini-os/xenbus/xenbus.c	Fri Jan 19 15:11:44 2007 +0000
    10.3 @@ -103,7 +103,7 @@ char* xenbus_wait_for_value(const char* 
    10.4  static void xenbus_thread_func(void *ign)
    10.5  {
    10.6      struct xsd_sockmsg msg;
    10.7 -    unsigned prod;
    10.8 +    unsigned prod = 0;
    10.9  
   10.10      for (;;) 
   10.11      {
    11.1 --- a/tools/libxc/xc_domain.c	Fri Jan 19 14:48:57 2007 +0000
    11.2 +++ b/tools/libxc/xc_domain.c	Fri Jan 19 15:11:44 2007 +0000
    11.3 @@ -96,16 +96,19 @@ int xc_vcpu_setaffinity(int xc_handle,
    11.4  {
    11.5      DECLARE_DOMCTL;
    11.6      int ret = -1;
    11.7 +    uint8_t local[sizeof (cpumap)];
    11.8  
    11.9      domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
   11.10      domctl.domain = (domid_t)domid;
   11.11      domctl.u.vcpuaffinity.vcpu    = vcpu;
   11.12  
   11.13 -    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
   11.14 -                         (uint8_t *)&cpumap);
   11.15 +    bitmap_64_to_byte(local, &cpumap, sizeof (cpumap));
   11.16 +
   11.17 +    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
   11.18 +
   11.19      domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
   11.20      
   11.21 -    if ( lock_pages(&cpumap, sizeof(cpumap)) != 0 )
   11.22 +    if ( lock_pages(local, sizeof(local)) != 0 )
   11.23      {
   11.24          PERROR("Could not lock memory for Xen hypercall");
   11.25          goto out;
   11.26 @@ -113,7 +116,7 @@ int xc_vcpu_setaffinity(int xc_handle,
   11.27  
   11.28      ret = do_domctl(xc_handle, &domctl);
   11.29  
   11.30 -    unlock_pages(&cpumap, sizeof(cpumap));
   11.31 +    unlock_pages(local, sizeof(local));
   11.32  
   11.33   out:
   11.34      return ret;
   11.35 @@ -127,16 +130,16 @@ int xc_vcpu_getaffinity(int xc_handle,
   11.36  {
   11.37      DECLARE_DOMCTL;
   11.38      int ret = -1;
   11.39 +    uint8_t local[sizeof (cpumap)];
   11.40  
   11.41      domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
   11.42      domctl.domain = (domid_t)domid;
   11.43      domctl.u.vcpuaffinity.vcpu = vcpu;
   11.44  
   11.45 -    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
   11.46 -                         (uint8_t *)cpumap);
   11.47 -    domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
   11.48 +    set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
   11.49 +    domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
   11.50      
   11.51 -    if ( lock_pages(cpumap, sizeof(*cpumap)) != 0 )
   11.52 +    if ( lock_pages(local, sizeof(local)) != 0 )
   11.53      {
   11.54          PERROR("Could not lock memory for Xen hypercall");
   11.55          goto out;
   11.56 @@ -144,8 +147,8 @@ int xc_vcpu_getaffinity(int xc_handle,
   11.57  
   11.58      ret = do_domctl(xc_handle, &domctl);
   11.59  
   11.60 -    unlock_pages(cpumap, sizeof(*cpumap));
   11.61 -
   11.62 +    unlock_pages(local, sizeof (local));
   11.63 +    bitmap_byte_to_64(cpumap, local, sizeof (local));
   11.64   out:
   11.65      return ret;
   11.66  }
    12.1 --- a/tools/libxc/xc_load_elf.c	Fri Jan 19 14:48:57 2007 +0000
    12.2 +++ b/tools/libxc/xc_load_elf.c	Fri Jan 19 15:11:44 2007 +0000
    12.3 @@ -177,7 +177,7 @@ static unsigned long long xen_guest_nume
    12.4  /*
    12.5   * Interface to the Xen ELF notes.
    12.6   */
    12.7 -#define ELFNOTE_NAME(_n_)   ((const void*)(_n_) + sizeof(*(_n_)))
    12.8 +#define ELFNOTE_NAME(_n_)   ((const char*)(_n_) + sizeof(*(_n_)))
    12.9  #define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
   12.10  #define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
   12.11  
   12.12 @@ -190,7 +190,7 @@ static int is_xen_elfnote_section(const 
   12.13  
   12.14      for ( note = (const Elf_Note *)(image + shdr->sh_offset);
   12.15            note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
   12.16 -          note = ELFNOTE_NEXT(note) )
   12.17 +          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
   12.18      {
   12.19          if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
   12.20              return 1;
   12.21 @@ -209,7 +209,7 @@ static const Elf_Note *xen_elfnote_looku
   12.22  
   12.23      for ( note = (const Elf_Note *)dsi->__elfnote_section;
   12.24            note < (const Elf_Note *)dsi->__elfnote_section_end;
   12.25 -          note = ELFNOTE_NEXT(note) )
   12.26 +          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
   12.27      {
   12.28          if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
   12.29              continue;
   12.30 @@ -338,9 +338,9 @@ static int parseelfimage(const char *ima
   12.31              image + ehdr->e_shoff + (h*ehdr->e_shentsize));
   12.32          if ( !is_xen_elfnote_section(image, shdr) )
   12.33              continue;
   12.34 -        dsi->__elfnote_section = (const void *)image + shdr->sh_offset;
   12.35 +        dsi->__elfnote_section = (const char *)image + shdr->sh_offset;
   12.36          dsi->__elfnote_section_end =
   12.37 -            (const void *)image + shdr->sh_offset + shdr->sh_size;
   12.38 +            (const char *)image + shdr->sh_offset + shdr->sh_size;
   12.39          break;
   12.40      }
   12.41  
    13.1 --- a/tools/libxc/xc_private.c	Fri Jan 19 14:48:57 2007 +0000
    13.2 +++ b/tools/libxc/xc_private.c	Fri Jan 19 15:11:44 2007 +0000
    13.3 @@ -502,6 +502,37 @@ char *safe_strerror(int errcode)
    13.4      return errbuf;
    13.5  }
    13.6  
    13.7 +void bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, int nbits)
    13.8 +{
    13.9 +    uint64_t l;
   13.10 +    int i, j, b;
   13.11 +
   13.12 +    for (i = 0, b = 0; nbits > 0; i++, b += sizeof(l)) {
   13.13 +        l = lp[i];
   13.14 +        for (j = 0; (j < sizeof(l)) && (nbits > 0); j++) {
   13.15 +            bp[b+j] = l;
   13.16 +            l >>= 8;
   13.17 +            nbits -= 8;
   13.18 +        }
   13.19 +    }
   13.20 +}
   13.21 +
   13.22 +void bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, int nbits)
   13.23 +{
   13.24 +    uint64_t l;
   13.25 +    int i, j, b;
   13.26 +
   13.27 +    for (i = 0, b = 0; nbits > 0; i++, b += sizeof(l)) {
   13.28 +        l = 0;
   13.29 +        for (j = 0; (j < sizeof(l)) && (nbits > 0); j++) {
   13.30 +            l <<= 8;
   13.31 +            l |= bp[b+j];
   13.32 +            nbits -= 8;
   13.33 +        }
   13.34 +        lp[i] = l;
   13.35 +    }
   13.36 +}
   13.37 +
   13.38  /*
   13.39   * Local variables:
   13.40   * mode: C
    14.1 --- a/tools/libxc/xc_private.h	Fri Jan 19 14:48:57 2007 +0000
    14.2 +++ b/tools/libxc/xc_private.h	Fri Jan 19 15:11:44 2007 +0000
    14.3 @@ -155,4 +155,7 @@ void *map_domain_va_core(unsigned long d
    14.4  int xc_waitdomain_core(int xc_handle, int domain, int *status,
    14.5      int options, vcpu_guest_context_t *ctxt);
    14.6  
    14.7 +void bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, int nbits);
    14.8 +void bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, int nbits);
    14.9 +
   14.10  #endif /* __XC_PRIVATE_H__ */
    15.1 --- a/tools/libxc/xc_tbuf.c	Fri Jan 19 14:48:57 2007 +0000
    15.2 +++ b/tools/libxc/xc_tbuf.c	Fri Jan 19 15:11:44 2007 +0000
    15.3 @@ -96,15 +96,19 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
    15.4  {
    15.5      DECLARE_SYSCTL;
    15.6      int ret = -1;
    15.7 +    uint64_t mask64 = mask;
    15.8 +    uint8_t bytemap[sizeof(mask64)];
    15.9  
   15.10      sysctl.cmd = XEN_SYSCTL_tbuf_op;
   15.11      sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
   15.12      sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_set_cpu_mask;
   15.13  
   15.14 -    set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask);
   15.15 -    sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8;
   15.16 +    bitmap_64_to_byte(bytemap, &mask64, sizeof (mask64));
   15.17  
   15.18 -    if ( lock_pages(&mask, sizeof(mask)) != 0 )
   15.19 +    set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, bytemap);
   15.20 +    sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(bytemap) * 8;
   15.21 +
   15.22 +    if ( lock_pages(&bytemap, sizeof(bytemap)) != 0 )
   15.23      {
   15.24          PERROR("Could not lock memory for Xen hypercall");
   15.25          goto out;
   15.26 @@ -112,7 +116,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
   15.27  
   15.28      ret = do_sysctl(xc_handle, &sysctl);
   15.29  
   15.30 -    unlock_pages(&mask, sizeof(mask));
   15.31 +    unlock_pages(&bytemap, sizeof(bytemap));
   15.32  
   15.33   out:
   15.34      return ret;
    16.1 --- a/tools/xcutils/readnotes.c	Fri Jan 19 14:48:57 2007 +0000
    16.2 +++ b/tools/xcutils/readnotes.c	Fri Jan 19 15:11:44 2007 +0000
    16.3 @@ -13,7 +13,7 @@
    16.4  
    16.5  #include <xen/elfnote.h>
    16.6  
    16.7 -#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_)))
    16.8 +#define ELFNOTE_NAME(_n_) ((char*)(_n_) + sizeof(*(_n_)))
    16.9  #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + (((_n_)->n_namesz+3)&~3))
   16.10  #define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + (((_n_)->n_descsz+3)&~3))
   16.11  
    17.1 --- a/xen/common/bitmap.c	Fri Jan 19 14:48:57 2007 +0000
    17.2 +++ b/xen/common/bitmap.c	Fri Jan 19 15:11:44 2007 +0000
    17.3 @@ -10,6 +10,7 @@
    17.4  #include <xen/errno.h>
    17.5  #include <xen/bitmap.h>
    17.6  #include <xen/bitops.h>
    17.7 +#include <asm/byteorder.h>
    17.8  
    17.9  /*
   17.10   * bitmaps provide an array of bits, implemented using an an
   17.11 @@ -467,3 +468,53 @@ int bitmap_allocate_region(unsigned long
   17.12  	return 0;
   17.13  }
   17.14  EXPORT_SYMBOL(bitmap_allocate_region);
   17.15 +
   17.16 +#ifdef __BIG_ENDIAN
   17.17 +
   17.18 +void bitmap_long_to_byte(uint8_t *bp, const unsigned long *lp, int nbits)
   17.19 +{
   17.20 +	unsigned long l;
   17.21 +	int i, j, b;
   17.22 +
   17.23 +	for (i = 0, b = 0; nbits > 0; i++, b += sizeof(l)) {
   17.24 +		l = lp[i];
   17.25 +		for (j = 0; (j < sizeof(l)) && (nbits > 0); j++) {
   17.26 +			bp[b+j] = l;
   17.27 +			l >>= 8;
   17.28 +			nbits -= 8;
   17.29 +		}
   17.30 +	}
   17.31 +}
   17.32 +
   17.33 +void bitmap_byte_to_long(unsigned long *lp, const uint8_t *bp, int nbits)
   17.34 +{
   17.35 +	unsigned long l;
   17.36 +	int i, j, b;
   17.37 +
   17.38 +	for (i = 0, b = 0; nbits > 0; i++, b += sizeof(l)) {
   17.39 +		l = 0;
   17.40 +		for (j = 0; (j < sizeof(l)) && (nbits > 0); j++) {
   17.41 +			l <<= 8;
   17.42 +			l |= bp[b+j];
   17.43 +			nbits -= 8;
   17.44 +		}
   17.45 +		lp[i] = l;
   17.46 +	}
   17.47 +}
   17.48 +
   17.49 +#elif defined(__LITTLE_ENDIAN)
   17.50 +
   17.51 +void bitmap_long_to_byte(uint8_t *bp, const unsigned long *lp, int nbits)
   17.52 +{
   17.53 +	memcpy(bp, lp, (nbits+7)/8);
   17.54 +}
   17.55 +
   17.56 +void bitmap_byte_to_long(unsigned long *lp, const uint8_t *bp, int nbits)
   17.57 +{
   17.58 +	/* We may need to pad the final longword with zeroes. */
   17.59 +	if (nbits & (BITS_PER_LONG-1))
   17.60 +		lp[BITS_TO_LONGS(nbits)-1] = 0;
   17.61 +	memcpy(lp, bp, (nbits+7)/8);
   17.62 +}
   17.63 +
   17.64 +#endif
    18.1 --- a/xen/common/domctl.c	Fri Jan 19 14:48:57 2007 +0000
    18.2 +++ b/xen/common/domctl.c	Fri Jan 19 15:11:44 2007 +0000
    18.3 @@ -18,6 +18,7 @@
    18.4  #include <xen/console.h>
    18.5  #include <xen/iocap.h>
    18.6  #include <xen/guest_access.h>
    18.7 +#include <xen/bitmap.h>
    18.8  #ifdef CONFIG_COMPAT
    18.9  #include <xen/compat.h>
   18.10  #endif
   18.11 @@ -40,16 +41,17 @@ void cpumask_to_xenctl_cpumap(
   18.12  {
   18.13      unsigned int guest_bytes, copy_bytes, i;
   18.14      uint8_t zero = 0;
   18.15 +    uint8_t bytemap[(NR_CPUS + 7) / 8];
   18.16  
   18.17      if ( guest_handle_is_null(xenctl_cpumap->bitmap) )
   18.18          return;
   18.19  
   18.20      guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
   18.21 -    copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
   18.22 +    copy_bytes  = min_t(unsigned int, guest_bytes, sizeof(bytemap));
   18.23  
   18.24 -    copy_to_guest(xenctl_cpumap->bitmap,
   18.25 -                  (uint8_t *)cpus_addr(*cpumask),
   18.26 -                  copy_bytes);
   18.27 +    bitmap_long_to_byte(bytemap, cpus_addr(*cpumask), NR_CPUS);
   18.28 +
   18.29 +    copy_to_guest(xenctl_cpumap->bitmap, &bytemap[0], copy_bytes);
   18.30  
   18.31      for ( i = copy_bytes; i < guest_bytes; i++ )
   18.32          copy_to_guest_offset(xenctl_cpumap->bitmap, i, &zero, 1);
   18.33 @@ -59,18 +61,19 @@ void xenctl_cpumap_to_cpumask(
   18.34      cpumask_t *cpumask, struct xenctl_cpumap *xenctl_cpumap)
   18.35  {
   18.36      unsigned int guest_bytes, copy_bytes;
   18.37 +    uint8_t bytemap[(NR_CPUS + 7) / 8];
   18.38  
   18.39      guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
   18.40 -    copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
   18.41 +    copy_bytes  = min_t(unsigned int, guest_bytes, sizeof(bytemap));
   18.42  
   18.43      cpus_clear(*cpumask);
   18.44  
   18.45      if ( guest_handle_is_null(xenctl_cpumap->bitmap) )
   18.46          return;
   18.47  
   18.48 -    copy_from_guest((uint8_t *)cpus_addr(*cpumask),
   18.49 -                    xenctl_cpumap->bitmap,
   18.50 -                    copy_bytes);
   18.51 +    copy_from_guest(&bytemap[0], xenctl_cpumap->bitmap, copy_bytes);
   18.52 +
   18.53 +    bitmap_byte_to_long(cpus_addr(*cpumask), bytemap, NR_CPUS);
   18.54  }
   18.55  
   18.56  #endif /* COMPAT */
    19.1 --- a/xen/common/elf.c	Fri Jan 19 14:48:57 2007 +0000
    19.2 +++ b/xen/common/elf.c	Fri Jan 19 15:11:44 2007 +0000
    19.3 @@ -102,7 +102,7 @@ static unsigned long long xen_guest_nume
    19.4  /*
    19.5   * Interface to the Xen ELF notes.
    19.6   */
    19.7 -#define ELFNOTE_NAME(_n_)   ((const void*)(_n_) + sizeof(*(_n_)))
    19.8 +#define ELFNOTE_NAME(_n_)   ((const char*)(_n_) + sizeof(*(_n_)))
    19.9  #define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
   19.10  #define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
   19.11  
   19.12 @@ -115,7 +115,7 @@ static int is_xen_elfnote_section(const 
   19.13  
   19.14      for ( note = (const Elf_Note *)(image + shdr->sh_offset);
   19.15            note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
   19.16 -          note = ELFNOTE_NEXT(note) )
   19.17 +          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
   19.18      {
   19.19          if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
   19.20              return 1;
   19.21 @@ -134,7 +134,7 @@ static const Elf_Note *xen_elfnote_looku
   19.22  
   19.23      for ( note = (const Elf_Note *)dsi->__elfnote_section;
   19.24            note < (const Elf_Note *)dsi->__elfnote_section_end;
   19.25 -          note = ELFNOTE_NEXT(note) )
   19.26 +          note = (const Elf_Note *)ELFNOTE_NEXT(note) )
   19.27      {
   19.28          if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
   19.29              continue;
   19.30 @@ -227,9 +227,9 @@ int parseelfimage(struct domain_setup_in
   19.31              image + ehdr->e_shoff + (h*ehdr->e_shentsize));
   19.32          if ( !is_xen_elfnote_section(image, shdr) )
   19.33              continue;
   19.34 -        dsi->__elfnote_section = (const void *)image + shdr->sh_offset;
   19.35 +        dsi->__elfnote_section = (const char *)image + shdr->sh_offset;
   19.36          dsi->__elfnote_section_end =
   19.37 -            (const void *)image + shdr->sh_offset + shdr->sh_size;
   19.38 +            (const char *)image + shdr->sh_offset + shdr->sh_size;
   19.39          break;
   19.40      }
   19.41  
    20.1 --- a/xen/include/xen/bitmap.h	Fri Jan 19 14:48:57 2007 +0000
    20.2 +++ b/xen/include/xen/bitmap.h	Fri Jan 19 15:11:44 2007 +0000
    20.3 @@ -251,6 +251,9 @@ static inline void bitmap_shift_left(uns
    20.4  		__bitmap_shift_left(dst, src, n, nbits);
    20.5  }
    20.6  
    20.7 +void bitmap_long_to_byte(uint8_t *bp, const unsigned long *lp, int nbits);
    20.8 +void bitmap_byte_to_long(unsigned long *lp, const uint8_t *bp, int nbits);
    20.9 +
   20.10  #endif /* __ASSEMBLY__ */
   20.11  
   20.12  #endif /* __XEN_BITMAP_H */