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

Re: [microblaze-uclinux] [patch] errno corruption



Hi Yashi,

Yasushi SHOJI wrote:

[snip other stuff, I'll leave it for David :) ]

> ok, here is the revised version of _syscall2 and chmod() which is
> expanded from _syscall2:
> 
> #define _syscall2(type, name, type1, arg1, type2, arg2)                 \
> type name (type1 arg1, type2 arg2)                                      \
> {                                                                       \
>         long __ret;                                                     \
>         __asm__ __volatile__ ("addk	r5, r0, %2	\n\t"           \
>                               "addk	r6, r0, %3	\n\t"           \
>                               "bralid	r17, 0x8	\n\t"           \
>                               "addik	r12, r0, %1	\n\t"           \
>                               "addk	%0, r3, r0	\n\t"           \
>                               : "=r" (__ret)                            \
>                               : "i" (__NR_##name),                      \
>                                 "r" ((long)arg1),                       \
>                                 "r" ((long)arg2)                        \
>                               : SYSCALL_CLOBBERS);                      \
>         __syscall_return (type, __ret);                                 \
> }

> 
>    2e790:       3021ffd8        addik   r1, r1, -40
>    2e794:       fac10024        swi     r22, r1, 36
>    2e798:       d9e00800        sw      r15, r0, r1
>    2e79c:       10a02800        addk    r5, r0, r5
>    2e7a0:       10c03000        addk    r6, r0, r6
>    2e7a4:       ba3c0008        bralid  r17, 8
>    2e7a8:       3180000f        addik   r12, r0, 15

I realise it's a bit sad to see it generate "addk r5,r0, r5", but if 
that's the price we pay to avoid future inexplicable breakages (e.g. if 
mb-gcc ever goes forward to 3.xx.yy), then it's probably for the best.

There's plenty of other wastage in the user/kernel interface (entry.S is 
a prime candidate for cleanup, bug fixes and optimisation), so these 
couple of insns aren't going to make that much difference.

> btw, I'm not using SYSCALL_ARG# macro in the patch, are you ok with
> it, John?

I like the macros (inherited from the v850 port, upon which microblaze 
is based), simply for improved readability and maintainability.  Also, 
it's a favour to arch ports yet-to-come, if they have some nice role 
models it makes the job so much easier (been there, done that, bought 
the T-shirt! :)

Are there technical reasons against them?  If not, would you mind 
putting them back in (also the SYSCALL_RET and SYSCALL_NUMBER)?

Thanks for your work and patience Yashi!  Arigatoo gozaimasu-yo!

John

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/