From 5dfac4879ce5f34503ae7537eefd3fc48d6fa750 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 25 Aug 2021 23:47:08 +0300 Subject: libfdt seems to work At least as far as reading memory info, cool. One issue I have is that .(ro)data is apparently accessed by absolute addresses, so I need to know at which address the kernel is going to be loaded. I would prefer completely position independent code, but if that's not possible then eh. --- arch/riscv/include/pages.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'arch/riscv/include/pages.h') diff --git a/arch/riscv/include/pages.h b/arch/riscv/include/pages.h index 4ae2ab9..9e16c00 100644 --- a/arch/riscv/include/pages.h +++ b/arch/riscv/include/pages.h @@ -1,36 +1,40 @@ #ifndef APOS_RISCV_PAGES_H #define APOS_RISCV_PAGES_H -typedef char pagemask_t; -typedef char lockbit_t; +#include -struct kilopages { +typedef uint8_t pagemask_t; +typedef uint8_t lockbit_t; +/* assume riscv64 for now */ +typedef uint64_t pm_t; + +struct mm_kpages { pagemask_t page[64]; }; -struct megapages { +struct mm_mpages { lockbit_t lockbit[64]; pagemask_t empty[64]; pagemask_t full[64]; - struct kilopages kilo[512]; + struct mm_kpages kilo[512]; }; /* Sv39 */ -struct gigapages { +struct mm_gpages { lockbit_t lockbit[64]; pagemask_t empty[64]; pagemask_t full[64]; - struct megapages mega[512]; + struct mm_mpages mega[512]; }; -struct terapages { +struct mm_tpages { lockbit_t lockbit[64]; pagemask_t empty[64]; pagemask_t full[64]; - struct gigapages giga[512]; + struct mm_gpages giga[512]; }; -struct mm_pagearr_info { +struct mm_ptinfo { short tera_num; struct terapages *tera_top; -- cgit v1.3