ia64/xen-unstable
changeset 13522:e9e327c3e81b
[MINIOS] More cleanups for the ia64 port.
Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
author | kfraser@localhost.localdomain |
---|---|
date | Fri Jan 19 15:09:39 2007 +0000 (2007-01-19) |
parents | 374688d2db78 |
children | 9a0b157a0ab0 |
files | extras/mini-os/arch/x86/sched.c extras/mini-os/arch/x86/time.c extras/mini-os/include/sched.h extras/mini-os/lib/math.c extras/mini-os/lib/xmalloc.c extras/mini-os/sched.c extras/mini-os/time.c |
line diff
1.1 --- a/extras/mini-os/arch/x86/sched.c Fri Jan 19 15:08:15 2007 +0000 1.2 +++ b/extras/mini-os/arch/x86/sched.c Fri Jan 19 15:09:39 2007 +0000 1.3 @@ -91,10 +91,11 @@ static void stack_push(struct thread *th 1.4 *((unsigned long *)thread->sp) = value; 1.5 } 1.6 1.7 -struct thread* create_thread(char *name, void (*function)(void *), void *data) 1.8 +/* Architecture specific setup of thread creation */ 1.9 +struct thread* arch_create_thread(char *name, void (*function)(void *), 1.10 + void *data) 1.11 { 1.12 struct thread *thread; 1.13 - unsigned long flags; 1.14 1.15 thread = xmalloc(struct thread); 1.16 /* Allocate 2 pages for stack, stack will be 2pages aligned */ 1.17 @@ -110,24 +111,9 @@ struct thread* create_thread(char *name, 1.18 stack_push(thread, (unsigned long) function); 1.19 stack_push(thread, (unsigned long) data); 1.20 thread->ip = (unsigned long) thread_starter; 1.21 - 1.22 - /* Not runable, not exited, not sleeping */ 1.23 - thread->flags = 0; 1.24 - thread->wakeup_time = 0LL; 1.25 - set_runnable(thread); 1.26 - local_irq_save(flags); 1.27 - if(idle_thread != NULL) { 1.28 - list_add_tail(&thread->thread_list, &idle_thread->thread_list); 1.29 - } else if(function != idle_thread_fn) 1.30 - { 1.31 - printk("BUG: Not allowed to create thread before initialising scheduler.\n"); 1.32 - BUG(); 1.33 - } 1.34 - local_irq_restore(flags); 1.35 return thread; 1.36 } 1.37 1.38 - 1.39 void run_idle_thread(void) 1.40 { 1.41 /* Switch stacks and run the thread */
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/extras/mini-os/arch/x86/time.c Fri Jan 19 15:09:39 2007 +0000 2.3 @@ -0,0 +1,225 @@ 2.4 +/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- 2.5 + **************************************************************************** 2.6 + * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge 2.7 + * (C) 2002-2003 - Keir Fraser - University of Cambridge 2.8 + * (C) 2005 - Grzegorz Milos - Intel Research Cambridge 2.9 + * (C) 2006 - Robert Kaiser - FH Wiesbaden 2.10 + **************************************************************************** 2.11 + * 2.12 + * File: time.c 2.13 + * Author: Rolf Neugebauer and Keir Fraser 2.14 + * Changes: Grzegorz Milos 2.15 + * 2.16 + * Description: Simple time and timer functions 2.17 + * 2.18 + * Permission is hereby granted, free of charge, to any person obtaining a copy 2.19 + * of this software and associated documentation files (the "Software"), to 2.20 + * deal in the Software without restriction, including without limitation the 2.21 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 2.22 + * sell copies of the Software, and to permit persons to whom the Software is 2.23 + * furnished to do so, subject to the following conditions: 2.24 + * 2.25 + * The above copyright notice and this permission notice shall be included in 2.26 + * all copies or substantial portions of the Software. 2.27 + * 2.28 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2.29 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2.30 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2.31 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2.32 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2.33 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 2.34 + * DEALINGS IN THE SOFTWARE. 2.35 + */ 2.36 + 2.37 + 2.38 +#include <os.h> 2.39 +#include <traps.h> 2.40 +#include <types.h> 2.41 +#include <hypervisor.h> 2.42 +#include <events.h> 2.43 +#include <time.h> 2.44 +#include <lib.h> 2.45 + 2.46 +/************************************************************************ 2.47 + * Time functions 2.48 + *************************************************************************/ 2.49 + 2.50 +/* These are peridically updated in shared_info, and then copied here. */ 2.51 +struct shadow_time_info { 2.52 + u64 tsc_timestamp; /* TSC at last update of time vals. */ 2.53 + u64 system_timestamp; /* Time, in nanosecs, since boot. */ 2.54 + u32 tsc_to_nsec_mul; 2.55 + u32 tsc_to_usec_mul; 2.56 + int tsc_shift; 2.57 + u32 version; 2.58 +}; 2.59 +static struct timespec shadow_ts; 2.60 +static u32 shadow_ts_version; 2.61 + 2.62 +static struct shadow_time_info shadow; 2.63 + 2.64 + 2.65 +#ifndef rmb 2.66 +#define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") 2.67 +#endif 2.68 + 2.69 +#define HANDLE_USEC_OVERFLOW(_tv) \ 2.70 + do { \ 2.71 + while ( (_tv)->tv_usec >= 1000000 ) \ 2.72 + { \ 2.73 + (_tv)->tv_usec -= 1000000; \ 2.74 + (_tv)->tv_sec++; \ 2.75 + } \ 2.76 + } while ( 0 ) 2.77 + 2.78 +static inline int time_values_up_to_date(void) 2.79 +{ 2.80 + struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time; 2.81 + 2.82 + return (shadow.version == src->version); 2.83 +} 2.84 + 2.85 + 2.86 +/* 2.87 + * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, 2.88 + * yielding a 64-bit result. 2.89 + */ 2.90 +static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift) 2.91 +{ 2.92 + u64 product; 2.93 +#ifdef __i386__ 2.94 + u32 tmp1, tmp2; 2.95 +#endif 2.96 + 2.97 + if ( shift < 0 ) 2.98 + delta >>= -shift; 2.99 + else 2.100 + delta <<= shift; 2.101 + 2.102 +#ifdef __i386__ 2.103 + __asm__ ( 2.104 + "mul %5 ; " 2.105 + "mov %4,%%eax ; " 2.106 + "mov %%edx,%4 ; " 2.107 + "mul %5 ; " 2.108 + "add %4,%%eax ; " 2.109 + "xor %5,%5 ; " 2.110 + "adc %5,%%edx ; " 2.111 + : "=A" (product), "=r" (tmp1), "=r" (tmp2) 2.112 + : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); 2.113 +#else 2.114 + __asm__ ( 2.115 + "mul %%rdx ; shrd $32,%%rdx,%%rax" 2.116 + : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) ); 2.117 +#endif 2.118 + 2.119 + return product; 2.120 +} 2.121 + 2.122 + 2.123 +static unsigned long get_nsec_offset(void) 2.124 +{ 2.125 + u64 now, delta; 2.126 + rdtscll(now); 2.127 + delta = now - shadow.tsc_timestamp; 2.128 + return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift); 2.129 +} 2.130 + 2.131 + 2.132 +static void get_time_values_from_xen(void) 2.133 +{ 2.134 + struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time; 2.135 + 2.136 + do { 2.137 + shadow.version = src->version; 2.138 + rmb(); 2.139 + shadow.tsc_timestamp = src->tsc_timestamp; 2.140 + shadow.system_timestamp = src->system_time; 2.141 + shadow.tsc_to_nsec_mul = src->tsc_to_system_mul; 2.142 + shadow.tsc_shift = src->tsc_shift; 2.143 + rmb(); 2.144 + } 2.145 + while ((src->version & 1) | (shadow.version ^ src->version)); 2.146 + 2.147 + shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000; 2.148 +} 2.149 + 2.150 + 2.151 + 2.152 + 2.153 +/* monotonic_clock(): returns # of nanoseconds passed since time_init() 2.154 + * Note: This function is required to return accurate 2.155 + * time even in the absence of multiple timer ticks. 2.156 + */ 2.157 +u64 monotonic_clock(void) 2.158 +{ 2.159 + u64 time; 2.160 + u32 local_time_version; 2.161 + 2.162 + do { 2.163 + local_time_version = shadow.version; 2.164 + rmb(); 2.165 + time = shadow.system_timestamp + get_nsec_offset(); 2.166 + if (!time_values_up_to_date()) 2.167 + get_time_values_from_xen(); 2.168 + rmb(); 2.169 + } while (local_time_version != shadow.version); 2.170 + 2.171 + return time; 2.172 +} 2.173 + 2.174 +static void update_wallclock(void) 2.175 +{ 2.176 + shared_info_t *s = HYPERVISOR_shared_info; 2.177 + 2.178 + do { 2.179 + shadow_ts_version = s->wc_version; 2.180 + rmb(); 2.181 + shadow_ts.ts_sec = s->wc_sec; 2.182 + shadow_ts.ts_nsec = s->wc_nsec; 2.183 + rmb(); 2.184 + } 2.185 + while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version)); 2.186 +} 2.187 + 2.188 + 2.189 +void gettimeofday(struct timeval *tv) 2.190 +{ 2.191 + u64 nsec = monotonic_clock(); 2.192 + nsec += shadow_ts.ts_nsec; 2.193 + 2.194 + 2.195 + tv->tv_sec = shadow_ts.ts_sec; 2.196 + tv->tv_sec += NSEC_TO_SEC(nsec); 2.197 + tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL); 2.198 +} 2.199 + 2.200 + 2.201 +void block_domain(s_time_t until) 2.202 +{ 2.203 + struct timeval tv; 2.204 + gettimeofday(&tv); 2.205 + if(monotonic_clock() < until) 2.206 + { 2.207 + HYPERVISOR_set_timer_op(until); 2.208 + HYPERVISOR_sched_op(SCHEDOP_block, 0); 2.209 + } 2.210 +} 2.211 + 2.212 + 2.213 +/* 2.214 + * Just a dummy 2.215 + */ 2.216 +static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign) 2.217 +{ 2.218 + get_time_values_from_xen(); 2.219 + update_wallclock(); 2.220 +} 2.221 + 2.222 + 2.223 + 2.224 +void init_time(void) 2.225 +{ 2.226 + printk("Initialising timer interface\n"); 2.227 + bind_virq(VIRQ_TIMER, &timer_handler, NULL); 2.228 +}
3.1 --- a/extras/mini-os/include/sched.h Fri Jan 19 15:08:15 2007 +0000 3.2 +++ b/extras/mini-os/include/sched.h Fri Jan 19 15:09:39 2007 +0000 3.3 @@ -31,6 +31,9 @@ void idle_thread_fn(void *unused); 3.4 3.5 #define switch_threads(prev, next) arch_switch_threads(prev, next) 3.6 3.7 + /* Architecture specific setup of thread creation. */ 3.8 +struct thread* arch_create_thread(char *name, void (*function)(void *), 3.9 + void *data); 3.10 3.11 void init_sched(void); 3.12 void run_idle_thread(void);
4.1 --- a/extras/mini-os/lib/math.c Fri Jan 19 15:08:15 2007 +0000 4.2 +++ b/extras/mini-os/lib/math.c Fri Jan 19 15:09:39 2007 +0000 4.3 @@ -57,6 +57,10 @@ 4.4 4.5 #include <types.h> 4.6 4.7 + /* On ia64 these functions lead to crashes. These are replaced by 4.8 + * assembler functions. */ 4.9 +#if !defined(__ia64__) 4.10 + 4.11 /* 4.12 * Depending on the desired operation, we view a `long long' (aka quad_t) in 4.13 * one or more of the following formats. 4.14 @@ -380,3 +384,4 @@ u_quad_t 4.15 return (r); 4.16 } 4.17 4.18 +#endif /* !defined(__ia64__) */
5.1 --- a/extras/mini-os/lib/xmalloc.c Fri Jan 19 15:08:15 2007 +0000 5.2 +++ b/extras/mini-os/lib/xmalloc.c Fri Jan 19 15:09:39 2007 +0000 5.3 @@ -48,6 +48,12 @@ struct xmalloc_hdr 5.4 /* Total including this hdr. */ 5.5 size_t size; 5.6 struct list_head freelist; 5.7 +#if defined(__ia64__) 5.8 + // Needed for ia64 as long as the align parameter in _xmalloc() 5.9 + // is not supported. 5.10 + uint64_t pad; 5.11 +#endif 5.12 + 5.13 } __cacheline_aligned; 5.14 5.15 static void maybe_split(struct xmalloc_hdr *hdr, size_t size, size_t block)
6.1 --- a/extras/mini-os/sched.c Fri Jan 19 15:08:15 2007 +0000 6.2 +++ b/extras/mini-os/sched.c Fri Jan 19 15:09:39 2007 +0000 6.3 @@ -155,11 +155,27 @@ void schedule(void) 6.4 if(prev != next) switch_threads(prev, next); 6.5 } 6.6 6.7 - 6.8 -/* Gets run when a new thread is scheduled the first time ever, 6.9 - defined in x86_[32/64].S */ 6.10 -extern void thread_starter(void); 6.11 - 6.12 +struct thread* create_thread(char *name, void (*function)(void *), void *data) 6.13 +{ 6.14 + struct thread *thread; 6.15 + unsigned long flags; 6.16 + /* Call architecture specific setup. */ 6.17 + thread = arch_create_thread(name, function, data); 6.18 + /* Not runable, not exited, not sleeping */ 6.19 + thread->flags = 0; 6.20 + thread->wakeup_time = 0LL; 6.21 + set_runnable(thread); 6.22 + local_irq_save(flags); 6.23 + if(idle_thread != NULL) { 6.24 + list_add_tail(&thread->thread_list, &idle_thread->thread_list); 6.25 + } else if(function != idle_thread_fn) 6.26 + { 6.27 + printk("BUG: Not allowed to create thread before initialising scheduler.\n"); 6.28 + BUG(); 6.29 + } 6.30 + local_irq_restore(flags); 6.31 + return thread; 6.32 +} 6.33 6.34 void exit_thread(void) 6.35 {
7.1 --- a/extras/mini-os/time.c Fri Jan 19 15:08:15 2007 +0000 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,225 +0,0 @@ 7.4 -/* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- 7.5 - **************************************************************************** 7.6 - * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge 7.7 - * (C) 2002-2003 - Keir Fraser - University of Cambridge 7.8 - * (C) 2005 - Grzegorz Milos - Intel Research Cambridge 7.9 - * (C) 2006 - Robert Kaiser - FH Wiesbaden 7.10 - **************************************************************************** 7.11 - * 7.12 - * File: time.c 7.13 - * Author: Rolf Neugebauer and Keir Fraser 7.14 - * Changes: Grzegorz Milos 7.15 - * 7.16 - * Description: Simple time and timer functions 7.17 - * 7.18 - * Permission is hereby granted, free of charge, to any person obtaining a copy 7.19 - * of this software and associated documentation files (the "Software"), to 7.20 - * deal in the Software without restriction, including without limitation the 7.21 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7.22 - * sell copies of the Software, and to permit persons to whom the Software is 7.23 - * furnished to do so, subject to the following conditions: 7.24 - * 7.25 - * The above copyright notice and this permission notice shall be included in 7.26 - * all copies or substantial portions of the Software. 7.27 - * 7.28 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 7.29 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 7.30 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7.31 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 7.32 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 7.33 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 7.34 - * DEALINGS IN THE SOFTWARE. 7.35 - */ 7.36 - 7.37 - 7.38 -#include <os.h> 7.39 -#include <traps.h> 7.40 -#include <types.h> 7.41 -#include <hypervisor.h> 7.42 -#include <events.h> 7.43 -#include <time.h> 7.44 -#include <lib.h> 7.45 - 7.46 -/************************************************************************ 7.47 - * Time functions 7.48 - *************************************************************************/ 7.49 - 7.50 -/* These are peridically updated in shared_info, and then copied here. */ 7.51 -struct shadow_time_info { 7.52 - u64 tsc_timestamp; /* TSC at last update of time vals. */ 7.53 - u64 system_timestamp; /* Time, in nanosecs, since boot. */ 7.54 - u32 tsc_to_nsec_mul; 7.55 - u32 tsc_to_usec_mul; 7.56 - int tsc_shift; 7.57 - u32 version; 7.58 -}; 7.59 -static struct timespec shadow_ts; 7.60 -static u32 shadow_ts_version; 7.61 - 7.62 -static struct shadow_time_info shadow; 7.63 - 7.64 - 7.65 -#ifndef rmb 7.66 -#define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") 7.67 -#endif 7.68 - 7.69 -#define HANDLE_USEC_OVERFLOW(_tv) \ 7.70 - do { \ 7.71 - while ( (_tv)->tv_usec >= 1000000 ) \ 7.72 - { \ 7.73 - (_tv)->tv_usec -= 1000000; \ 7.74 - (_tv)->tv_sec++; \ 7.75 - } \ 7.76 - } while ( 0 ) 7.77 - 7.78 -static inline int time_values_up_to_date(void) 7.79 -{ 7.80 - struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time; 7.81 - 7.82 - return (shadow.version == src->version); 7.83 -} 7.84 - 7.85 - 7.86 -/* 7.87 - * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, 7.88 - * yielding a 64-bit result. 7.89 - */ 7.90 -static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift) 7.91 -{ 7.92 - u64 product; 7.93 -#ifdef __i386__ 7.94 - u32 tmp1, tmp2; 7.95 -#endif 7.96 - 7.97 - if ( shift < 0 ) 7.98 - delta >>= -shift; 7.99 - else 7.100 - delta <<= shift; 7.101 - 7.102 -#ifdef __i386__ 7.103 - __asm__ ( 7.104 - "mul %5 ; " 7.105 - "mov %4,%%eax ; " 7.106 - "mov %%edx,%4 ; " 7.107 - "mul %5 ; " 7.108 - "add %4,%%eax ; " 7.109 - "xor %5,%5 ; " 7.110 - "adc %5,%%edx ; " 7.111 - : "=A" (product), "=r" (tmp1), "=r" (tmp2) 7.112 - : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); 7.113 -#else 7.114 - __asm__ ( 7.115 - "mul %%rdx ; shrd $32,%%rdx,%%rax" 7.116 - : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) ); 7.117 -#endif 7.118 - 7.119 - return product; 7.120 -} 7.121 - 7.122 - 7.123 -static unsigned long get_nsec_offset(void) 7.124 -{ 7.125 - u64 now, delta; 7.126 - rdtscll(now); 7.127 - delta = now - shadow.tsc_timestamp; 7.128 - return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift); 7.129 -} 7.130 - 7.131 - 7.132 -static void get_time_values_from_xen(void) 7.133 -{ 7.134 - struct vcpu_time_info *src = &HYPERVISOR_shared_info->vcpu_info[0].time; 7.135 - 7.136 - do { 7.137 - shadow.version = src->version; 7.138 - rmb(); 7.139 - shadow.tsc_timestamp = src->tsc_timestamp; 7.140 - shadow.system_timestamp = src->system_time; 7.141 - shadow.tsc_to_nsec_mul = src->tsc_to_system_mul; 7.142 - shadow.tsc_shift = src->tsc_shift; 7.143 - rmb(); 7.144 - } 7.145 - while ((src->version & 1) | (shadow.version ^ src->version)); 7.146 - 7.147 - shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000; 7.148 -} 7.149 - 7.150 - 7.151 - 7.152 - 7.153 -/* monotonic_clock(): returns # of nanoseconds passed since time_init() 7.154 - * Note: This function is required to return accurate 7.155 - * time even in the absence of multiple timer ticks. 7.156 - */ 7.157 -u64 monotonic_clock(void) 7.158 -{ 7.159 - u64 time; 7.160 - u32 local_time_version; 7.161 - 7.162 - do { 7.163 - local_time_version = shadow.version; 7.164 - rmb(); 7.165 - time = shadow.system_timestamp + get_nsec_offset(); 7.166 - if (!time_values_up_to_date()) 7.167 - get_time_values_from_xen(); 7.168 - rmb(); 7.169 - } while (local_time_version != shadow.version); 7.170 - 7.171 - return time; 7.172 -} 7.173 - 7.174 -static void update_wallclock(void) 7.175 -{ 7.176 - shared_info_t *s = HYPERVISOR_shared_info; 7.177 - 7.178 - do { 7.179 - shadow_ts_version = s->wc_version; 7.180 - rmb(); 7.181 - shadow_ts.ts_sec = s->wc_sec; 7.182 - shadow_ts.ts_nsec = s->wc_nsec; 7.183 - rmb(); 7.184 - } 7.185 - while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version)); 7.186 -} 7.187 - 7.188 - 7.189 -void gettimeofday(struct timeval *tv) 7.190 -{ 7.191 - u64 nsec = monotonic_clock(); 7.192 - nsec += shadow_ts.ts_nsec; 7.193 - 7.194 - 7.195 - tv->tv_sec = shadow_ts.ts_sec; 7.196 - tv->tv_sec += NSEC_TO_SEC(nsec); 7.197 - tv->tv_usec = NSEC_TO_USEC(nsec % 1000000000UL); 7.198 -} 7.199 - 7.200 - 7.201 -void block_domain(s_time_t until) 7.202 -{ 7.203 - struct timeval tv; 7.204 - gettimeofday(&tv); 7.205 - if(monotonic_clock() < until) 7.206 - { 7.207 - HYPERVISOR_set_timer_op(until); 7.208 - HYPERVISOR_sched_op(SCHEDOP_block, 0); 7.209 - } 7.210 -} 7.211 - 7.212 - 7.213 -/* 7.214 - * Just a dummy 7.215 - */ 7.216 -static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign) 7.217 -{ 7.218 - get_time_values_from_xen(); 7.219 - update_wallclock(); 7.220 -} 7.221 - 7.222 - 7.223 - 7.224 -void init_time(void) 7.225 -{ 7.226 - printk("Initialising timer interface\n"); 7.227 - bind_virq(VIRQ_TIMER, &timer_handler, NULL); 7.228 -}