Port-sh3 archive

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

sh3 build error



Hi,

there is a build error which occurs while cross-building
rf_copyback.c as part of sys/rump/dev/lib/libraidframe for the
sh3 ports.  The new assembler is apparently more picky, and won't
let

        tas.b @(r0,r9)

pass through, as in this snippet:

rf_CopybackComplete:
        mov.l   r8,@-r15
        tst     r5,r5
        mov.l   r9,@-r15
        mov     r5,r6
        mov.l   r10,@-r15
        mov     r4,r10
        mov.l   r14,@-r15
        sts.l   pr,@-r15
        add     #-12,r15
        mov     r15,r14
        bf.s    .L51
        mov.l   @r4,r9
        mov.w   .L63,r0
        1:      tas.b   @(r0,r9)
        bf      1b

which is taken from the gcc-generated file (the leading tab
before the 1: label can be elminated for the cost of a newline,
but isn't itself the problem).

Nick traced this back to __cpu_simple_lock(), which does this:

static __inline void
__cpu_simple_lock(__cpu_simple_lock_t *alp)
{

         __asm volatile(
                "1:     tas.b   %0      \n"
                "       bf      1b      \n"
                : "=m" (*alp)
                : /* no inputs */
                : "cc");
}

and apparently the actual pointer isn't readily available in a
register at that point.

Even though I don't know the sh3 architecture at all, I hope I
found a fix for this problem:


Index: lock.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sh3/include/lock.h,v
retrieving revision 1.15
diff -u -p -r1.15 lock.h
--- lock.h      28 Apr 2008 20:23:35 -0000      1.15
+++ lock.h      12 Oct 2009 10:23:37 -0000
@@ -81,9 +81,10 @@ __cpu_simple_lock(__cpu_simple_lock_t *a
 {
 
         __asm volatile(
-               "1:     tas.b   %0      \n"
+               "\n"
+               "1:     tas.b   @%0     \n"
                "       bf      1b      \n"
-               : "=m" (*alp)
+               : "=r" (alp)
                : /* no inputs */
                : "cc");
 }
@@ -94,9 +95,9 @@ __cpu_simple_lock_try(__cpu_simple_lock_
        int __rv;
 
        __asm volatile(
-               "       tas.b   %0      \n"
+               "       tas.b   @%0     \n"
                "       movt    %1      \n"
-               : "=m" (*alp), "=r" (__rv)
+               : "=r" (alp), "=r" (__rv)
                : /* no inputs */
                : "cc");

Comments?

Regards,

- Håvard


Home | Main Index | Thread Index | Old Index