• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision15622 (tree)
Time2022-05-10 20:47:40
Authorgdisirio

Log Message

Bit of cleanup.

Change Summary

Incremental Difference

--- trunk/os/common/ports/ARMv7-M-ALT/chcore.c (revision 15621)
+++ trunk/os/common/ports/ARMv7-M-ALT/chcore.c (revision 15622)
@@ -65,7 +65,7 @@
6565
6666 CC_NO_INLINE uint32_t port_get_s_psp(void) {
6767
68- return (uint32_t)__sch_get_currthread()->ctx.syscall.s_psp;
68+ return (uint32_t)__port_syscall_get_s_psp(__sch_get_currthread());
6969 }
7070
7171 CC_WEAK void port_syscall(struct port_extctx *ctxp, uint32_t n) {
@@ -83,19 +83,19 @@
8383
8484 /* Caller context in unprivileged memory.*/
8585 u_psp = __get_PSP();
86- tp->ctx.syscall.u_psp = u_psp;
8786 ectxp = (struct port_extctx *)u_psp;
87+ __port_syscall_set_u_psp(tp, u_psp);
8888
8989 /* 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;
9191
9292 /* 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;
9797 #if CORTEX_USE_FPU == TRUE
98- newctxp->fpscr = FPU->FPDSCR;
98+ newctxp->fpscr = FPU->FPDSCR;
9999 #endif
100100
101101 /* Switching PSP to the privileged mode PSP.*/
@@ -104,7 +104,7 @@
104104
105105 CC_WEAK void __port_do_syscall_return(void) {
106106
107- __set_PSP(__sch_get_currthread()->ctx.syscall.u_psp);
107+ __set_PSP(__port_syscall_get_u_psp(__sch_get_currthread()));
108108 }
109109 #endif /* PORT_USE_SYSCALL == TRUE */
110110
--- trunk/os/common/ports/ARMv7-M-ALT/chcore.h (revision 15621)
+++ trunk/os/common/ports/ARMv7-M-ALT/chcore.h (revision 15622)
@@ -716,6 +716,48 @@
716716 #endif
717717 #endif /* CH_DBG_ENABLE_STACK_CHECK == TRUE */
718718
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+
719761 /*===========================================================================*/
720762 /* External declarations. */
721763 /*===========================================================================*/
Show on old repository browser