mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00

Currently, the unprivilege load/store functions are inline functions. We will be extending these functions to track whether a page/access fault occurs when we execute unprivilege load/store instruction. To make things simpler and debugable, we reduce number of places which can potentially generate a page/access fault by making all unprivilege load/store functions as regular (non-inline) functions. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
37 lines
976 B
C
37 lines
976 B
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
|
|
*
|
|
* Authors:
|
|
* Anup Patel <anup.patel@wdc.com>
|
|
*/
|
|
|
|
#ifndef __RISCV_UNPRIV_H__
|
|
#define __RISCV_UNPRIV_H__
|
|
|
|
#include <sbi/sbi_types.h>
|
|
|
|
#define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type) \
|
|
type load_##type(const type *addr);
|
|
|
|
#define DECLARE_UNPRIVILEGED_STORE_FUNCTION(type) \
|
|
void store_##type(type *addr, type val);
|
|
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u8)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u16)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s8)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s16)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s32)
|
|
DECLARE_UNPRIVILEGED_STORE_FUNCTION(u8)
|
|
DECLARE_UNPRIVILEGED_STORE_FUNCTION(u16)
|
|
DECLARE_UNPRIVILEGED_STORE_FUNCTION(u32)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u32)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u64)
|
|
DECLARE_UNPRIVILEGED_STORE_FUNCTION(u64)
|
|
DECLARE_UNPRIVILEGED_LOAD_FUNCTION(ulong)
|
|
|
|
ulong get_insn(ulong mepc, ulong *mstatus);
|
|
|
|
#endif
|