buserror on osx.4

Delta Yeh delta.yeh at gmail.com
Thu Dec 21 12:20:19 MSK 2006


salute to you two guys!!

2006/12/21, Franklin Kingma <franklin at fourdigits.nl>:
>
>
> On Dec 21, 2006, at 9:59 AM, Igor Sysoev wrote:
>
> > On Thu, 21 Dec 2006, Igor Sysoev wrote:
> >
> >>> (gdb) disassemble ___compare_and_swap32
> >>> Dump of assembler code for function ___compare_and_swap32:
> >>> 0xffff8080 <___compare_and_swap32+0>:   lwarx   r7,0,r5
> >>> 0xffff8084 <___compare_and_swap32+4>:   cmplw   r7,r3
> >>> 0xffff8088 <___compare_and_swap32+8>:   bne-    0xffff809c
> >>> <___compare_and_swap32+28>
> >>> 0xffff808c <___compare_and_swap32+12>:  stwcx.  r4,0,r5
> >>> 0xffff8090 <___compare_and_swap32+16>:  bne-    0xffff8080
> >>> <___compare_and_swap32>
> >>> 0xffff8094 <___compare_and_swap32+20>:  li      r3,1
> >>> 0xffff8098 <___compare_and_swap32+24>:  blr
> >>> 0xffff809c <___compare_and_swap32+28>:  li      r3,0
> >>> 0xffff80a0 <___compare_and_swap32+32>:  blr
> >>> 0xffff80a4 <___compare_and_swap32+36>:  .long 0x0
> >>> 0xffff80a8 <___compare_and_swap32+40>:  .long 0x0
> >>> 0xffff80ac <___compare_and_swap32+44>:  .long 0x0
> >>> 0xffff80b0 <___compare_and_swap32+48>:  .long 0x0
> >>> 0xffff80b4 <___compare_and_swap32+52>:  .long 0x0
> >>> 0xffff80b8 <___compare_and_swap32+56>:  .long 0x0
> >>> 0xffff80bc <___compare_and_swap32+60>:  .long 0x0
> >>> End of assembler dump.
> >>
> >> OK, then I will do atomic operation using MacOSX builtin
> >> OSAtomicCompareAndSwap32Barrier()
> >
> > Just to be sure that OSAtomicCompareAndSwap32() does not cycle forever
> > (as it may if lwarx/stwcx pair does not work) on your Mac compile
> > this program:
> >
> > -----------
> > #include <libkern/OSAtomic.h>
> >
> > static  int32_t  test;
> >
> > int main()
> > {
> >     int  rc;
> >
> >     rc = OSAtomicCompareAndSwap32(0, 1, &test);
> >
> >     printf("rc: %d, test: %d\n", rc, test);
> > }
> > -----------
> >
> > using
> >
> > cc -o q q.c
> >
> > and run, it should show:
> >
> > rc: 1, test: 1
>
> pluks:~ franklin$ cc -o q q.c
> q.c: In function 'main':
> q.c:11: warning: incompatible implicit declaration of built-in
> function 'printf'
> pluks:~ franklin$ ./q
> rc: 1, test: 1
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20061221/9ab31cff/attachment.html>


More information about the nginx mailing list