From 61df56a7f350651fa5ca0d4c08409ef4d897edaf Mon Sep 17 00:00:00 2001 From: Adrian Danis Date: Fri, 6 Apr 2018 11:45:33 +1000 Subject: [PATCH] riscv: Remove VMNoAccess mapping type A frame cannot be mapped without any access permissions, as this encoding is used to represent a page table mapping. --- include/arch/riscv/arch/object/structures.h | 9 ++++----- src/arch/riscv/kernel/vspace.c | 9 +++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/arch/riscv/arch/object/structures.h b/include/arch/riscv/arch/object/structures.h index a042bd2d9..255ae5997 100644 --- a/include/arch/riscv/arch/object/structures.h +++ b/include/arch/riscv/arch/object/structures.h @@ -50,11 +50,10 @@ typedef struct arch_tcb { } arch_tcb_t; enum vm_rights { - VMNoAccess = 0, - VMKernelOnly = 1, - VMReadOnly = 2, - VMWriteOnly = 3, - VMReadWrite = 4 + VMKernelOnly = 0, + VMReadOnly = 1, + VMWriteOnly = 2, + VMReadWrite = 3 }; typedef uint32_t vm_rights_t; diff --git a/src/arch/riscv/kernel/vspace.c b/src/arch/riscv/kernel/vspace.c index 637a6a7a2..9257ae6e5 100644 --- a/src/arch/riscv/kernel/vspace.c +++ b/src/arch/riscv/kernel/vspace.c @@ -48,7 +48,7 @@ static exception_t performPageGetAddress(void *vbase_ptr); static word_t CONST RISCVGetWriteFromVMRights(vm_rights_t vm_rights) { - return (vm_rights != VMNoAccess) && (vm_rights != VMReadOnly); + return vm_rights != VMReadOnly; } static word_t RISCVGetUserFromVMRights(vm_rights_t vm_rights) @@ -59,7 +59,7 @@ static word_t RISCVGetUserFromVMRights(vm_rights_t vm_rights) static inline word_t CONST RISCVGetReadFromVMRights(vm_rights_t vm_rights) { - return (vm_rights != VMNoAccess) && (vm_rights != VMWriteOnly); + return vm_rights != VMWriteOnly; } /* ==================== BOOT CODE STARTS HERE ==================== */ @@ -664,9 +664,6 @@ checkValidIPCBuffer(vptr_t vptr, cap_t cap) vm_rights_t CONST maskVMRights(vm_rights_t vm_rights, seL4_CapRights_t cap_rights_mask) { - if (vm_rights == VMNoAccess) { - return VMNoAccess; - } if (vm_rights == VMReadOnly && seL4_CapRights_get_capAllowRead(cap_rights_mask)) { return VMReadOnly; @@ -688,7 +685,7 @@ maskVMRights(vm_rights_t vm_rights, seL4_CapRights_t cap_rights_mask) if (vm_rights == VMKernelOnly) { return VMKernelOnly; } - return VMNoAccess; + return VMKernelOnly; } /* The rest of the file implements the RISCV object invocations */