sbi_unpriv.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #ifndef __SBI_UNPRIV_H__
  10. #define __SBI_UNPRIV_H__
  11. #include <sbi/sbi_types.h>
  12. struct sbi_scratch;
  13. struct sbi_trap_info;
  14. #define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type) \
  15. type sbi_load_##type(const type *addr, \
  16. struct sbi_trap_info *trap);
  17. #define DECLARE_UNPRIVILEGED_STORE_FUNCTION(type) \
  18. void sbi_store_##type(type *addr, type val, \
  19. struct sbi_trap_info *trap);
  20. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u8)
  21. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u16)
  22. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s8)
  23. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s16)
  24. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(s32)
  25. DECLARE_UNPRIVILEGED_STORE_FUNCTION(u8)
  26. DECLARE_UNPRIVILEGED_STORE_FUNCTION(u16)
  27. DECLARE_UNPRIVILEGED_STORE_FUNCTION(u32)
  28. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u32)
  29. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(u64)
  30. DECLARE_UNPRIVILEGED_STORE_FUNCTION(u64)
  31. DECLARE_UNPRIVILEGED_LOAD_FUNCTION(ulong)
  32. ulong sbi_get_insn(ulong mepc, struct sbi_trap_info *trap);
  33. #endif