arch: arm: push ssf to thread privileged stack to complete stack frame

Pushes the seventh argument named ssf to thread's privileged
stack to follow below syscall prototype.

uintptr_t z_mrsh_xx(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
		    uintptr_t arg3, uintptr_t arg4, void *more, void *ssf)

Fixes: #29386.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
This commit is contained in:
Wentong Wu 2020-10-28 06:08:02 -04:00 committed by Anas Nashif
commit bfc7785da0

View file

@ -374,6 +374,9 @@ SECTION_FUNC(TEXT, z_arm_do_syscall)
mov r1, lr mov r1, lr
b dispatch_syscall b dispatch_syscall
valid_syscall: valid_syscall:
/* push ssf to privileged stack */
mov r1, sp
push {r1}
/* push args to complete stack frame */ /* push args to complete stack frame */
push {r4,r5} push {r4,r5}
@ -396,8 +399,7 @@ dispatch_syscall:
*/ */
mov ip, r0 mov ip, r0
mov r0, sp mov r0, sp
adds r0, #12 ldr r0, [r0,#16]
ldr r0, [r0]
mov lr, r0 mov lr, r0
/* Restore r0 */ /* Restore r0 */
mov r0, ip mov r0, ip
@ -415,7 +417,8 @@ dispatch_syscall:
valid_syscall: valid_syscall:
/* push args to complete stack frame */ /* push args to complete stack frame */
push {r4,r5} mov ip, sp
push {r4,r5,ip}
dispatch_syscall: dispatch_syscall:
ldr ip, =_k_syscall_table ldr ip, =_k_syscall_table
@ -426,7 +429,7 @@ dispatch_syscall:
blx ip blx ip
/* restore LR */ /* restore LR */
ldr lr, [sp,#12] ldr lr, [sp,#16]
#endif #endif
@ -467,14 +470,14 @@ dispatch_syscall:
/* set stack back to unprivileged stack */ /* set stack back to unprivileged stack */
mov ip, r0 mov ip, r0
mov r0, sp mov r0, sp
ldr r0, [r0,#8] ldr r0, [r0,#12]
msr PSP, r0 msr PSP, r0
/* Restore r0 */ /* Restore r0 */
mov r0, ip mov r0, ip
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) #elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
/* set stack back to unprivileged stack */ /* set stack back to unprivileged stack */
ldr ip, [sp,#8] ldr ip, [sp,#12]
msr PSP, ip msr PSP, ip
#endif #endif