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>
This commit is contained in:
Jonathan Neuschäfer 2017-09-18 21:20:38 +02:00 committed by Martin Roth
parent d54c1cc770
commit 69a143d682
1 changed files with 11 additions and 0 deletions

View File

@ -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_u8, uint8_t, lbu)
DEFINE_MPRV_READ(mprv_read_u16, uint16_t, lhu) DEFINE_MPRV_READ(mprv_read_u16, uint16_t, lhu)
DEFINE_MPRV_READ(mprv_read_u32, uint32_t, lwu) DEFINE_MPRV_READ(mprv_read_u32, uint32_t, lwu)