Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread/arch/sh3 Adapt to new PIC macros that are now...



details:   https://anonhg.NetBSD.org/src/rev/edb3ffe58e7f
branches:  trunk
changeset: 586758:edb3ffe58e7f
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sat Dec 31 05:08:28 2005 +0000

description:
Adapt to new PIC macros that are now in <machine/asm.h>.  Same binary
code is generated (still with text relocs, but eliminating them is the
next step).

diffstat:

 lib/libpthread/arch/sh3/pthread_switch.S |  85 ++++++++++++-------------------
 1 files changed, 34 insertions(+), 51 deletions(-)

diffs (189 lines):

diff -r 741ae18207ea -r edb3ffe58e7f lib/libpthread/arch/sh3/pthread_switch.S
--- a/lib/libpthread/arch/sh3/pthread_switch.S  Sat Dec 31 05:06:33 2005 +0000
+++ b/lib/libpthread/arch/sh3/pthread_switch.S  Sat Dec 31 05:08:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_switch.S,v 1.5 2004/05/28 22:58:25 uwe Exp $ */
+/*     $NetBSD: pthread_switch.S,v 1.6 2005/12/31 05:08:28 uwe Exp $ */
        
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -59,31 +59,6 @@
 
 
 /*
- * It would be cumbersome to use ifdef PIC for every call.
- * These macros try to hide the difference.
- */
-#ifdef __STDC__
-# define CALL_TARGET(call_l,target_l)  .L_ ## target_l ## _ ## call_l
-#else
-# define CALL_TARGET(call_l,target_l)  .L_/**/target_l/**/_/**/call_l
-#endif
-
-#ifdef PIC
-#define CALL(r)                        bsrf r
-
-#define CALL_DATUM(call_l,target_l) \
-CALL_TARGET(call_l,target_l):  .long _C_LABEL(target_l) - (call_l+4)
-
-#else /* !PIC */
-#define CALL(r)                        jsr @r
-
-#define CALL_DATUM(call_l,target_l) \
-CALL_TARGET(call_l,target_l):  .long _C_LABEL(target_l)
-
-#endif /* !PIC */
-
-
-/*
  * To avoid superfluous memory loads, or consuming extra registers
  * this code makes assumptions that certain constants are small
  * enough to be used as immediate data in certain instructions or
@@ -145,15 +120,15 @@
        mov.l   .L_rnd_ctxsize, r0
        sub     r0, sp                  /* auto ucontext_t cntx; */
 
-       mov.l   CALL_TARGET(11b,_getcontext_u), r0
-11:    CALL    (r0)                    /* _getcontext_u(&cntx); */
+       mov.l   .L__getcontext_u_11, r0
+11:    CALL    r0                      /* _getcontext_u(&cntx); */
         mov    sp, r4
 
        /*
         * Edit the context so that it continues as if returning from
         * the _setcontext_u below:
         */
-       mova    _C_LABEL(pthread__switch_return_point), r0
+       mova    pthread__switch_return_point, r0
        mov.l   r0, @(UC_PC, sp)
 
        mov     #PT_UC, r0
@@ -161,8 +136,8 @@
 
        STACK_SWITCH(r5, r4)            /* r4 = next->pt_uc; */
 
-       mov.l   CALL_TARGET(12b,_setcontext_u), r0
-12:    CALL    (r0)                    /* _setcontext_u(next->pt_uc); */
+       mov.l   .L__setcontext_u_12, r0
+12:    CALL    r0                      /* _setcontext_u(next->pt_uc); */
         nop                            /* r4 already set by STACK_SWITCH */
        NOTREACHED
 
@@ -178,8 +153,10 @@
 
 
        .align  2
-CALL_DATUM(11b,_getcontext_u)
-CALL_DATUM(12b,_setcontext_u)
+.L__getcontext_u_11:
+       CALL_DATUM_LOCAL(_C_LABEL(_getcontext_u), 11b)
+.L__setcontext_u_12:
+       CALL_DATUM_LOCAL(_C_LABEL(_setcontext_u), 12b)
 
 
 
@@ -200,14 +177,15 @@
         * once we're no longer using the old stack.
         */
        mov.l   @(PT_SPINLOCKS, r2), r0
