Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/arm Fix previous. For Thumb-1:



details:   https://anonhg.NetBSD.org/src/rev/b70e1593dc16
branches:  trunk
changeset: 379994:b70e1593dc16
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Jun 30 00:00:49 2021 +0000

description:
Fix previous. For Thumb-1:
- sp cannot be manipulated directly
- {add,sub}s should be used instead of {add,sub}

diffstat:

 lib/libc/arch/arm/gen/swapcontext.S |  12 ++++++++----
 lib/libc/arch/arm/sys/__clone.S     |  10 +++++++---
 2 files changed, 15 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r 8a20fd0a3bfb -r b70e1593dc16 lib/libc/arch/arm/gen/swapcontext.S
--- a/lib/libc/arch/arm/gen/swapcontext.S       Tue Jun 29 23:29:12 2021 +0000
+++ b/lib/libc/arch/arm/gen/swapcontext.S       Wed Jun 30 00:00:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $     */
+/*     $NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "assym.h"
 
 #if defined(LIBC_SCCS) && !defined(lint)
-        RCSID("$NetBSD: swapcontext.S,v 1.16 2021/06/29 23:29:12 rin Exp $")
+        RCSID("$NetBSD: swapcontext.S,v 1.17 2021/06/30 00:00:49 rin Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 ENTRY(swapcontext)
@@ -85,9 +85,13 @@ 1:
        b       PLT_SYM(_C_LABEL(setcontext))
 #else
        push    {lr}
-       sub     sp, #4
+       mov     r1, sp
+       subs    r1, #4
+       mov     sp, r1
        bl      PLT_SYM(_C_LABEL(setcontext))
-       add     sp, #4
+       mov     r1, sp
+       adds    r1, #4
+       mov     sp, r1
        pop     {pc}
 #endif
 #if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__)
diff -r 8a20fd0a3bfb -r b70e1593dc16 lib/libc/arch/arm/sys/__clone.S
--- a/lib/libc/arch/arm/sys/__clone.S   Tue Jun 29 23:29:12 2021 +0000
+++ b/lib/libc/arch/arm/sys/__clone.S   Wed Jun 30 00:00:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.10 2021/06/29 23:29:12 rin Exp $ */
+/* $NetBSD: __clone.S,v 1.11 2021/06/30 00:00:49 rin Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher Gilbert
@@ -122,9 +122,13 @@ 1:
 #else
 .Lcerror:
        push    {lr}
-       sub     sp, #4
+       mov     r1, sp
+       subs    r1, #4
+       mov     sp, r1
        bl      CERROR
-       add     sp, #4
+       mov     r1, sp
+       adds    r1, #4
+       mov     sp, r1
        pop     {pc}
 #endif
 END(__clone)



Home | Main Index | Thread Index | Old Index