Friday, 11 November 2022

Re: [gccsdk] __sync_lock_test_and_set bug fix

On Nov 8 2022, at 10:28 am, Cameron Cawley <ccawley2011@gmail.com> wrote:

> Attached is a patch that fixes the implementation of
> __sync_lock_test_and_set in non-EABI toolchains. Previously, __cmpxchg
> would return the previous value instead of a failure code, which would
> result in an endless loop if the previous value is non-zero.
> Implementations have also been provided for 1, 2 and 8 byte types.
>
> A test program has also been attached which demonstrates the issue.

Thanks for this. This one is a bit beyond my pay grade but it seems to
make sense. In the absence of any other comment I've committed it as r7724.

I'm not sure what's best to do with your test program? It might be nice
to go in a GCCSDK test suite, if only we had one of those...

Theo


_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Tuesday, 8 November 2022

[gccsdk] __sync_lock_test_and_set bug fix

Index: recipe/files/gcc/libunixlib/gcccompat/atomics.c
===================================================================
--- recipe/files/gcc/libunixlib/gcccompat/atomics.c (revision 7723)
+++ recipe/files/gcc/libunixlib/gcccompat/atomics.c (working copy)
@@ -378,6 +378,28 @@
ATOMIC_OP_FETCH(or,(*ptr) |= val,unsigned)
ATOMIC_OP_FETCH(nand,(*ptr) = ~((*ptr) & val),unsigned)

+#define SYNC_LOCK_TEST_SET(size, type) \
+type \
+__builtin_sync_lock_test_and_set_##size (volatile type *ptr, type val) \
+{ \
+ type prev; \
+ \
+ __pthread_disable_ints (); \
+ \
+ prev = *ptr; \
+ *ptr = val; \
+ \
+ __pthread_enable_ints (); \
+ \
+ return prev; \
+} \
+__asm__(".hidden\t__builtin_sync_lock_test_and_set_"__STRING(size)"\n"); \
+__asm__(".global\t__sync_lock_test_and_set_"__STRING(size)"\n"); \
+__asm__("__sync_lock_test_and_set_"__STRING(size)"=__builtin_sync_lock_test_and_set_"__STRING(size));
+SYNC_LOCK_TEST_SET(1,char)
+SYNC_LOCK_TEST_SET(2,short)
+SYNC_LOCK_TEST_SET(8,long long)
+
#ifdef __ARM_EABI__

static int __cmpxchg (int oldval, int newval, volatile int *ptr)
@@ -397,25 +419,6 @@
return result;
}

