cpuport.h 844 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-10-03 Bernard The first version
  9. */
  10. #ifndef CPUPORT_H__
  11. #define CPUPORT_H__
  12. #include <rtconfig.h>
  13. /* bytes of register width */
  14. #ifdef ARCH_CPU_64BIT
  15. #define STORE sd
  16. #define LOAD ld
  17. #define REGBYTES 8
  18. #else
  19. // error here, not portable
  20. #endif
  21. /* 33 normal register */
  22. #define CTX_REG_NR 33
  23. #ifndef __ASSEMBLY__
  24. rt_inline void rt_hw_dsb()
  25. {
  26. asm volatile("fence":::"memory");
  27. }
  28. rt_inline void rt_hw_dmb()
  29. {
  30. asm volatile("fence":::"memory");
  31. }
  32. rt_inline void rt_hw_isb()
  33. {
  34. asm volatile("fence.i":::"memory");
  35. }
  36. #endif
  37. #endif
  38. #ifdef RISCV_U_MODE
  39. #define RISCV_USER_ENTRY 0xFFFFFFE000000000ULL
  40. #endif