this function spin sleeps for t nanoseconds Signed-off-by: Paul Semel <phen...@amazon.de> ---
Notes: v4: - new patch version common/time.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/time.c b/common/time.c index 8489f3b..232e134 100644 --- a/common/time.c +++ b/common/time.c @@ -139,6 +139,18 @@ int gettimeofday(struct timeval *tp, void *restrict tzp) return 0; } +static inline void nspin_sleep(uint64_t t) +{ + uint64_t curr = since_boot_time(); + uint64_t end = curr + t; + + if ( end < curr ) + panic("end value overflows counter\n"); + + while ( since_boot_time() < end ) + asm volatile ("pause"); +} + /* * Local variables: * mode: C -- 2.16.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel