[Common-dev] Re: [Helix-server-dev] CR: OS X mutex lock fix
Dean Collins dcollins at real.comlooks ok for SERVER_CURRENT and SERVER_11_0_STABLE.
Dean
On Sat, Aug 06, 2005 at 11:11:41AM -0700, Bob Clark wrote:
> The two changed lines of this diff bely the difficulty in tracking it
> down. It turns out that "retry" was used elsewhere, and (the tough one)
> giving the branch instruction ("bne") the hint to branch BACKWARDS
> (bne- 1b instead of bne- 1) avoids a tremendously mysterious link
> error:
>
> ld: /foo.a(bar.o) relocation overflow for relocation entry 704
> in section (__TEXT,__text) (displacement too large)
>
> when linking server/installer/hlxserver/nodist.
>
> (It eventually took blowing an Apple Developer Technical Support
> incident to put me on the right track for this fix, which isn't
> inherently relevant to the diff, but if I can't tell my common-dev and
> helix-server-dev friends of my frustrating path to enlightenment, who
> CAN I tell?)
>
> I'd like to commit this to SERVER_CURRENT and SERVER_11_0_STABLE.
>
> --Bob
>
> Index: common/include/hxmutexlock.h
> ===================================================================
> RCS file: /cvsroot/common/include/hxmutexlock.h,v
> retrieving revision 1.6.2.1
> diff -u -w -r1.6.2.1 hxmutexlock.h
> --- common/include/hxmutexlock.h 27 Mar 2005 03:36:18 -0000 1.6.2.1
> +++ common/include/hxmutexlock.h 1 Aug 2005 14:45:47 -0000
> @@ -453,12 +453,12 @@
> volatile int hold;
> volatile int newval;
> __asm__ __volatile__ (
> -"retry: lwarx %3, 0, %2;\n" // hold = *pNum
> +"1: lwarx %3, 0, %2;\n" // hold = *pNum
> " li %4, 1;\n" // newval = 1
> " stwcx. %4, 0, %2;\n" // *pNum = newval (if pNum has
> not been
> // corrupted by another thread
> between
> // lwarx and stwcx.)
> -" bne- retry;\n" // if pNum HAS been corrupted by
> another thread, retry.
> +" bne- 1b;\n" // if pNum HAS been corrupted by
> another thread, retry.
> " mr %0, %3;\n" // result = hold (i.e. old *pNum)
> : "=b" (result)
> : "0" (result), "b" (pNum), "b" (hold), "b" (newval)
>
>
> _______________________________________________
> Helix-server-dev mailing list
> Helix-server-dev at helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/helix-server-dev
--
Dean Collins
Server Technical Lead, RealNetworks, Inc. -- http://www.realnetworks.com
Helix Server Project Owner -- http://helix-server.helixcommunity.org