fix sim register & tcb info typo

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-07-17 16:33:37 +08:00 committed by Xiang Xiao
parent ea87d008a0
commit 9f644579b3
4 changed files with 16 additions and 12 deletions

View File

@ -49,7 +49,7 @@
# define JB_R13 (4*8) # define JB_R13 (4*8)
# define JB_R14 (5*8) # define JB_R14 (5*8)
# define JB_R15 (6*8) # define JB_R15 (6*8)
# define JB_RSI (7*8) # define JB_RIP (7*8)
# define JB_FLAG (8*8) # define JB_FLAG (8*8)
# else # else
@ -61,7 +61,7 @@
# define JB_R13 (4) # define JB_R13 (4)
# define JB_R14 (5) # define JB_R14 (5)
# define JB_R15 (6) # define JB_R15 (6)
# define JB_RSI (7) # define JB_RIP (7)
# define JB_FLAG (8) # define JB_FLAG (8)
# endif /* __ASSEMBLY__ */ # endif /* __ASSEMBLY__ */
@ -70,7 +70,7 @@
# define JB_FP JB_RBP # define JB_FP JB_RBP
# define JB_SP JB_RSP # define JB_SP JB_RSP
# define JB_PC JB_RSI # define JB_PC JB_RIP
#elif defined(CONFIG_HOST_X86) || defined(CONFIG_SIM_M32) #elif defined(CONFIG_HOST_X86) || defined(CONFIG_SIM_M32)
/* Storage order: %ebx, %esi, %edi, %ebp, sp, and return PC */ /* Storage order: %ebx, %esi, %edi, %ebp, sp, and return PC */
@ -84,8 +84,8 @@
# define JB_ESI (1*4) # define JB_ESI (1*4)
# define JB_EDI (2*4) # define JB_EDI (2*4)
# define JB_EBP (3*4) # define JB_EBP (3*4)
# define JB_SP (4*4) # define JB_ESP (4*4)
# define JB_PC (5*4) # define JB_EIP (5*4)
# define JB_FLAG (6*4) # define JB_FLAG (6*4)
# define JB_FLAG1 (7*4) # define JB_FLAG1 (7*4)
@ -95,8 +95,8 @@
# define JB_ESI (1) # define JB_ESI (1)
# define JB_EDI (2) # define JB_EDI (2)
# define JB_EBP (3) # define JB_EBP (3)
# define JB_SP (4) # define JB_ESP (4)
# define JB_PC (5) # define JB_EIP (5)
# define JB_FLAG (6) # define JB_FLAG (6)
# define JB_FLAG1 (7) # define JB_FLAG1 (7)
@ -105,6 +105,8 @@
/* Compatibility definitions */ /* Compatibility definitions */
# define JB_FP JB_EBP # define JB_FP JB_EBP
# define JB_SP JB_ESP
# define JB_PC JB_EIP
#elif defined(CONFIG_HOST_ARM) #elif defined(CONFIG_HOST_ARM)

View File

@ -195,7 +195,7 @@ static ssize_t tcbinfo_read(FAR struct file *filep, FAR char *buffer,
if (filep->f_pos == 0) if (filep->f_pos == 0)
{ {
linesize = procfs_snprintf(attr->line, TCBINFO_LINELEN, linesize = procfs_snprintf(attr->line, TCBINFO_LINELEN,
"pointer %p size %d\n", &g_tcbinfo, "pointer %p size %zu\n", &g_tcbinfo,
sizeof(struct tcbinfo_s)); sizeof(struct tcbinfo_s));
/* Save the linesize in case we are re-entered with f_pos > 0 */ /* Save the linesize in case we are re-entered with f_pos > 0 */

View File

@ -183,7 +183,9 @@
# define TCB_NAME_OFF 0 # define TCB_NAME_OFF 0
#endif #endif
# define TCB_REGS_OFF offsetof(struct tcb_s, xcp.regs) # define TCB_REGS_OFF offsetof(struct tcb_s, xcp.regs)
# define TCB_REG_OFF(reg) (reg * sizeof(uint32_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)
#endif #endif
/* Get a pointer to the process' memory map struct from the task_group */ /* Get a pointer to the process' memory map struct from the task_group */

View File

@ -110,7 +110,7 @@ SYMBOL(setjmp):
movq %r13, JB_R13(REGS) /* Save 5: r13 */ movq %r13, JB_R13(REGS) /* Save 5: r13 */
movq %r14, JB_R14(REGS) /* Save 6: r14 */ movq %r14, JB_R14(REGS) /* Save 6: r14 */
movq %r15, JB_R15(REGS) /* Save 7: r15 */ movq %r15, JB_R15(REGS) /* Save 7: r15 */
movq %rsi, JB_RSI(REGS) /* Save 8: Return address */ movq %rsi, JB_RIP(REGS) /* Save 8: Return address */
ret ret
@ -139,9 +139,9 @@ SYMBOL(longjmp):
movq JB_R14(REGS),%r14 /* Load 6: r14 */ movq JB_R14(REGS),%r14 /* Load 6: r14 */
movq JB_R15(REGS),%r15 /* Load 7: rbp */ movq JB_R15(REGS),%r15 /* Load 7: rbp */
/* Jump to the saved return address (rsi) */ /* Jump to the saved return address (rip) */
jmp *JB_RSI(REGS) jmp *JB_RIP(REGS)
#ifdef __ELF__ #ifdef __ELF__
.size SYMBOL(longjmp), . - SYMBOL(longjmp) .size SYMBOL(longjmp), . - SYMBOL(longjmp)