in arm cancellation point asm, don't unnecessarily preserve link register
authorPatrick Oppenlander <patrick.oppenlander@gmail.com>
Thu, 1 Aug 2019 04:34:59 +0000 (14:34 +1000)
committerRich Felker <dalias@aerifal.cx>
Tue, 6 Aug 2019 18:03:56 +0000 (14:03 -0400)
The only reason we needed to preserve the link register was because we
were using a branch-link instruction to branch to __cp_cancel.
Replacing this with a branch means we can avoid the save/restore as
the link register is no longer modified.

src/thread/arm/syscall_cp.s

index a5730c08b826334f550055f31703e1c69227af27..e607dd426afc66923299a6c5f1c3038893474863 100644 (file)
 .type __syscall_cp_asm,%function
 __syscall_cp_asm:
        mov ip,sp
-       stmfd sp!,{r4,r5,r6,r7,lr}
+       stmfd sp!,{r4,r5,r6,r7}
 __cp_begin:
        ldr r0,[r0]
        cmp r0,#0
-       blne __cp_cancel
+       bne __cp_cancel
        mov r7,r1
        mov r0,r2
        mov r1,r3
        ldmfd ip,{r2,r3,r4,r5,r6}
        svc 0
 __cp_end:
-       ldmfd sp!,{r4,r5,r6,r7,lr}
+       ldmfd sp!,{r4,r5,r6,r7}
        bx lr
 __cp_cancel:
-       ldmfd sp!,{r4,r5,r6,r7,lr}
+       ldmfd sp!,{r4,r5,r6,r7}
        b __cancel