This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 12efdfd7647c44d7d19d272c357edc62f87ea39a Author: xuxingliang <[email protected]> AuthorDate: Wed Apr 9 16:26:15 2025 +0800 arch/tricore: fix the tcb offset of reginfo The upper registers start from 0 but are located after the lower registers. Also add parentheses around the TCB_REG_OFF() argument, so that expressions such as TCB_REG_OFF(16 + REG_D8) are evaluated correctly. Signed-off-by: xuxingliang <[email protected]> --- arch/tricore/src/common/tricore_tcbinfo.c | 30 +++++++++++++++--------------- include/nuttx/sched.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/tricore/src/common/tricore_tcbinfo.c b/arch/tricore/src/common/tricore_tcbinfo.c index da0acae5e9d..7c1b2c80999 100644 --- a/arch/tricore/src/common/tricore_tcbinfo.c +++ b/arch/tricore/src/common/tricore_tcbinfo.c @@ -52,21 +52,21 @@ static const uint16_t g_reg_offs[] = TCB_REG_OFF(REG_A5), TCB_REG_OFF(REG_A6), TCB_REG_OFF(REG_A7), - TCB_REG_OFF(REG_PSW), - TCB_REG_OFF(REG_A10), - TCB_REG_OFF(REG_UA11), - TCB_REG_OFF(REG_D8), - TCB_REG_OFF(REG_D9), - TCB_REG_OFF(REG_D10), - TCB_REG_OFF(REG_D11), - TCB_REG_OFF(REG_A12), - TCB_REG_OFF(REG_A13), - TCB_REG_OFF(REG_A14), - TCB_REG_OFF(REG_A15), - TCB_REG_OFF(REG_D12), - TCB_REG_OFF(REG_D13), - TCB_REG_OFF(REG_D14), - TCB_REG_OFF(REG_D15), + TCB_REG_OFF(16 + REG_PSW), + TCB_REG_OFF(16 + REG_A10), + TCB_REG_OFF(16 + REG_UA11), + TCB_REG_OFF(16 + REG_D8), + TCB_REG_OFF(16 + REG_D9), + TCB_REG_OFF(16 + REG_D10), + TCB_REG_OFF(16 + REG_D11), + TCB_REG_OFF(16 + REG_A12), + TCB_REG_OFF(16 + REG_A13), + TCB_REG_OFF(16 + REG_A14), + TCB_REG_OFF(16 + REG_A15), + TCB_REG_OFF(16 + REG_D12), + TCB_REG_OFF(16 + REG_D13), + TCB_REG_OFF(16 + REG_D14), + TCB_REG_OFF(16 + REG_D15), }; /**************************************************************************** diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 04747b34428..5d54bb2a439 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -198,7 +198,7 @@ # define TCB_NAME_OFF 0 #endif #define TCB_REGS_OFF offsetof(struct tcb_s, xcp.regs) -#define TCB_REG_OFF(reg) (reg * sizeof(uintptr_t)) +#define TCB_REG_OFF(reg) ((reg) * sizeof(uintptr_t)) #define TCB_STACK_OFF offsetof(struct tcb_s, stack_base_ptr) #define TCB_STACK_SIZE_OFF offsetof(struct tcb_s, adj_stack_size)
