xref: /kvm-unit-tests/lib/powerpc/asm/processor.h (revision f4d8d9396ff91f66732ebba1e24fb8937eafc49b)
1 #ifndef _ASMPOWERPC_PROCESSOR_H_
2 #define _ASMPOWERPC_PROCESSOR_H_
3 
4 #include <libcflat.h>
5 #include <asm/ptrace.h>
6 
7 #ifndef __ASSEMBLY__
8 void handle_exception(int trap, void (*func)(struct pt_regs *, void *), void *);
9 void do_handle_exception(struct pt_regs *regs);
10 #endif /* __ASSEMBLY__ */
11 
12 static inline uint64_t get_tb(void)
13 {
14 	uint64_t tb;
15 
16 	asm volatile ("mfspr %[tb],268" : [tb] "=r" (tb));
17 
18 	return tb;
19 }
20 
21 extern void delay(uint64_t cycles);
22 extern void udelay(uint64_t us);
23 
24 static inline void mdelay(uint64_t ms)
25 {
26 	while (ms--)
27 		udelay(1000);
28 }
29 
30 #endif /* _ASMPOWERPC_PROCESSOR_H_ */
31