lwp_arch.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. * 2021-05-18 Jesven first version
  9. */
  10. #ifndef LWP_ARCH_H__
  11. #define LWP_ARCH_H__
  12. #include <rtconfig.h>
  13. #ifdef ARCH_MM_MMU
  14. #define USER_VADDR_TOP 0x0001000000000000UL
  15. #define USER_HEAP_VADDR (0x0000ffff40000000UL)
  16. #define USER_HEAP_VEND USER_STACK_VSTART
  17. #define USER_STACK_VSTART 0x0000ffff70000000UL
  18. #define USER_STACK_VEND (USER_STACK_VSTART + 0x10000000)
  19. #define USER_ARG_VADDR USER_STACK_VEND
  20. #define LDSO_LOAD_VADDR 0x60000000UL
  21. #define USER_VADDR_START 0x00200000UL
  22. #define USER_LOAD_VADDR USER_VADDR_START
  23. #define UCTX_ABI_OFFSET_TO_SI 16
  24. #ifndef __ASSEMBLY__
  25. #include <lwp.h>
  26. #include <lwp_arch_comm.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. unsigned long rt_hw_ffz(unsigned long x);
  31. rt_inline void icache_invalid_all(void)
  32. {
  33. __asm__ volatile ("ic ialluis\n\tisb sy":::"memory");
  34. }
  35. /**
  36. * @brief Save signal-related context to user stack
  37. *
  38. * @param user_sp the current sp of user
  39. * @param exp_frame exception frame to resume former execution
  40. * @param psiginfo pointer to the siginfo
  41. * @param elr pc of former execution
  42. * @param spsr program status of former execution
  43. * @return void* the new user sp
  44. */
  45. void *arch_signal_ucontext_save(rt_base_t user_sp, siginfo_t *psiginfo,
  46. struct rt_hw_exp_stack *exp_frame,
  47. lwp_sigset_t *save_sig_mask);
  48. /**
  49. * @brief Restore the signal mask after return
  50. *
  51. * @param user_sp sp of user
  52. * @return void*
  53. */
  54. void *arch_signal_ucontext_restore(rt_base_t user_sp, rt_base_t kernel_sp);
  55. void arch_syscall_restart(void *sp, void *ksp);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* __ASSEMBLY__ */
  60. #endif /* ARCH_MM_MMU */
  61. #endif /*LWP_ARCH_H__*/