aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2021-08-17 21:47:38 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2021-08-17 21:49:16 +0300
commit565724db3b73ee67fa996dab511dc52df586cee1 (patch)
treed3bd77006c2c57aa961f85c4fc677bd72f6251ae /arch/riscv/include
downloadkmi-565724db3b73ee67fa996dab511dc52df586cee1.tar.gz
kmi-565724db3b73ee67fa996dab511dc52df586cee1.zip
Garbage
Diffstat (limited to 'arch/riscv/include')
-rw-r--r--arch/riscv/include/csr.h6
-rw-r--r--arch/riscv/include/pages.h47
-rw-r--r--arch/riscv/include/sbi.h12
-rw-r--r--arch/riscv/include/vmap.h19
4 files changed, 84 insertions, 0 deletions
diff --git a/arch/riscv/include/csr.h b/arch/riscv/include/csr.h
new file mode 100644
index 0000000..13f96cb
--- /dev/null
+++ b/arch/riscv/include/csr.h
@@ -0,0 +1,6 @@
+#ifndef APOS_CSR_H
+#define APOS_CSR_H
+
+#define csr_write(csr, val)
+
+#endif /* APOS_CSR_H */
diff --git a/arch/riscv/include/pages.h b/arch/riscv/include/pages.h
new file mode 100644
index 0000000..4ae2ab9
--- /dev/null
+++ b/arch/riscv/include/pages.h
@@ -0,0 +1,47 @@
+#ifndef APOS_RISCV_PAGES_H
+#define APOS_RISCV_PAGES_H
+
+typedef char pagemask_t;
+typedef char lockbit_t;
+
+struct kilopages {
+ pagemask_t page[64];
+};
+
+struct megapages {
+ lockbit_t lockbit[64];
+ pagemask_t empty[64];
+ pagemask_t full[64];
+ struct kilopages kilo[512];
+};
+
+/* Sv39 */
+struct gigapages {
+ lockbit_t lockbit[64];
+ pagemask_t empty[64];
+ pagemask_t full[64];
+ struct megapages mega[512];
+};
+
+struct terapages {
+ lockbit_t lockbit[64];
+ pagemask_t empty[64];
+ pagemask_t full[64];
+ struct gigapages giga[512];
+};
+
+struct mm_pagearr_info {
+ short tera_num;
+ struct terapages *tera_top;
+
+ short giga_num;
+ struct gigapages *giga_top;
+
+ short mega_num;
+ struct megapages *mega_top;
+
+ short kilo_num;
+ struct kilopages *kilo_top;
+};
+
+#endif /* APOS_RISCV_PAGES_H */
diff --git a/arch/riscv/include/sbi.h b/arch/riscv/include/sbi.h
new file mode 100644
index 0000000..609849d
--- /dev/null
+++ b/arch/riscv/include/sbi.h
@@ -0,0 +1,12 @@
+#ifndef APOS_RISCV_SBI_H
+
+struct sbiret {
+ long error;
+ long value;
+};
+
+struct sbiret sbi_ecall(int ext, int fid,
+ unsigned long arg0, unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4, unsigned long arg5);
+
+#endif /* APOS_RISCV_SBI_H */
diff --git a/arch/riscv/include/vmap.h b/arch/riscv/include/vmap.h
new file mode 100644
index 0000000..3dac3a1
--- /dev/null
+++ b/arch/riscv/include/vmap.h
@@ -0,0 +1,19 @@
+#ifndef APOS_RISCV_VMAP_H
+#define APOS_RISCV_VMAP_H
+
+#include <apos/sizes.h>
+
+#define VM_V (1 << 1)
+#define VM_R (1 << 2)
+#define VM_W (1 << 3)
+#define VM_X (1 << 4)
+#define VM_U (1 << 5)
+#define VM_G (1 << 6)
+#define VM_A (1 << 7)
+#define VM_D (1 << 8)
+#define VM_AL 0xff
+
+#define VM_TOP (-1)
+#define VM_KERN (VM_TOP - SZ_1G)
+
+#endif /* APOS_RISCV_VMAP_H */