lwp_arch.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. */
  9. #ifndef LWP_ARCH_H__
  10. #define LWP_ARCH_H__
  11. #include <lwp.h>
  12. #include <lwp_arch_comm.h>
  13. #include <riscv_mmu.h>
  14. #ifdef RT_USING_USERSPACE
  15. #ifdef RT_USING_USERSPACE_32BIT_LIMIT
  16. #define USER_HEAP_VADDR 0xF0000000UL
  17. #define USER_HEAP_VEND 0xFE000000UL
  18. #define USER_STACK_VSTART 0xE0000000UL
  19. #define USER_STACK_VEND USER_HEAP_VADDR
  20. #define USER_VADDR_START 0xC0000000UL
  21. #define USER_VADDR_TOP 0xFF000000UL
  22. #define USER_LOAD_VADDR 0xD0000000UL
  23. #define LDSO_LOAD_VADDR USER_LOAD_VADDR
  24. #else
  25. #define USER_HEAP_VADDR 0x300000000UL
  26. #define USER_HEAP_VEND 0xffffffffffff0000UL
  27. #define USER_STACK_VSTART 0x270000000UL
  28. #define USER_STACK_VEND USER_HEAP_VADDR
  29. #define USER_VADDR_START 0x100000000UL
  30. #define USER_VADDR_TOP 0xfffffffffffff000UL
  31. #define USER_LOAD_VADDR 0x200000000
  32. #define LDSO_LOAD_VADDR 0x200000000
  33. #endif
  34. /* this attribution is cpu specified, and it should be defined in riscv_mmu.h */
  35. #ifndef MMU_MAP_U_RWCB
  36. #define MMU_MAP_U_RWCB 0
  37. #endif
  38. #ifndef MMU_MAP_U_RW
  39. #define MMU_MAP_U_RW 0
  40. #endif
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. rt_mmu_info* arch_kernel_get_mmu_info(void);
  45. rt_inline unsigned long rt_hw_ffz(unsigned long x)
  46. {
  47. return __builtin_ffsl(~x) - 1;
  48. }
  49. rt_inline void icache_invalid_all(void)
  50. {
  51. //TODO:
  52. }
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif
  57. #endif /*LWP_ARCH_H__*/