diff options
Diffstat (limited to 'arch/riscv/include')
| -rw-r--r-- | arch/riscv/include/csr.h | 36 | ||||
| -rw-r--r-- | arch/riscv/include/vmem.h | 8 |
2 files changed, 40 insertions, 4 deletions
diff --git a/arch/riscv/include/csr.h b/arch/riscv/include/csr.h index ab25bdd..70e60bb 100644 --- a/arch/riscv/include/csr.h +++ b/arch/riscv/include/csr.h @@ -3,11 +3,39 @@ #include <apos/utils.h> -#define SATP_MODE_Sv32 0x80000000 -#define SATP_MODE_Sv39 0x8000000000000000 -#define SATP_MODE_Sv48 0x9000000000000000 +#define SATP_MODE_Sv32 0x80000000 +#define SATP_MODE_Sv39 0x8000000000000000 +#define SATP_MODE_Sv48 0x9000000000000000 -#define CSR_SATP 0x180 + +/* supervisor CSR registers */ +#define CSR_SSTATUS 0x100 +#define CSR_SIE 0x104 +#define CSR_STVEC 0x105 +#define CSR_SCOUNTEREN 0x106 + +#define CSR_SENVCFG 0x10A + +#define CSR_SSCRATCH 0x140 +#define CSR_SEPC 0x141 +#define CSR_SCAUSE 0x142 +#define CSR_STVAL 0x143 +#define CSR_SIP 0x144 + +#define CSR_SATP 0x180 + +#define CSR_SCONTEXT 0x5A8 + +/* Exception causes */ +#define EXC_INST_MISALIGNED 0 +#define EXC_INST_ACCESS 1 +#define EXC_BREAKPOINT 3 +#define EXC_LOAD_ACCESS 5 +#define EXC_STORE_ACCESS 7 +#define EXC_SYSCALL 8 +#define EXC_INST_PAGE_FAULT 12 +#define EXC_LOAD_PAGE_FAULT 13 +#define EXC_STORE_PAGE_FAULT 15 /* directly lifted from Linux:/arch/riscv/include/asm/asm.h:9-13 */ #ifdef __ASSEMBLY__ diff --git a/arch/riscv/include/vmem.h b/arch/riscv/include/vmem.h index d17aaf1..2cd3ac7 100644 --- a/arch/riscv/include/vmem.h +++ b/arch/riscv/include/vmem.h @@ -3,6 +3,7 @@ #include <apos/types.h> #include <apos/attrs.h> +#include <apos/pmem.h> #define VM_V (1 << 0) #define VM_R (1 << 1) @@ -24,4 +25,11 @@ struct __packed vm_branch_t { struct vm_branch_t *leaf[512]; }; + +void map_vmem(struct vm_branch_t *b, + pm_t paddr, vm_t vaddr, uint8_t flags, enum mm_order_t order); + +void unmap_vmem(struct vm_branch_t *b, + vm_t vaddr, enum mm_order_t order); + #endif /* APOS_RISCV_VMAP_H */ |
