On 5/18/20 2:01 PM, David Hildenbrand wrote: > [...] > >> >> -static inline void yield(void) >> -{ >> - asm volatile ("diag 0,0,0x44" >> - : : >> - : "memory", "cc"); >> -} >> - > > Nit: Looks weird that yield() is moved to time.h > > Wonder if there is a better fit for this functi helper.h or maybe into the libc?
> >> #define MAX_SECTOR_SIZE 4096 >> >> -static inline void sleep(unsigned int seconds) >> -{ >> - ulong target = get_second() + seconds; >> - >> - while (get_second() < target) { >> - yield(); >> - } >> -} >> - >> static inline void IPL_assert(bool term, const char *message) >> { >> if (!term) { >> diff --git a/pc-bios/s390-ccw/time.h b/pc-bios/s390-ccw/time.h >> new file mode 100644 >> index 0000000000..899de83ae7 >> --- /dev/null >> +++ b/pc-bios/s390-ccw/time.h >> @@ -0,0 +1,39 @@ >> +#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; > > return get_time_ms() / 1000; Sure
signature.asc
Description: OpenPGP digital signature