-#else
-
-static int __cmpxchg (int oldval, int newval, volatile void *ptr)
-{
- int prev;
-
- __pthread_disable_ints();
-
- prev = *(int *)ptr;
- if (prev == oldval)
- *(int *)ptr = newval;
-
- __pthread_enable_ints();
-
- return prev;
-}
-
-#endif
-
int __builtin_sync_lock_test_and_set_4 (volatile int *ptr, int val)
{
int failure, oldval;
@@ -431,6 +434,12 @@
__asm__(".global\t__sync_lock_test_and_set_4\n"); \
__asm__("__sync_lock_test_and_set_4=__builtin_sync_lock_test_and_set_4");

+#else
+
+SYNC_LOCK_TEST_SET(4,int)
+
+#endif
+
void
__builtin_sync_synchronize (void)
{
#include <stdio.h>

int main(int argc, char *argv[]) {
static volatile int count;
int n;

setvbuf(stdout, NULL, _IONBF, 0);
printf("Testing __sync_lock_test_and_set...\n");

__sync_lock_test_and_set(&count, 5);

while ((n = __atomic_load_n(&count, __ATOMIC_SEQ_CST)) >= 0) {
printf("count = %d\n", n);
__sync_lock_test_and_set(&count, n - 1);
}

printf("done!\n");
return 0;
}

Hi

Attached is a patch that fixes the implementation of __sync_lock_test_and_set in non-EABI toolchains. Previously, __cmpxchg would return the previous value instead of a failure code, which would result in an endless loop if the previous value is non-zero. Implementations have also been provided for 1, 2 and 8 byte types.

A test program has also been attached which demonstrates the issue.

Regards
Cameron

Friday, 4 November 2022

Re: Please test the latest build

Hi Michael

AmigaOS 4 build 5380 appears to be working well.

Regards
Chris


On Thu, 3 Nov 2022 at 10:09, Michael Drake <tlsa@netsurf-browser.org> wrote:
Hello,

Please could you test the latest builds (5377 or later) from:

  https://ci.netsurf-browser.org/builds/

Particularly please test the Amiga OS4 and RISC OS builds as
we have updated the versions of 3rd party libraries that we
build against. Amiga OS4 builds have had about 3 years worth
of updates and RISC OS builds about 1.5 years.

In addition we have patched the version of libcurl we build
against which should make HTTPS connections much faster for
the RISC OS and Amiga OS4 builds.

Best regards,

--
Michael Drake                     https://www.codethink.co.uk/
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org

Thursday, 3 November 2022

Re: Please test the latest build

In message <c9cf1be3-4fca-f831-b561-d0327f08cd5d@codethink.co.uk>
Michael Drake <tlsa@netsurf-browser.org> wrote:

> Hello,
>
> Please could you test the latest builds (5377 or later) from:
>
> https://ci.netsurf-browser.org/builds/
>
> Particularly please test the Amiga OS4 and RISC OS builds as we have
> updated the versions of 3rd party libraries that we build against. Amiga
> OS4 builds have had about 3 years worth of updates and RISC OS builds about
> 1.5 years.
>
> In addition we have patched the version of libcurl we build against which
> should make HTTPS connections much faster for the RISC OS and Amiga OS4
> builds.

I'm running 5378 atm, and with the admittedly shallow testing I've done
so far, it seems to work everywhere that earlier versions did, and I
share the impression that it's noticeably quicker when loading e.g. the
ROOL site.

David
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org

Re: Please test the latest build

In message <c9cf1be3-4fca-f831-b561-d0327f08cd5d@codethink.co.uk>
Michael Drake <tlsa@netsurf-browser.org> wrote:

> Hello,

> Please could you test the latest builds (5377 or later) from:

> https://ci.netsurf-browser.org/builds/

> Particularly please test the Amiga OS4 and RISC OS builds as
> we have updated the versions of 3rd party libraries that we
> build against. Amiga OS4 builds have had about 3 years worth
> of updates and RISC OS builds about 1.5 years.

> In addition we have patched the version of libcurl we build
> against which should make HTTPS connections much faster for
> the RISC OS and Amiga OS4 builds.

installed - seems to be more responsive

John



--
John Rickman
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org

Re: Please test the latest build

In article <c9cf1be3-4fca-f831-b561-d0327f08cd5d@codethink.co.uk>,
Michael Drake <tlsa@netsurf-browser.org> wrote:
> Hello,

> Please could you test the latest builds (5377 or later) from:

> https://ci.netsurf-browser.org/builds/

> Particularly please test the Amiga OS4 and RISC OS builds as
> we have updated the versions of 3rd party libraries that we
> build against. Amiga OS4 builds have had about 3 years worth
> of updates and RISC OS builds about 1.5 years.

> In addition we have patched the version of libcurl we build
> against which should make HTTPS connections much faster for
> the RISC OS and Amiga OS4 builds.

> Best regards,

Just done a few things online with Netsurf 5378, no problems...

Dave

--

Dave Triffid
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org

Re: Please test the latest build

In article <c9cf1be3-4fca-f831-b561-d0327f08cd5d@codethink.co.uk>,
Michael Drake <tlsa@netsurf-browser.org> wrote:

> Please could you test the latest builds (5377 or later) from:

> https://ci.netsurf-browser.org/builds/

[Snip]

#5378 now running here.

--
_____________________________________________________________________

Brian Jordan
RISC OS 5.28 (16-Dec-20) on Raspberry Pi
_____________________________________________________________________
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org

Re: Please test the latest build

On 3 Nov 2022 Michael Drake wrote:

> Please could you test the latest builds (5377 or later) from:

> https://ci.netsurf-browser.org/builds/

RISC OS version loaded up!

--
Richard Porter http://www.minijem.plus.com/
t: @westernexplorer mailto:ricp@minijem.plus.com
Sent from my ... if you really want to know look at the headers.
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org

Please test the latest build

Hello,

Please could you test the latest builds (5377 or later) from:

https://ci.netsurf-browser.org/builds/

Particularly please test the Amiga OS4 and RISC OS builds as
we have updated the versions of 3rd party libraries that we
build against. Amiga OS4 builds have had about 3 years worth
of updates and RISC OS builds about 1.5 years.

In addition we have patched the version of libcurl we build
against which should make HTTPS connections much faster for
the RISC OS and Amiga OS4 builds.

Best regards,

--
Michael Drake https://www.codethink.co.uk/
_______________________________________________
netsurf-users mailing list -- netsurf-users@netsurf-browser.org
To unsubscribe send an email to netsurf-users-leave@netsurf-browser.org