mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
pc-bios: s390x: Consolidate timing functions into time.h
Let's consolidate timing related functions into one header. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Acked-by: Thomas Huth <thuth@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Message-Id: <20200624075226.92728-3-frankja@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
8c6cc7b9df
commit
e70bc57ba0
7 changed files with 36 additions and 31 deletions
23
pc-bios/s390-ccw/s390-time.h
Normal file
23
pc-bios/s390-ccw/s390-time.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef TIME_H
|
||||
#define TIME_H
|
||||
|
||||
static inline u64 get_clock(void)
|
||||
{
|
||||
u64 r;
|
||||
|
||||
asm volatile("stck %0" : "=Q" (r) : : "cc");
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline u64 get_time_ms(void)
|
||||
{
|
||||
/* Bit 51 is incremented each microsecond */
|
||||
return (get_clock() >> 12) / 1000;
|
||||
}
|
||||
|
||||
static inline u64 get_time_seconds(void)
|
||||
{
|
||||
return get_time_ms() / 1000;
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue