blob: 23aa8fe8457c495e84ea54589c8e2eaa2177c7c4 [file] [log] [blame]
#ifndef ROS_INC_RISCV_H
#define ROS_INC_RISCV_H
#include <arch/pcr.h>
static __inline void
lcr3(uintptr_t val)
{
mtpcr(PCR_PTBR, val);
}
static __inline uintptr_t
rcr3(void)
{
return mfpcr(PCR_PTBR);
}
static __inline uintptr_t
read_pc(void)
{
uintptr_t pc;
asm ("rdpc %0" : "=r"(pc));
return pc;
}
static inline uintptr_t
read_bp(void)
{
/* frame pointer. yes, read_bp is a shitty name. i'll change all of them
* to read_fp when you read this and implement the function. =) */
return 0;
}
static __inline void
send_ipi(uint32_t who, uint8_t vector)
{
mtpcr(PCR_SEND_IPI, who);
}
static __inline void
clear_ipi()
{
mtpcr(PCR_CLR_IPI, 0);
}
#endif