-       mov.l   CALL_TARGET(21b,_setcontext_u), r1
+       mov.l   .L__setcontext_u_21, r1
        add     #-1, r0                 /* --from->pt_spinlocks; */
-21:    CALL    (r1)                    /* _setcontext_u(to->pt_uc); */
+21:    CALL    r1                      /* _setcontext_u(to->pt_uc); */
         mov.l  r0, @(PT_SPINLOCKS, r2)
        NOTREACHED
 
        .align  2
-CALL_DATUM(21b,_setcontext_u)
+.L__setcontext_u_21:
+       CALL_DATUM_LOCAL(_C_LABEL(_setcontext_u), 21b)
 
 
 
@@ -221,13 +199,14 @@
 Lpthread__switch_away_no_decrement:
        STACK_SWITCH(r3, r4)            /* side effect: r4 = to->pt_uc */
 
-       mov.l   CALL_TARGET(31b,_setcontext_u), r1
-31:    CALL    (r1)                    /* _setcontext_u(to->pt_uc); */
+       mov.l   .L__setcontext_u_31, r1
+31:    CALL    r1                      /* _setcontext_u(to->pt_uc); */
         nop
        NOTREACHED
 
        .align  2
-CALL_DATUM(31b,_setcontext_u)
+.L__setcontext_u_31:
+       CALL_DATUM_LOCAL(_C_LABEL(_setcontext_u), 31b)
 
 
 
@@ -248,8 +227,8 @@
        add     #1, r0
        mov.l   r0, @(PT_SPINLOCKS, r5) /* ++next->pt_spinlocks */
 
-       mov.l   CALL_TARGET(41b,_getcontext_u), r0
-41:    CALL    (r0)                    /* _getcontext_u(self->pt_uc); */
+       mov.l   .L__getcontext_u_41, r0
+41:    CALL    r0                      /* _getcontext_u(self->pt_uc); */
         mov    sp, r4
 
        /*
@@ -343,8 +322,8 @@
 
 
 Llocked_no_new_preempt:
-       mov.l   CALL_TARGET(42b,_setcontext_u), r0
-42:    CALL    (r0)                    /* _setcontext_u(next->pt_uc) */
+       mov.l   .L__setcontext_u_42, r0
+42:    CALL    r0                      /* _setcontext_u(next->pt_uc) */
         nop
        NOTREACHED
 
@@ -360,8 +339,10 @@
 
 
        .align  2
-CALL_DATUM(41b,_getcontext_u)
-CALL_DATUM(42b,_setcontext_u)
+.L__getcontext_u_41:
+       CALL_DATUM_LOCAL(_C_LABEL(_getcontext_u), 41b)
+.L__setcontext_u_42:
+       CALL_DATUM_LOCAL(_C_LABEL(_setcontext_u), 42b)
 
 
 
@@ -410,9 +391,9 @@
 
 Lupcall_no_old_preempt:
        /* pthread__sa_recycle(old, new) */
-       mov.l   CALL_TARGET(51b,pthread__sa_recycle), r0
+       mov.l   .L_pthread__sa_recycle_51, r0
        mov     r8, r4          /* old = self */
-51:    CALL    (r0)
+51:    CALL    r0
         mov    r9, r5          /* new = next */
 
        /* Release the fake lock */
@@ -440,14 +421,16 @@
 
 
 Lupcall_no_new_preempt:
-       mov.l   CALL_TARGET(52b,_setcontext_u), r0
-52:    CALL    (r0)                    /* _setcontext_u(next->pt_uc); */
+       mov.l   .L__setcontext_u_52, r0
+52:    CALL    r0                      /* _setcontext_u(next->pt_uc); */
         mov    r11, r4
        NOTREACHED
 
        .align  2
-CALL_DATUM(51b,pthread__sa_recycle)
-CALL_DATUM(52b,_setcontext_u)
+.L_pthread__sa_recycle_51:
+       CALL_DATUM_LOCAL(_C_LABEL(pthread__sa_recycle), 51b)
+.L__setcontext_u_52:
+       CALL_DATUM_LOCAL(_C_LABEL(_setcontext_u), 52b)
 
 
 



Home | Main Index | Thread Index | Old Index