aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/include/csr.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-01-06 23:39:12 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-01-07 14:05:06 +0200
commit9cc125fb3cfdc2c8ae7153b5ae0fe705980835fb (patch)
treea1974f9513458acab0bd8d09758259b24b6d7d8c /arch/riscv/include/csr.h
parentf0eba93472e0afecc57180fc0d638eeef8e6f3c6 (diff)
downloadkmi-9cc125fb3cfdc2c8ae7153b5ae0fe705980835fb.tar.gz
kmi-9cc125fb3cfdc2c8ae7153b5ae0fe705980835fb.zip
Allow building with clang
+ Release mode is sort of broken, as lto doesn't work with linker relaxation and turning the relaxation off causes issues with the jump from init to kernel (as I've currently implemented it, could probably be fixed with a manual jump from assembly, I'll add it to my TODO list)
Diffstat (limited to 'arch/riscv/include/csr.h')
-rw-r--r--arch/riscv/include/csr.h63
1 files changed, 0 insertions, 63 deletions
diff --git a/arch/riscv/include/csr.h b/arch/riscv/include/csr.h
deleted file mode 100644
index b309f0b..0000000
--- a/arch/riscv/include/csr.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef APOS_CSR_H
-#define APOS_CSR_H
-
-#include <apos/utils.h>
-
-#define SATP_MODE_Sv32 0x80000000
-#define SATP_MODE_Sv39 0x8000000000000000
-#define SATP_MODE_Sv48 0x9000000000000000
-
-
-/* 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
-
-/* status CSR bits */
-#define SSTATUS_SUM (1 << 18)
-#define SSTATUS_SPP (1 << 8)
-
-/* directly lifted from Linux:/arch/riscv/include/asm/asm.h:9-13 */
-#ifdef __ASSEMBLY__
-#define __ASM_STR(x) x
-#else
-#define __ASM_STR(x) #x
-#endif
-
-#define csr_read(csr, res)\
- __asm__ ("csrr %0, " __ASM_STR(csr) : "=r" (res) : : "memory")
-
-#define csr_write(csr, val)\
- __asm__ ("csrw " __ASM_STR(csr) ", %0" : : "rK" (val) : "memory")
-
-#define csr_set(csr, val)\
- __asm__ ("csrs " __ASM_STR(csr) ", %0" : : "rK" (val) : "memory")
-
-#define csr_clear(csr, val)\
- __asm__ ("csrc " __ASM_STR(csr) ", %0" : : "rK" (val) : "memory")
-
-#endif /* APOS_CSR_H */