Bit of cleanup.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15622 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
57f0dcf26d
commit
a3d8eb7e71
|
@ -65,7 +65,7 @@ CC_NO_INLINE void port_syslock_noinline(void) {
|
|||
|
||||
CC_NO_INLINE uint32_t port_get_s_psp(void) {
|
||||
|
||||
return (uint32_t)__sch_get_currthread()->ctx.syscall.s_psp;
|
||||
return (uint32_t)__port_syscall_get_s_psp(__sch_get_currthread());
|
||||
}
|
||||
|
||||
CC_WEAK void port_syscall(struct port_extctx *ctxp, uint32_t n) {
|
||||
|
@ -83,19 +83,19 @@ CC_WEAK void __port_do_syscall_entry(uint32_t n) {
|
|||
|
||||
/* Caller context in unprivileged memory.*/
|
||||
u_psp = __get_PSP();
|
||||
tp->ctx.syscall.u_psp = u_psp;
|
||||
ectxp = (struct port_extctx *)u_psp;
|
||||
__port_syscall_set_u_psp(tp, u_psp);
|
||||
|
||||
/* Return context for change in privileged mode.*/
|
||||
newctxp = ((struct port_extctx *)tp->ctx.syscall.s_psp) - 1;
|
||||
newctxp = ((struct port_extctx *)__port_syscall_get_s_psp(tp)) - 1;
|
||||
|
||||
/* Creating context for return in privileged mode.*/
|
||||
newctxp->r0 = (uint32_t)ectxp;
|
||||
newctxp->r1 = n;
|
||||
newctxp->pc = (uint32_t)port_syscall;
|
||||
newctxp->xpsr = 0x01000000U;
|
||||
newctxp->r0 = (uint32_t)ectxp;
|
||||
newctxp->r1 = n;
|
||||
newctxp->pc = (uint32_t)port_syscall;
|
||||
newctxp->xpsr = 0x01000000U;
|
||||
#if CORTEX_USE_FPU == TRUE
|
||||
newctxp->fpscr = FPU->FPDSCR;
|
||||
newctxp->fpscr = FPU->FPDSCR;
|
||||
#endif
|
||||
|
||||
/* Switching PSP to the privileged mode PSP.*/
|
||||
|
@ -104,7 +104,7 @@ CC_WEAK void __port_do_syscall_entry(uint32_t n) {
|
|||
|
||||
CC_WEAK void __port_do_syscall_return(void) {
|
||||
|
||||
__set_PSP(__sch_get_currthread()->ctx.syscall.u_psp);
|
||||
__set_PSP(__port_syscall_get_u_psp(__sch_get_currthread()));
|
||||
}
|
||||
#endif /* PORT_USE_SYSCALL == TRUE */
|
||||
|
||||
|
|
|
@ -716,6 +716,48 @@ struct port_context {
|
|||
#endif
|
||||
#endif /* CH_DBG_ENABLE_STACK_CHECK == TRUE */
|
||||
|
||||
#if (PORT_USE_SYSCALL == TRUE) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Updates the stored user PSP address.
|
||||
*
|
||||
* @param[in] tp pointer to the thread
|
||||
* @param[in] addr new address
|
||||
*/
|
||||
#define __port_syscall_set_u_psp(tp, addr) (tp)->ctx.syscall.u_psp = (addr)
|
||||
|
||||
/**
|
||||
* @brief Updates the stored system PSP address.
|
||||
*
|
||||
* @param[in] tp pointer to the thread
|
||||
* @param[in] addr new address
|
||||
*/
|
||||
#define __port_syscall_set_s_psp(tp, addr) (tp)->ctx.syscall.u_ssp = (addr)
|
||||
|
||||
/**
|
||||
* @brief Returns the user PSP address.
|
||||
*
|
||||
* @param[in] tp pointer to the thread
|
||||
* @return The user PSP value.
|
||||
*/
|
||||
#define __port_syscall_get_u_psp(tp) (tp)->ctx.syscall.u_psp
|
||||
|
||||
/**
|
||||
* @brief Returns the system PSP address.
|
||||
*
|
||||
* @param[in] tp pointer to the thread
|
||||
* @return The system PSP value.
|
||||
*/
|
||||
#define __port_syscall_get_s_psp(tp) (tp)->ctx.syscall.s_psp
|
||||
|
||||
/**
|
||||
* @brief Returns the syscall association pointer.
|
||||
*
|
||||
* @param[in] tp pointer to the thread
|
||||
* @return The pointer value.
|
||||
*/
|
||||
#define __port_syscall_get_pointer(tp) (tp)->ctx.syscall.p
|
||||
#endif /* PORT_USE_SYSCALL == TRUE */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
|
Loading…
Reference in New Issue