From 69a143d682919bb27beb317616ef8d0eecf67dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Mon, 18 Sep 2017 21:20:38 +0200 Subject: arch/riscv: Document mprv_{read,write}_* functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaf0cb241f0eb4de241f0983c0b32dbcc28f96480 Signed-off-by: Jonathan Neuschäfer Reviewed-on: https://review.coreboot.org/21342 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Ronald G. Minnich --- src/arch/riscv/include/vm.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/arch/riscv/include') 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) -- cgit v1.2.3