1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef S390_CCW_HELPER_H
14#define S390_CCW_HELPER_H
15
16#include "s390-ccw.h"
17#include "s390-time.h"
18
19
20static inline uint32_t ptr2u32(void *ptr)
21{
22 IPL_assert((uint64_t)ptr <= 0xffffffffull, "ptr2u32: ptr too large");
23 return (uint32_t)(uint64_t)ptr;
24}
25
26
27static inline void *u32toptr(uint32_t n)
28{
29 return (void *)(uint64_t)n;
30}
31
32static inline void yield(void)
33{
34 asm volatile ("diag %%r0,%%r0,0x44"
35 : :
36 : "memory", "cc");
37}
38
39static inline void sleep(unsigned int seconds)
40{
41 ulong target = get_time_seconds() + seconds;
42
43 while (get_time_seconds() < target) {
44 yield();
45 }
46}
47
48#endif
49