From c1d2a487bb47d3f345f87d9bc378d78f679631c2 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 6 Sep 2022 17:59:37 +0000 Subject: [PATCH] Moved code around for clarity, preparing for "fastcalls". git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15768 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/sb/host/sbapi.c | 17 +++++++++++++++++ os/sb/host/sbvrq.c | 16 +++++++--------- os/sb/host/sbvrq.h | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/os/sb/host/sbapi.c b/os/sb/host/sbapi.c index f6b065127..dc9dbb57c 100644 --- a/os/sb/host/sbapi.c +++ b/os/sb/host/sbapi.c @@ -1259,4 +1259,21 @@ void __port_do_syscall_entry(uint32_t n) { __set_PSP((uint32_t)newctxp); } +/** + * @brief Redefined syscall return vector with VRQ handling. + */ +void __port_do_syscall_return(void) { + thread_t *tp; + struct port_extctx *ectxp; + + tp = __sch_get_currthread(); + ectxp = (struct port_extctx *)__port_syscall_get_u_psp(tp); + +#if SB_CFG_ENABLE_VRQ == TRUE + __sb_vrq_check_pending((sb_class_t *)tp->ctx.syscall.p, ectxp); +#else + __set_PSP((uint32_t)ectxp); +#endif +} + /** @} */ diff --git a/os/sb/host/sbvrq.c b/os/sb/host/sbvrq.c index 1b3d9e9b1..a9b78b61e 100644 --- a/os/sb/host/sbvrq.c +++ b/os/sb/host/sbvrq.c @@ -366,16 +366,14 @@ void sb_api_vrq_return(struct port_extctx *ectxp) { } /** - * @brief Redefined syscall return vector with VRQ handling. + * @brief Checks for pending VRQs, creates a return context if any. + * + * @param[in] sbp pointer to a @p sb_class_t structure + * @param[in] ectxp current return context + * + * @notapi */ -void __port_do_syscall_return(void) { - thread_t *tp; - struct port_extctx *ectxp; - sb_class_t *sbp; - - tp = __sch_get_currthread(); - ectxp = (struct port_extctx *)__port_syscall_get_u_psp(tp); - sbp = (sb_class_t *)tp->ctx.syscall.p; +void __sb_vrq_check_pending(sb_class_t *sbp, struct port_extctx *ectxp) { /* Processing pending VRQs if enabled.*/ if (((sbp->vrq_isr & SB_VRQ_ISR_DISABLED) == 0U)) { diff --git a/os/sb/host/sbvrq.h b/os/sb/host/sbvrq.h index 2072a5b35..8478dc99f 100644 --- a/os/sb/host/sbvrq.h +++ b/os/sb/host/sbvrq.h @@ -77,6 +77,7 @@ extern "C" { void sb_api_vrq_enable(struct port_extctx *ectxp); void sb_api_vrq_getisr(struct port_extctx *ectxp); void sb_api_vrq_return(struct port_extctx *ectxp); + void __sb_vrq_check_pending(sb_class_t *sbp, struct port_extctx *ectxp); #ifdef __cplusplus } #endif