Bit of cleanup.
@@ -65,7 +65,7 @@ | ||
65 | 65 | |
66 | 66 | CC_NO_INLINE uint32_t port_get_s_psp(void) { |
67 | 67 | |
68 | - return (uint32_t)__sch_get_currthread()->ctx.syscall.s_psp; | |
68 | + return (uint32_t)__port_syscall_get_s_psp(__sch_get_currthread()); | |
69 | 69 | } |
70 | 70 | |
71 | 71 | CC_WEAK void port_syscall(struct port_extctx *ctxp, uint32_t n) { |
@@ -83,19 +83,19 @@ | ||
83 | 83 | |
84 | 84 | /* Caller context in unprivileged memory.*/ |
85 | 85 | u_psp = __get_PSP(); |
86 | - tp->ctx.syscall.u_psp = u_psp; | |
87 | 86 | ectxp = (struct port_extctx *)u_psp; |
87 | + __port_syscall_set_u_psp(tp, u_psp); | |
88 | 88 | |
89 | 89 | /* Return context for change in privileged mode.*/ |
90 | - newctxp = ((struct port_extctx *)tp->ctx.syscall.s_psp) - 1; | |
90 | + newctxp = ((struct port_extctx *)__port_syscall_get_s_psp(tp)) - 1; | |
91 | 91 | |
92 | 92 | /* Creating context for return in privileged mode.*/ |
93 | - newctxp->r0 = (uint32_t)ectxp; | |
94 | - newctxp->r1 = n; | |
95 | - newctxp->pc = (uint32_t)port_syscall; | |
96 | - newctxp->xpsr = 0x01000000U; | |
93 | + newctxp->r0 = (uint32_t)ectxp; | |
94 | + newctxp->r1 = n; | |
95 | + newctxp->pc = (uint32_t)port_syscall; | |
96 | + newctxp->xpsr = 0x01000000U; | |
97 | 97 | #if CORTEX_USE_FPU == TRUE |
98 | - newctxp->fpscr = FPU->FPDSCR; | |
98 | + newctxp->fpscr = FPU->FPDSCR; | |
99 | 99 | #endif |
100 | 100 | |
101 | 101 | /* Switching PSP to the privileged mode PSP.*/ |
@@ -104,7 +104,7 @@ | ||
104 | 104 | |
105 | 105 | CC_WEAK void __port_do_syscall_return(void) { |
106 | 106 | |
107 | - __set_PSP(__sch_get_currthread()->ctx.syscall.u_psp); | |
107 | + __set_PSP(__port_syscall_get_u_psp(__sch_get_currthread())); | |
108 | 108 | } |
109 | 109 | #endif /* PORT_USE_SYSCALL == TRUE */ |
110 | 110 |
@@ -716,6 +716,48 @@ | ||
716 | 716 | #endif |
717 | 717 | #endif /* CH_DBG_ENABLE_STACK_CHECK == TRUE */ |
718 | 718 | |
719 | +#if (PORT_USE_SYSCALL == TRUE) || defined(__DOXYGEN__) | |
720 | +/** | |
721 | + * @brief Updates the stored user PSP address. | |
722 | + * | |
723 | + * @param[in] tp pointer to the thread | |
724 | + * @param[in] addr new address | |
725 | + */ | |
726 | +#define __port_syscall_set_u_psp(tp, addr) (tp)->ctx.syscall.u_psp = (addr) | |
727 | + | |
728 | +/** | |
729 | + * @brief Updates the stored system PSP address. | |
730 | + * | |
731 | + * @param[in] tp pointer to the thread | |
732 | + * @param[in] addr new address | |
733 | + */ | |
734 | +#define __port_syscall_set_s_psp(tp, addr) (tp)->ctx.syscall.u_ssp = (addr) | |
735 | + | |
736 | +/** | |
737 | + * @brief Returns the user PSP address. | |
738 | + * | |
739 | + * @param[in] tp pointer to the thread | |
740 | + * @return The user PSP value. | |
741 | + */ | |
742 | +#define __port_syscall_get_u_psp(tp) (tp)->ctx.syscall.u_psp | |
743 | + | |
744 | +/** | |
745 | + * @brief Returns the system PSP address. | |
746 | + * | |
747 | + * @param[in] tp pointer to the thread | |
748 | + * @return The system PSP value. | |
749 | + */ | |
750 | +#define __port_syscall_get_s_psp(tp) (tp)->ctx.syscall.s_psp | |
751 | + | |
752 | +/** | |
753 | + * @brief Returns the syscall association pointer. | |
754 | + * | |
755 | + * @param[in] tp pointer to the thread | |
756 | + * @return The pointer value. | |
757 | + */ | |
758 | +#define __port_syscall_get_pointer(tp) (tp)->ctx.syscall.p | |
759 | +#endif /* PORT_USE_SYSCALL == TRUE */ | |
760 | + | |
719 | 761 | /*===========================================================================*/ |
720 | 762 | /* External declarations. */ |
721 | 763 | /*===========================================================================*/ |