diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-01-31 19:45:13 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-01-31 19:45:13 +0000 |
commit | dea8eefd6214e3ad5b54795fa958ab721d58710c (patch) | |
tree | f210aa8b10d18345ea90980eef13ea0c6a2665ee /extras/mini-os | |
parent | f21e4de207c89ca1f1d18122c43db30b2ff41e7b (diff) | |
download | xen-dea8eefd6214e3ad5b54795fa958ab721d58710c.tar.gz xen-dea8eefd6214e3ad5b54795fa958ab721d58710c.tar.bz2 xen-dea8eefd6214e3ad5b54795fa958ab721d58710c.zip |
bitkeeper revision 1.699 (401c05c9TV2zsaZ_e3zpy-zaKxCetw)
timer.c, timer.h, sched.h:
new file
Many files:
Rolf's new timer interface, plus various cleanups.
Diffstat (limited to 'extras/mini-os')
-rw-r--r-- | extras/mini-os/h/hypervisor.h | 34 | ||||
-rw-r--r-- | extras/mini-os/time.c | 40 |
2 files changed, 63 insertions, 11 deletions
diff --git a/extras/mini-os/h/hypervisor.h b/extras/mini-os/h/hypervisor.h index a4f5625692..92bb37cdd2 100644 --- a/extras/mini-os/h/hypervisor.h +++ b/extras/mini-os/h/hypervisor.h @@ -1,3 +1,10 @@ +/****************************************************************************** + * hypervisor.h + * + * Linux-specific hypervisor handling. + * + * Copyright (c) 2002, K A Fraser + */ #ifndef _HYPERVISOR_H_ #define _HYPERVISOR_H_ @@ -135,6 +142,17 @@ static __inline__ int HYPERVISOR_yield(void) return ret; } +static __inline__ int HYPERVISOR_block(void) +{ + int ret; + __asm__ __volatile__ ( + TRAP_INSTR + : "=a" (ret) : "0" (__HYPERVISOR_sched_op), + "b" (SCHEDOP_block) ); + + return ret; +} + static __inline__ int HYPERVISOR_exit(void) { int ret; @@ -146,13 +164,25 @@ static __inline__ int HYPERVISOR_exit(void) return ret; } -static __inline__ int HYPERVISOR_stop(void) +static __inline__ int HYPERVISOR_stop(unsigned long srec) { int ret; + /* NB. On suspend, control software expects a suspend record in %esi. */ __asm__ __volatile__ ( TRAP_INSTR : "=a" (ret) : "0" (__HYPERVISOR_sched_op), - "b" (SCHEDOP_stop) ); + "b" (SCHEDOP_stop), "S" (srec) : "memory" ); + + return ret; +} + +static __inline__ long HYPERVISOR_set_dom_timer(void *timer_arg) +{ + int ret; + __asm__ __volatile__ ( + TRAP_INSTR + : "=a" (ret) : "0" (__HYPERVISOR_set_dom_timer), + "b" (timer_arg) : "memory" ); return ret; } diff --git a/extras/mini-os/time.c b/extras/mini-os/time.c index 447e164987..12356b0a03 100644 --- a/extras/mini-os/time.c +++ b/extras/mini-os/time.c @@ -1,20 +1,14 @@ /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- **************************************************************************** * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge + * (C) 2002-2003 - Keir Fraser - University of Cambridge **************************************************************************** * * File: time.c - * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk) - * Changes: - * - * Date: Jul 2003 - * - * Environment: Xen Minimal OS + * Author: Rolf Neugebauer and Keir Fraser + * * Description: Simple time and timer functions * - **************************************************************************** - * $Id: c-insert.c,v 1.7 2002/11/08 16:04:34 rn Exp $ - **************************************************************************** * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the @@ -105,6 +99,29 @@ static __inline__ unsigned long get_time_delta_usecs(void) return (unsigned long)delta; } +s64 get_s_time (void) +{ + u64 u_delta; + s64 ret; + + again: + + u_delta = get_time_delta_usecs(); + ret = shadow_system_time + (1000 * u_delta); + + if ( unlikely(!TIME_VALUES_UP_TO_DATE) ) + { + /* + * We may have blocked for a long time, rendering our calculations + * invalid (e.g. the time delta may have overflowed). Detect that + * and recalculate with fresh values. + */ + get_time_values_from_xen(); + goto again; + } + + return ret; +} void gettimeofday(struct timeval *tv) { @@ -123,11 +140,16 @@ void gettimeofday(struct timeval *tv) } +/* + * Just a dummy + */ static void timer_handler(int ev, struct pt_regs *regs) { static int i; struct timeval tv; + get_time_values_from_xen(); + i++; if (i >= 1000) { gettimeofday(&tv); |