mirror of
https://github.com/apache/nuttx.git
synced 2026-09-01 06:33:00 +00:00
arch/mips: Add option to use mips syscall instruction for syscalls
When enabled, the change fixes random crashing on Ingenic JZ4780. Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
This commit is contained in:
parent
05df45dfee
commit
3ffe5a9358
4 changed files with 45 additions and 0 deletions
|
|
@ -92,6 +92,10 @@ config MIPS32_FRAMEPOINTER
|
|||
Register r30 may be a frame pointer in some ABIs. Or may just be
|
||||
saved register s8. It makes a difference for fork handling.
|
||||
|
||||
config MIPS32_USE_SYSCALL_INSTRUCTION
|
||||
bool
|
||||
default n
|
||||
|
||||
config MIPS32_HAVE_ICACHE
|
||||
bool
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ irqstate_t up_irq_save(void)
|
|||
status = cp0_getstatus(); /* Get CP0 status */
|
||||
ret = status; /* Save the status */
|
||||
status &= ~CP0_STATUS_INT_MASK; /* Clear all interrupt mask bits */
|
||||
#ifndef CONFIG_MIPS32_USE_SYSCALL_INSTRUCTION
|
||||
status |= CP0_STATUS_INT_SW0; /* Enable only the SW0 interrupt */
|
||||
#endif
|
||||
cp0_putstatus(status); /* Disable the rest of interrupts */
|
||||
return ret; /* Return saved status */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,9 @@ void up_schedule_sigaction(struct tcb_s *tcb)
|
|||
up_current_regs()[REG_EPC] = (uint32_t)mips_sigdeliver;
|
||||
status = up_current_regs()[REG_STATUS];
|
||||
status &= ~CP0_STATUS_INT_MASK;
|
||||
#ifndef CONFIG_MIPS32_USE_SYSCALL_INSTRUCTION
|
||||
status |= CP0_STATUS_INT_SW0;
|
||||
#endif
|
||||
up_current_regs()[REG_STATUS] = status;
|
||||
|
||||
/* And make sure that the saved context in the TCB
|
||||
|
|
@ -145,7 +147,9 @@ void up_schedule_sigaction(struct tcb_s *tcb)
|
|||
tcb->xcp.regs[REG_EPC] = (uint32_t)mips_sigdeliver;
|
||||
status = tcb->xcp.regs[REG_STATUS];
|
||||
status &= ~CP0_STATUS_INT_MASK;
|
||||
#ifndef CONFIG_MIPS32_USE_SYSCALL_INSTRUCTION
|
||||
status |= CP0_STATUS_INT_SW0;
|
||||
#endif
|
||||
tcb->xcp.regs[REG_STATUS] = status;
|
||||
|
||||
sinfo("PC/STATUS Saved: %08" PRIx32 "/%08" PRIx32
|
||||
|
|
|
|||
|
|
@ -51,6 +51,39 @@
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_syscall0, up_syscall1, up_syscall2, up_syscall3
|
||||
*
|
||||
* Description:
|
||||
* up_syscall0 - System call SYS_ argument and no additional parameters.
|
||||
* up_syscall1 - System call SYS_ argument and one additional parameter.
|
||||
* up_syscall2 - System call SYS_ argument and two additional parameters.
|
||||
* up_syscall3 - System call SYS_ argument and three additional parameters.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_MIPS32_USE_SYSCALL_INSTRUCTION
|
||||
|
||||
.text
|
||||
.set noreorder
|
||||
.set nomips16
|
||||
#ifdef CONFIG_MIPS_MICROMIPS
|
||||
.set micromips
|
||||
#endif
|
||||
.ent sys_call0
|
||||
|
||||
sys_call0:
|
||||
sys_call1:
|
||||
sys_call2:
|
||||
sys_call3:
|
||||
|
||||
syscall
|
||||
|
||||
j ra
|
||||
nop
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_syscall0, up_syscall1, up_syscall2, up_syscall3
|
||||
*
|
||||
|
|
@ -102,4 +135,6 @@ sys_call3: /* r4 holds the syscall number, arguments in r5, r6, and r7 */
|
|||
|
||||
j ra
|
||||
nop
|
||||
#endif
|
||||
|
||||
.end sys_call0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue