lwp_arch.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. #elif defined(ARCH_REMAP_KERNEL)
  25. #define USER_VADDR_START 0x00001000UL
  26. #define USER_VADDR_TOP 0x003ffffff000UL
  27. #define USER_STACK_VSTART 0x000270000000UL
  28. #define USER_STACK_VEND USER_HEAP_VADDR
  29. #define USER_HEAP_VADDR 0x000300000000UL
  30. #define USER_HEAP_VEND USER_VADDR_TOP
  31. #define USER_LOAD_VADDR 0x200000000
  32. #define LDSO_LOAD_VADDR 0x200000000
  33. #else
  34. #define USER_HEAP_VADDR 0x300000000UL
  35. #define USER_HEAP_VEND USER_STACK_VSTART
  36. #define USER_STACK_VSTART 0x370000000UL
  37. #define USER_STACK_VEND 0x400000000UL
  38. #define USER_VADDR_START 0x200000000UL
  39. #define USER_VADDR_TOP 0xfffffffffffff000UL
  40. #define USER_LOAD_VADDR 0x200000000UL
  41. #define LDSO_LOAD_VADDR 0x200000000UL
  42. #endif
  43. /* this attribution is cpu specified, and it should be defined in riscv_mmu.h */
  44. #ifndef MMU_MAP_U_RWCB
  45. #define MMU_MAP_U_RWCB 0
  46. #endif
  47. #ifndef MMU_MAP_U_RW
  48. #define MMU_MAP_U_RW 0
  49. #endif
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. rt_inline unsigned long rt_hw_ffz(unsigned long x)
  54. {
  55. return __builtin_ffsl(~x) - 1;
  56. }
  57. rt_inline void icache_invalid_all(void)
  58. {
  59. rt_hw_cpu_icache_invalidate_all();
  60. }
  61. struct rt_hw_stack_frame;
  62. void *arch_signal_ucontext_restore(rt_base_t user_sp);
  63. void *arch_signal_ucontext_save(int signo, siginfo_t *psiginfo,
  64. struct rt_hw_stack_frame *exp_frame, rt_base_t user_sp,
  65. lwp_sigset_t *save_sig_mask);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif
  70. #endif /*LWP_ARCH_H__*/