Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/arch/sparc/atomic Add PIC variant for fetchi...



details:   https://anonhg.NetBSD.org/src/rev/10b9082c0342
branches:  trunk
changeset: 762541:10b9082c0342
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Feb 22 18:45:10 2011 +0000

description:
Add PIC variant for fetching the lock address.

librump.so now works on sparc

diffstat:

 common/lib/libc/arch/sparc/atomic/atomic_cas.S |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r d0ec3fa682e1 -r 10b9082c0342 common/lib/libc/arch/sparc/atomic/atomic_cas.S
--- a/common/lib/libc/arch/sparc/atomic/atomic_cas.S    Tue Feb 22 18:43:20 2011 +0000
+++ b/common/lib/libc/arch/sparc/atomic/atomic_cas.S    Tue Feb 22 18:45:10 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas.S,v 1.10 2009/03/13 16:40:22 nakayama Exp $ */
+/*     $NetBSD: atomic_cas.S,v 1.11 2011/02/22 18:45:10 pooka Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -63,15 +63,29 @@
 #if defined(MULTIPROCESSOR)
        .section .bss
        .align  1024
+#ifdef PIC
+       .globl _C_LABEL(_atomic_cas_locktab)
+#endif
 OTYPE(_C_LABEL(_atomic_cas_locktab))
 _C_LABEL(_atomic_cas_locktab):
        .space  1024
 
+#ifdef PIC
+/* o4 is not used for PSR in PIC cases, so we can use it here */
+#define GETLOCKTAB                                                     \
+       PIC_PROLOGUE(%o3,%o4)                                           ;\
+       set _C_LABEL(_atomic_cas_locktab), %o4                          ;\
+       ld [%o3 + %o4], %o3
+#else
+#define GETLOCKTAB                                                     \
+       sethi   %hi(_C_LABEL(_atomic_cas_locktab)), %o3
+#endif
+
 #define        ACQUIRE_INTERLOCK                                                \
        DISABLE_INTERRUPTS                                              ;\
        srl     %o0, 3, %o5                     /* get lock address */  ;\
        and     %o5, 1023, %o5                                          ;\
-       sethi   %hi(_C_LABEL(_atomic_cas_locktab)), %o3                 ;\
+       GETLOCKTAB                                                      ;\
        add     %o5, %o3, %o5                                           ;\
                                                                        ;\
        /* %o5 has interlock address */                                 ;\



Home | Main Index | Thread Index | Old Index