arm syscalls: svcall/sycall logic needs to get the ucontext argument from R4 instead of stack since all syscall parameters pass from registers in syscall.h

This commit is contained in:
Xiang Xiao 2018-08-24 07:11:18 -06:00 committed by Gregory Nutt
parent 4824b04b44
commit 7a9309370f
4 changed files with 7 additions and 27 deletions

View File

@ -348,7 +348,7 @@ int up_svcall(int irq, FAR void *context, FAR void *arg)
* R1 = sighand
* R2 = signo
* R3 = info
* ucontext (on the stack)
* R4 = ucontext
*/
#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS)
@ -375,12 +375,7 @@ int up_svcall(int irq, FAR void *context, FAR void *arg)
regs[REG_R0] = regs[REG_R1]; /* sighand */
regs[REG_R1] = regs[REG_R2]; /* signal */
regs[REG_R2] = regs[REG_R3]; /* info */
/* The last parameter, ucontext, is trickier. The ucontext
* parameter will reside at an offset of 4 from the stack pointer.
*/
regs[REG_R3] = *(uint32_t *)(regs[REG_SP]+4);
regs[REG_R3] = regs[REG_R4]; /* ucontext */
}
break;
#endif

View File

@ -350,12 +350,7 @@ uint32_t *arm_syscall(uint32_t *regs)
regs[REG_R0] = regs[REG_R1]; /* sighand */
regs[REG_R1] = regs[REG_R2]; /* signal */
regs[REG_R2] = regs[REG_R3]; /* info */
/* The last parameter, ucontext, is trickier. The ucontext
* parameter will reside at an offset of 4 from the stack pointer.
*/
regs[REG_R3] = *(uint32_t *)(regs[REG_SP]+4);
regs[REG_R3] = regs[REG_R4]; /* ucontext */
#ifdef CONFIG_ARCH_KERNEL_STACK
/* If we are signalling a user process, then we must be operating

View File

@ -348,7 +348,7 @@ int up_svcall(int irq, FAR void *context, FAR void *arg)
* R1 = sighand
* R2 = signo
* R3 = info
* ucontext (on the stack)
* R4 = ucontext
*/
#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS)
@ -375,12 +375,7 @@ int up_svcall(int irq, FAR void *context, FAR void *arg)
regs[REG_R0] = regs[REG_R1]; /* sighand */
regs[REG_R1] = regs[REG_R2]; /* signal */
regs[REG_R2] = regs[REG_R3]; /* info */
/* The last parameter, ucontext, is trickier. The ucontext
* parameter will reside at an offset of 4 from the stack pointer.
*/
regs[REG_R3] = *(uint32_t *)(regs[REG_SP]+4);
regs[REG_R3] = regs[REG_R4]; /* ucontext */
}
break;
#endif

View File

@ -322,7 +322,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* R1 = sighand
* R2 = signo
* R3 = info
* ucontext (on the stack)
* R4 = ucontext
*/
case SYS_signal_handler:
@ -348,12 +348,7 @@ uint32_t *arm_syscall(uint32_t *regs)
regs[REG_R0] = regs[REG_R1]; /* sighand */
regs[REG_R1] = regs[REG_R2]; /* signal */
regs[REG_R2] = regs[REG_R3]; /* info */
/* The last parameter, ucontext, is trickier. The ucontext
* parameter will reside at an offset of 4 from the stack pointer.
*/
regs[REG_R3] = *(uint32_t *)(regs[REG_SP]+4);
regs[REG_R3] = regs[REG_R4]; /* ucontext */
#ifdef CONFIG_ARCH_KERNEL_STACK
/* If we are signalling a user process, then we must be operating