summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2017-09-18 21:20:38 +0200
committerMartin Roth <martinroth@google.com>2017-09-27 16:39:49 +0000
commit69a143d682919bb27beb317616ef8d0eecf67dd4 (patch)
treecc235bfb72cf23d50c576b55594c36d3f839f41b
parentd54c1cc770147039116e945b559928cc8467090e (diff)
arch/riscv: Document mprv_{read,write}_* functions
Change-Id: Iaf0cb241f0eb4de241f0983c0b32dbcc28f96480 Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/21342 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
-rw-r--r--src/arch/riscv/include/vm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/riscv/include/vm.h b/src/arch/riscv/include/vm.h
index a65aba9db8..dadfecd8b4 100644
--- a/src/arch/riscv/include/vm.h
+++ b/src/arch/riscv/include/vm.h
@@ -91,6 +91,17 @@ void flush_tlb(void);
); \
}
+/*
+ * mprv_{read,write}_* - Modified privilege memory access functions.
+ *
+ * These inline functions perform a read or write memory operation with the
+ * mstatus.MPRV bit set. This causes the memory protections and translation of
+ * the previous mode (e.g. U-mode, if we're handling a trap from U-mode) to be
+ * applied.
+ *
+ * The user of these functions must make sure to avoid trap loops through
+ * unaligned memory accesses.
+ */
DEFINE_MPRV_READ(mprv_read_u8, uint8_t, lbu)
DEFINE_MPRV_READ(mprv_read_u16, uint16_t, lhu)
DEFINE_MPRV_READ(mprv_read_u32, uint32_t, lwu)