[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [PATCH] mini-os: Fix date issue in gettimeofday function



From: dvercaut <dvercaut.Vercauteren@xxxxxxxx>

If an application makes use of the monotonic clock function before
the wallclock is updated (timer_handler function was not yet called),
the struct shadow_ts_version will not contain the correct value.
As a result the application will not display the correct date.

Signed-off-by: David Vercauteren <dvercauteren@xxxxxxxxxx>
---
 arch/x86/time.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/time.c b/arch/x86/time.c
index 2c8d033..18d30b3 100644
--- a/arch/x86/time.c
+++ b/arch/x86/time.c
@@ -58,6 +58,7 @@ static uint32_t shadow_ts_version;
 
 static struct shadow_time_info shadow;
 
+static void update_wallclock(void);
 
 #ifndef rmb
 #define rmb()  __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
@@ -141,6 +142,7 @@ static void get_time_values_from_xen(void)
        }
        while ((src->version & 1) | (shadow.version ^ src->version));
 
+       update_wallclock();
        shadow.tsc_to_usec_mul = shadow.tsc_to_nsec_mul / 1000;
 }
 
@@ -217,7 +219,6 @@ void block_domain(s_time_t until)
 static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
 {
     get_time_values_from_xen();
-    update_wallclock();
 }
 
 
-- 
2.1.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.