RISCV/SPARC: send_ipi() takes a vector
[akaros.git] / kern / arch / riscv / riscv.h
1 #ifndef ROS_INC_RISCV_H
2 #define ROS_INC_RISCV_H
3
4 #include <arch/pcr.h>
5
6 static __inline void
7 lcr3(uintptr_t val)
8 {
9         mtpcr(PCR_PTBR, val);
10 }
11
12 static __inline uintptr_t
13 rcr3(void)
14 {
15         return mfpcr(PCR_PTBR);
16 }
17
18 static __inline uintptr_t
19 read_pc(void)
20 {
21         uintptr_t pc;
22         asm ("rdnpc %0" : "=r"(pc));
23         return pc;
24 }
25
26 static __inline void
27 send_ipi(uint32_t who, uint8_t vector)
28 {
29         mtpcr(PCR_SEND_IPI, who);
30 }
31
32 static __inline void
33 clear_ipi()
34 {
35         mtpcr(PCR_CLR_IPI, 0);
36 }
37
38 #endif