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

[Minios-devel] [UNIKRAFT PATCH 3/7] plat/xen: Implement ukplat_wall_clock() for x86



Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 plat/xen/x86/arch_time.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/plat/xen/x86/arch_time.c b/plat/xen/x86/arch_time.c
index a4b77b93..d36f9632 100644
--- a/plat/xen/x86/arch_time.c
+++ b/plat/xen/x86/arch_time.c
@@ -58,9 +58,8 @@ struct shadow_time_info {
        uint32_t version;
 };
 
-#if 0 /* TODO */
 static struct timespec shadow_ts;
-#endif
+
 static uint32_t shadow_ts_version;
 
 static struct shadow_time_info shadow;
@@ -184,8 +183,6 @@ __nsec ukplat_monotonic_clock(void)
        return time;
 }
 
-#if 0 /* TODO */
-
 static void update_wallclock(void)
 {
        shared_info_t *s = HYPERVISOR_shared_info;
@@ -198,7 +195,19 @@ static void update_wallclock(void)
                rmb();
        } while ((s->wc_version & 1) | (shadow_ts_version ^ s->wc_version));
 }
-#endif
+
+__nsec ukplat_wall_clock(void)
+{
+       __nsec ret = ukplat_monotonic_clock();
+
+       if (!wc_values_up_to_date())
+               update_wallclock();
+
+       ret += ukarch_time_sec_to_nsec((__nsec) shadow_ts.tv_sec);
+       ret += (__nsec) shadow_ts.tv_nsec;
+
+       return ret;
+}
 
 #if 0 /* TODO */
 int gettimeofday(struct timeval *tv, void *tz)
-- 
2.20.1


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

 


Rackspace

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