Re: sparc implementation

From: Paul H. Hargrove (PHHargrove_at_lbl_dot_gov)
Date: Wed Sep 03 2008 - 21:11:48 PDT

  • Next message: Paul H. Hargrove: "Re: blcr 0.7.3: core dump file"
    This one is easy.
    
    Where you have
        #define cri_syscall3(type,name,nr,arg1,arg2,arg3)
    you should instead change all instanes of "arg" to "type" have
        #define cri_syscall3(type,name,nr,type1,type2,type3)
    
    Otherwise you are expanding
        cri_syscall3(int, __cri_ioctl, __NR_ioctl, int, int, void*)
    to have a first line like:
        int __cri_ioctl(type1 int, type2 int, type3 void*, int *errno_p)
    when you want something like:
        int __cri_ioctl(int arg1, int arg2, void* arg3, int *errno_p)
    
    I am guessing that once you have this done, you will find that there are 
    still problems.  Once you can  get far enough run the tests, we'll find out.
    
    -Paul
    
    Vincentius Robby wrote:
    > Hello Paul,
    >
    > Ah, I'm learning a lot here..
    > The next step that I haven't been able to figure out is the errors 
    > which I referenced in the previous e-mail:
    >
    >         then mv -f ".deps/libcr_la-cr_syscall.Tpo" 
    > ".deps/libcr_la-cr_syscall.Plo"; else rm -f 
    > ".deps/libcr_la-cr_syscall.Tpo"; exit 1; fi
    >  gcc -DHAVE_CONFIG_H -I. -I../../libcr -I.. -D_GNU_SOURCE -D_REENTRANT 
    > -I../include -I../../include -I../../libcr/arch/sparc/ -Wall 
    > -Wno-unused-function -fno-stack-protector -g -O2 -MT 
    > libcr_la-cr_syscall.lo -MD -MP -MF .deps/libcr_la-cr_syscall.Tpo -c 
    > ../../libcr/cr_syscall.c  -fPIC -DPIC -o .libs/libcr_la-cr_syscall.o
    > ../../libcr/cr_syscall.c:169: error: expected ')' before 'int'
    > ../../libcr/cr_syscall.c:170: error: expected ')' before 'const'
    > ../../libcr/cr_syscall.c:171: error: expected ')' before 'int'
    > ../../libcr/cr_syscall.c: In function '__cri_sched_yield':
    > ../../libcr/cr_syscall.c:172: warning: initialization makes integer 
    > from pointer without a cast
    > ../../libcr/cr_syscall.c: At top level:
    > ../../libcr/cr_syscall.c:173: error: expected ')' before 'const'
    > ../../libcr/cr_syscall.c:174: error: expected ')' before 'int'
    > ../../libcr/cr_syscall.c:176: error: expected ')' before 'int'
    > ../../libcr/cr_syscall.c:183: error: expected ')' before 'int'
    > ../../libcr/cr_syscall.c:189: error: expected ')' before 'int'
    > make[2]: *** [libcr_la-cr_syscall.lo] Error 1
    > make[2]: Leaving directory `/opt/blcr-0.7.3_vincent/builddir/libcr'
    > make[1]: *** [all-recursive] Error 1
    > make[1]: Leaving directory `/opt/blcr-0.7.3_vincent/builddir'
    > make: *** [all] Error 2
    >
    > Here is the snippet from cr_syscall.c
    > 169:cri_syscall3(int, __cri_ioctl, __NR_ioctl, int, int, void*)
    > 170:cri_syscall3(int, __cri_open, __NR_open, const char*, int, int)
    > 171:cri_syscall1(int, __cri_close, __NR_close, int);
    > 172:cri_syscall0(int, __cri_sched_yield, __NR_sched_yield)
    > 173:cri_syscall2(int, __cri_nanosleep, __NR_nanosleep, const struct 
    > timespec*, struct timespec*)
    > 174:cri_syscall1(int, __cri_exit, __NR_exit, int)
    >
    > It appears to be the result of a badly written macro. I attempted to 
    > check for any missing or extra brackets but was unable to spot any. 
    > Here is the code for cri_syscall3:
    > #define cri_syscall3(type,name,nr,arg1,arg2,arg3)            \
    > type name(type1 arg1,type2 arg2,type3 arg3,int *errno_p)        \
    > {                                    \
    >     register long __o0 __asm__ ("o0") = (long)(arg1);        \
    >     register long __o1 __asm__ ("o1") = (long)(arg2);        \
    >     register long __o2 __asm__ ("o2") = (long)(arg3);        \
    >     register long __g1 __asm__ ("g1") = name;            \
    >     __asm __volatile (CRI_SYSCALL_STRING :                \
    >               "=r" (__g1), "=r" (__o0) :            \
    >               "0" (__g1), "1" (__o0), "r" (__o1),        \
    >               "r" (__o2) :                    \
    >               _CRI_SYSCALL_CLOBBERS);            \
    >     cri_syscall_cleanup(__o0, errno_p);                             \
    >     return (type)__o0;                                              \
    > }
    >
    > If you have some time, would you check whether this is written 
    > correctly? Hopefully this is the last step of porting to sparc.
    >
    > Thank you.
    >
    
    
    -- 
    Paul H. Hargrove                          PHHargrove_at_lbl_dot_gov
    Future Technologies Group                 
    HPC Research Department                   Tel: +1-510-495-2352
    Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
    

  • Next message: Paul H. Hargrove: "Re: blcr 0.7.3: core dump file"