lwp_arch.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <rthw.h>
  12. #include <lwp.h>
  13. #include <lwp_arch_comm.h>
  14. #ifdef ARCH_MM_MMU
  15. #ifdef ARCH_MM_MMU_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 0x200000000UL
  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_inline unsigned long rt_hw_ffz(unsigned long x)
  45. {
  46. return __builtin_ffsl(~x) - 1;
  47. }
  48. rt_inline void icache_invalid_all(void)
  49. {
  50. rt_hw_cpu_icache_invalidate_all();
  51. }
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif
  56. #endif /*LWP_ARCH_H__*/