URI: 
       tarm: build fixes - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 9cf92718e9f2e82c7d1f2a896b5c93b01f1ad073
   DIR parent c1f950fc32d55890e0b914d9368657b23122dd59
  HTML Author: Richard Miller <millerresearch@gmail.com>
       Date:   Wed, 18 May 2011 13:20:56 -0400
       
       arm: build fixes
       
       Get p9p to build cleanly for ARM - based on suggestions from rsc and eekee, plus a final tweak from me.  Tested (a bit) on sheevaplug (ubuntu jaunty), Nokia N800 (maemo 4) and Nokia N900 (maemo 5).
       
       R=rsc
       CC=plan9port.codebot
       http://codereview.appspot.com/4524056
       
       Diffstat:
         A src/libmp/arm/mkfile                |       4 ++++
         A src/libsec/arm/mkfile               |       4 ++++
         M src/libthread/Linux-arm-swapcontex… |      26 +++++++++++++-------------
         M src/libthread/sysofiles.sh          |       3 ---
         M src/libthread/threadimpl.h          |       8 ++++----
       
       5 files changed, 25 insertions(+), 20 deletions(-)
       ---
   DIR diff --git a/src/libmp/arm/mkfile b/src/libmp/arm/mkfile
       t@@ -0,0 +1,4 @@
       +all:
       +
       +%:V:
       +        # nothing to see here
   DIR diff --git a/src/libsec/arm/mkfile b/src/libsec/arm/mkfile
       t@@ -0,0 +1,4 @@
       +all:
       +
       +%:V:
       +        # nothing to see here
   DIR diff --git a/src/libthread/Linux-arm-swapcontext.c b/src/libthread/Linux-arm-swapcontext.c
       t@@ -3,24 +3,24 @@
        void
        makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
        {
       -        int i, *sp;
       -        va_list arg;
       -        
       -        sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
       -        va_start(arg, argc);
       -        for(i=0; i<4 && i<argc; i++)
       -                uc->uc_mcontext.gregs[i] = va_arg(arg, uint);
       -        va_end(arg);
       -        uc->uc_mcontext.gregs[13] = (uint)sp;
       -        uc->uc_mcontext.gregs[14] = (uint)fn;
       +        int i, *sp;
       +        va_list arg;
       +
       +        sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
       +        va_start(arg, argc);
       +        for(i=0; i<4 && i<argc; i++)
       +                (&uc->uc_mcontext.arm_r0)[i] = va_arg(arg, uint);
       +        va_end(arg);
       +        uc->uc_mcontext.arm_sp = (uint)sp;
       +        uc->uc_mcontext.arm_lr = (uint)fn;
        }
        
        int
        swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
        {
       -        if(getcontext(oucp) == 0)
       -                setcontext(ucp);
       -        return 0;
       +        if(getcontext(oucp) == 0)
       +                setcontext(ucp);
       +        return 0;
        }
        
        
   DIR diff --git a/src/libthread/sysofiles.sh b/src/libthread/sysofiles.sh
       t@@ -4,9 +4,6 @@ test -f $PLAN9/config && . $PLAN9/config
        
        tag="$OBJTYPE-$SYSNAME-${SYSVERSION:-`uname -r`}-${CC9:-cc}"
        case "$tag" in
       -arm-Linux-*)
       -        echo ${SYSNAME}-${OBJTYPE}-asm.o $SYSNAME.o
       -        ;;        
        *-Linux-2.6.*)
                echo pthread.o
                ;;
   DIR diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h
       t@@ -73,10 +73,10 @@ but surely the latter would be defined(__sparc__).
        */
        
        #if defined(__arm__)
       -int mygetmcontext(mcontext_t*);
       -void mysetmcontext(const mcontext_t*);
       -#define        setcontext(u)        mysetmcontext(&(u)->uc_mcontext)
       -#define        getcontext(u)        mygetmcontext(&(u)->uc_mcontext)
       +int mygetmcontext(ulong*);
       +void mysetmcontext(const ulong*);
       +#define        setcontext(u)        mysetmcontext(&(u)->uc_mcontext.arm_r0)
       +#define        getcontext(u)        mygetmcontext(&(u)->uc_mcontext.arm_r0)
        #endif