diff options
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | 2016-08-09 02:07:10 +0200 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2016-08-11 21:11:11 +0200 |
commit | c42b5917af50a1a0b6a64330e9cdd953c46102b7 (patch) | |
tree | 443967cac32e6bc185a6af4f76dad591e92be523 /src/arch/riscv/virtual_memory.c | |
parent | 6e1884ff5de15aff746b7345866290acfb9a9ec4 (diff) | |
download | coreboot-c42b5917af50a1a0b6a64330e9cdd953c46102b7.tar.xz |
arch/riscv: Update encoding.h and dependent files
I copied it from commit e10d2def7d of spike and made sure the copyright
header is still there.
Change-Id: Ie8b56cd2f4855b97d36a112a195866f4ff0feec5
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.coreboot.org/15832
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/arch/riscv/virtual_memory.c')
-rw-r--r-- | src/arch/riscv/virtual_memory.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/arch/riscv/virtual_memory.c b/src/arch/riscv/virtual_memory.c index f0cd5f656a..385a5fd319 100644 --- a/src/arch/riscv/virtual_memory.c +++ b/src/arch/riscv/virtual_memory.c @@ -42,15 +42,18 @@ size_t pte_ppn(pte_t pte) pte_t ptd_create(uintptr_t ppn) { - return (ppn << PTE_PPN_SHIFT) | PTE_V | PTE_TYPE_TABLE; + return (ppn << PTE_PPN_SHIFT) | PTE_V; } pte_t pte_create(uintptr_t ppn, int prot, int user) { - pte_t pte = (ppn << PTE_PPN_SHIFT) | PTE_V; - if (prot & PROT_WRITE) pte |= PTE_TYPE_URW_SRW; - if (prot & PROT_EXEC) pte |= PTE_TYPE_URX_SRX; - if (!user) pte |= PTE_TYPE_SR; + pte_t pte = (ppn << PTE_PPN_SHIFT) | PTE_R | PTE_V; + if (prot & PROT_WRITE) + pte |= PTE_W; + if (prot & PROT_EXEC) + pte |= PTE_X; + if (user) + pte |= PTE_U; return pte; } @@ -127,10 +130,6 @@ void mstatus_init(void) // supervisor support is required uintptr_t ms = 0; - ms = INSERT_FIELD(ms, MSTATUS_PRV, PRV_M); - ms = INSERT_FIELD(ms, MSTATUS_PRV1, PRV_S); - ms = INSERT_FIELD(ms, MSTATUS_PRV2, PRV_U); - ms = INSERT_FIELD(ms, MSTATUS_IE2, 1); ms = INSERT_FIELD(ms, MSTATUS_FS, 3); ms = INSERT_FIELD(ms, MSTATUS_XS, 3); write_csr(mstatus, ms); |