Discussion:
[Gc] libatomic-ops nios2
Marek Vasut
2016-01-27 20:43:13 UTC
Permalink
Hello,

I am trying to add support for nios2 CPU into libatomic-ops and gc .
The Linux kernel exports kuser helper for cmpxchg [1], so I believe
this might be the way to go? Or shall I somehow use the gcc atomic
builtin ops [2] ? Note that nios2 does not have dedicated atomic
instructions which could be used in userland, that's why the kuser
helper.

Thank you for any input!

[1] http://lxr.free-electrons.com/source/arch/nios2/kernel/entry.S#L535
[2] https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/nios2/linux-
atomic.c

Best regards,
Marek Vasut
Hans Boehm
2016-01-28 02:02:37 UTC
Permalink
I know nothing about this particular processor. But I think it would
generally be very useful if we had a libatomic_ops implementation that just
relied on C11 atomics, which seem to now be quite widely available..
That's probably easier than a custom implementation, and it should avoid
redoing this work for future processors.

Libatomic_ops predates C++11/C11 atomics. Experience with the former
contributed to the latter. It would be good to eventually replace
libatomic_ops.

I would expect that C11 atomics use the helper, but I don't know that.

Hans
Post by Marek Vasut
Hello,
I am trying to add support for nios2 CPU into libatomic-ops and gc .
The Linux kernel exports kuser helper for cmpxchg [1], so I believe
this might be the way to go? Or shall I somehow use the gcc atomic
builtin ops [2] ? Note that nios2 does not have dedicated atomic
instructions which could be used in userland, that's why the kuser
helper.
Thank you for any input!
[1] http://lxr.free-electrons.com/source/arch/nios2/kernel/entry.S#L535
[2]
https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/nios2/linux-
atomic.c
Best regards,
Marek Vasut
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
Ivan Maidanski
2016-04-14 19:42:59 UTC
Permalink
Hello Frank and James,

I have created a patch to use C11 atomics for MIPS (32/64), it was not difficult for me to create it and check compilation with Clang and GCC (using NDK r10e) but I don't have the H/W to test it. I have looked thru the generated assembly, it looks ok at a glance.

I have hard-coded gcc 4.9+ and clang 3.5+ versions to use gcc atomics instead of asm (these are just the compiler versions I have tested the patch with) - this is probably a bit restrictive but I don't know whether old compilers generate the correct code.

Could you please test the patch on some multi-core MIPS H/W? (Ideally to test bdwgc with the patch as well.)
https://github.com/ivmai/libatomic_ops/commit/2317eaf48d677d30e2b34e46517c72fa004e8a54  
(or checkout development branch  https://github.com/ivmai/libatomic_ops/commits/atomics-exp )

Regards,
Ivan
I know nothing about this particular processor.  But I think it would generally be very useful if we had a libatomic_ops implementation that just relied on C11 atomics, which seem to now be quite widely available..  That's probably easier than a custom implementation, and it should avoid redoing this work for future processors.
Libatomic_ops predates C++11/C11 atomics.  Experience with the former contributed to the latter.  It would be good to eventually replace libatomic_ops.
I would expect that C11 atomics use the helper, but I don't know that.
Hans
Post by Marek Vasut
Hello,
I am trying to add support for nios2 CPU into libatomic-ops and gc .
The Linux kernel exports kuser helper for cmpxchg [1], so I believe
this might be the way to go? Or shall I somehow use the gcc atomic
builtin ops [2] ? Note that nios2 does not have dedicated atomic
instructions which could be used in userland, that's why the kuser
helper.
Thank you for any input!
[1] http://lxr.free-electrons.com/source/arch/nios2/kernel/entry.S#L535
[2] https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/nios2/linux-
atomic.c
Best regards,
Marek Vasut
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
James Cowgill
2016-04-14 21:15:34 UTC
Permalink
Hi,
Post by Ivan Maidanski
Hello Frank and James,
I have created a patch to use C11 atomics for MIPS (32/64), it was
not difficult for me to create it and check compilation with Clang
and GCC (using NDK r10e) but I don't have the H/W to test it. I have
looked thru the generated assembly, it looks ok at a glance.
I have hard-coded gcc 4.9+ and clang 3.5+ versions to use gcc atomics
instead of asm (these are just the compiler versions I have tested
the patch with) - this is probably a bit restrictive but I don't know
whether old compilers generate the correct code.
I can't remember the exact versions mips support was added I'm afraid,
but those versions should be fine. The tests I've done are with Debian
Sid (gcc 5).
Post by Ivan Maidanski
Could you please test the patch on some multi-core MIPS H/W? (Ideally
to test bdwgc with the patch as well.)
https://github.com/ivmai/libatomic_ops/commit/2317eaf48d677d30e2b34e46517c72fa004e8a54  
(or checkout development branch 
https://github.com/ivmai/libatomic_ops/commits/atomics-exp )
I built and ran the testsuite for both libatomic-ops and bdwgc (master
branch) on etler.debian.org (4 cores, little endian). All the tests
seem to pass! I tried 64-bit as well and the tests pass there too.

Thanks,
James

Marek Vasut
2016-01-28 03:28:08 UTC
Permalink
Post by Marek Vasut
Hello,
I am trying to add support for nios2 CPU into libatomic-ops and gc .
The Linux kernel exports kuser helper for cmpxchg [1], so I believe
this might be the way to go? Or shall I somehow use the gcc atomic
builtin ops [2] ? Note that nios2 does not have dedicated atomic
instructions which could be used in userland, that's why the kuser
helper.
Thank you for any input!
[1] http://lxr.free-electrons.com/source/arch/nios2/kernel/entry.S#L535
[2]
https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/nios2/linux-
atomic.c
Best regards,
Marek Vasut
The libgcc builtins still end up using the kuser interface as well, so
in a certain sense they're equivalent.
Yeah, I would've expected that, but at least they have a well defined
unified interface.
You may want to go the direct kuser route. A little bit of inline asm
should get you more performance compared to calling into libgcc, and
nios2 softcores can really use that bit of optimization. That's also
what I did in glibc.
Aren't those gcc builtins expanded in place anyway ? Or do you see some
real performance drop if you don't use the kuser helper directly ?

btw. I tried making two patches, one for libatomic-ops and one for bdwgc,
find them below, but I have no clue if they are correct:

libatomic-ops:
-------------------->8--------------------
From dd3b4b22feb87fc18c188cf594b0e16afdc0caa8 Mon Sep 17 00:00:00 2001
From: Marek Vasut <***@denx.de>
Date: Tue, 26 Jan 2016 13:52:26 +0100
Subject: [PATCH] Add nios2 support

Signed-off-by: Marek Vasut <***@denx.de>
---
src/Makefile.am | 1 +
src/atomic_ops.h | 3 +++
src/atomic_ops/sysdeps/gcc/nios2.h | 10 ++++++++++
3 files changed, 14 insertions(+)
create mode 100644 src/atomic_ops/sysdeps/gcc/nios2.h

diff --git a/src/Makefile.am b/src/Makefile.am
index fc09b27..d463427 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/ia64.h \
atomic_ops/sysdeps/gcc/m68k.h \
atomic_ops/sysdeps/gcc/mips.h \
+ atomic_ops/sysdeps/gcc/nios2.h \
atomic_ops/sysdeps/gcc/powerpc.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index 33fe00e..ec02ba4 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -262,6 +262,9 @@
# if defined(__m68k__)
# include "atomic_ops/sysdeps/gcc/m68k.h"
# endif /* __m68k__ */
+# if defined(__nios2__)
+# include "atomic_ops/sysdeps/gcc/nios2.h"
+# endif /* __nios2__ */
# if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
|| defined(__powerpc64__) || defined(__ppc64__)
# include "atomic_ops/sysdeps/gcc/powerpc.h"
diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h
b/src/atomic_ops/sysdeps/gcc/nios2.h
new file mode 100644
index 0000000..41c86f7
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/nios2.h
@@ -0,0 +1,10 @@
+/*
+ * Copyright (C) 2016 Marek Vasut <***@denx.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "../test_and_set_t_is_ao_t.h"
+#include "generic.h"
+
+#define AO_T_IS_INT
--
2.7.0.rc3
--------------------8<--------------------

bdwgc:
-------------------->8--------------------
Enter passphrase for key '/home/marex/.ssh/id_rsa':
From cecaaf68e60bb07dffa8effb945bc43e2f4c87cb Mon Sep 17 00:00:00 2001
From: Marek Vasut <***@denx.de>
Date: Thu, 28 Jan 2016 04:13:13 +0100
Subject: [PATCH] Add nios2 support

Add simple nios2 configuration support.

Signed-off-by: Marek Vasut <***@denx.de>
---
include/private/gcconfig.h | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 1aa4923..b2c2d78 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -188,6 +188,10 @@
# endif
# define mach_type_known
# endif
+# if defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__)
+# define NIOS2 /* Altera NIOS2 */
+# define mach_type_known
+# endif
# if defined(__or1k__)
# define OR1K /* OpenRISC/or1k */
# define mach_type_known
@@ -1729,6 +1733,24 @@
# endif
# endif

+# ifdef NIOS2
+# define CPP_WORDSZ 32
+# define MACH_TYPE "NIOS2"
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define DYNAMIC_LOADING
+ extern int _end[];
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+# define DATAEND ((ptr_t)(_end))
+# define ALIGNMENT 4
+# ifndef HBLKSIZE
+# define HBLKSIZE 4096
+# endif
+# define LINUX_STACKBOTTOM
+# endif /* Linux */
+# endif
+
# ifdef OR1K
# define CPP_WORDSZ 32
# define MACH_TYPE "OR1K"
@@ -2800,7 +2822,7 @@
#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|| defined(OPENBSD) || defined(ARM32) \
|| defined(MIPS) || defined(AVR32) \
- || defined(OR1K))) \
+ || defined(OR1K) || defined(NIOS2))) \
|| (defined(LINUX) && !defined(__gnu_linux__)) \
|| (defined(RTEMS) && defined(I386)) || defined(PLATFORM_ANDROID)) \
&& !defined(NO_GETCONTEXT)
--
2.7.0.rc3
--------------------8<--------------------

Best regards,
Marek Vasut
Marek Vasut
2016-01-28 10:54:14 UTC
Permalink
Post by Marek Vasut
You may want to go the direct kuser route. A little bit of inline asm
should get you more performance compared to calling into libgcc, and
nios2 softcores can really use that bit of optimization. That's also
what I did in glibc.
Aren't those gcc builtins expanded in place anyway ? Or do you see some
real performance drop if you don't use the kuser helper directly ?
No, the GCC builtins are not expanded inline, the __sync_* routines are
implemented in libgcc.
Hm, I didn't know. Thanks!
I have no evidence of significant performance gaps, though at least under
PIC, the nios2 function call overhead is a bit costly. However, my
concerns may be unfounded.
I'd suspect the switch from userland to kernel and back might be the most
constly bit here. But that'd have to be profiled to really see if that is
the case.
Post by Marek Vasut
btw. I tried making two patches, one for libatomic-ops and one for bdwgc,
I'm not familiar with this code to review, but if there is a generic
implementation ready to use, then it should work for nios2. You can just
start there.
Yeah, that's what I think as well. The generic implementation might be a good
start and further optimizations can come later.

Thanks!

Best regards,
Marek Vasut
Marek Vasut
2016-02-18 19:37:33 UTC
Permalink
Hi!

Can I get some feedback on these two patches below please ?
Do they make sense and shall I submit them normally or is there anything I
should change ?

libatomic-ops:
-------------------->8--------------------
From dd3b4b22feb87fc18c188cf594b0e16afdc0caa8 Mon Sep 17 00:00:00 2001
From: Marek Vasut <***@denx.de>
Date: Tue, 26 Jan 2016 13:52:26 +0100
Subject: [PATCH] Add nios2 support

Signed-off-by: Marek Vasut <***@denx.de>
---
src/Makefile.am | 1 +
src/atomic_ops.h | 3 +++
src/atomic_ops/sysdeps/gcc/nios2.h | 10 ++++++++++
3 files changed, 14 insertions(+)
create mode 100644 src/atomic_ops/sysdeps/gcc/nios2.h

diff --git a/src/Makefile.am b/src/Makefile.am
index fc09b27..d463427 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/ia64.h \
atomic_ops/sysdeps/gcc/m68k.h \
atomic_ops/sysdeps/gcc/mips.h \
+ atomic_ops/sysdeps/gcc/nios2.h \
atomic_ops/sysdeps/gcc/powerpc.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index 33fe00e..ec02ba4 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -262,6 +262,9 @@
# if defined(__m68k__)
# include "atomic_ops/sysdeps/gcc/m68k.h"
# endif /* __m68k__ */
+# if defined(__nios2__)
+# include "atomic_ops/sysdeps/gcc/nios2.h"
+# endif /* __nios2__ */
# if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
|| defined(__powerpc64__) || defined(__ppc64__)
# include "atomic_ops/sysdeps/gcc/powerpc.h"
diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h
b/src/atomic_ops/sysdeps/gcc/nios2.h
new file mode 100644
index 0000000..41c86f7
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/nios2.h
@@ -0,0 +1,10 @@
+/*
+ * Copyright (C) 2016 Marek Vasut <***@denx.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "../test_and_set_t_is_ao_t.h"
+#include "generic.h"
+
+#define AO_T_IS_INT
--
2.7.0.rc3
--------------------8<--------------------

bdwgc:
-------------------->8--------------------
Enter passphrase for key '/home/marex/.ssh/id_rsa':
From cecaaf68e60bb07dffa8effb945bc43e2f4c87cb Mon Sep 17 00:00:00 2001
From: Marek Vasut <***@denx.de>
Date: Thu, 28 Jan 2016 04:13:13 +0100
Subject: [PATCH] Add nios2 support

Add simple nios2 configuration support.

Signed-off-by: Marek Vasut <***@denx.de>
---
include/private/gcconfig.h | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 1aa4923..b2c2d78 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -188,6 +188,10 @@
# endif
# define mach_type_known
# endif
+# if defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__)
+# define NIOS2 /* Altera NIOS2 */
+# define mach_type_known
+# endif
# if defined(__or1k__)
# define OR1K /* OpenRISC/or1k */
# define mach_type_known
@@ -1729,6 +1733,24 @@
# endif
# endif

+# ifdef NIOS2
+# define CPP_WORDSZ 32
+# define MACH_TYPE "NIOS2"
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define DYNAMIC_LOADING
+ extern int _end[];
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+# define DATAEND ((ptr_t)(_end))
+# define ALIGNMENT 4
+# ifndef HBLKSIZE
+# define HBLKSIZE 4096
+# endif
+# define LINUX_STACKBOTTOM
+# endif /* Linux */
+# endif
+
# ifdef OR1K
# define CPP_WORDSZ 32
# define MACH_TYPE "OR1K"
@@ -2800,7 +2822,7 @@
#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|| defined(OPENBSD) || defined(ARM32) \
|| defined(MIPS) || defined(AVR32) \
- || defined(OR1K))) \
+ || defined(OR1K) || defined(NIOS2))) \
|| (defined(LINUX) && !defined(__gnu_linux__)) \
|| (defined(RTEMS) && defined(I386)) || defined(PLATFORM_ANDROID)) \
&& !defined(NO_GETCONTEXT)
--
2.7.0.rc3
--------------------8<--------------------

Thanks!
Marek Vasut
2016-03-11 22:24:24 UTC
Permalink
Hello Marek,
Hello Ivan,
I've committed the proposed GC patch to master.
Thank you!
The patch for libatomic_ops does not fit the library license,
see https://github.com/ivmai/libatomic_ops/blob/master/doc/LICENSING.txt
As a reference for a file heading comment you could look e.g
at <https://github.com/ivmai/libatomic_ops/blob/master/doc/LICENSING.txt>https://github.com/ivmai/libatomic_ops/blob/master/src/atomic_ops/sysdeps/gcc/mips.h
OK, shall I repost the patch with the license header copied from MIPS?
I have no strong licensing preference.
Regards,
Ivan
Hi!
Can I get some feedback on these two patches below please ?
Do they make sense and shall I submit them normally or is there anything I
should change ?
-------------------->8--------------------
From dd3b4b22feb87fc18c188cf594b0e16afdc0caa8 Mon Sep 17 00:00:00 2001
Date: Tue, 26 Jan 2016 13:52:26 +0100
Subject: [PATCH] Add nios2 support
---
src/Makefile.am | 1 +
src/atomic_ops.h | 3 +++
src/atomic_ops/sysdeps/gcc/nios2.h | 10 ++++++++++
3 files changed, 14 insertions(+)
create mode 100644 src/atomic_ops/sysdeps/gcc/nios2.h
diff --git a/src/Makefile.am b/src/Makefile.am
index fc09b27..d463427 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/ia64.h \
atomic_ops/sysdeps/gcc/m68k.h \
atomic_ops/sysdeps/gcc/mips.h \
+ atomic_ops/sysdeps/gcc/nios2.h \
atomic_ops/sysdeps/gcc/powerpc.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index 33fe00e..ec02ba4 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -262,6 +262,9 @@
# if defined(__m68k__)
# include "atomic_ops/sysdeps/gcc/m68k.h"
# endif /* __m68k__ */
+# if defined(__nios2__)
+# include "atomic_ops/sysdeps/gcc/nios2.h"
+# endif /* __nios2__ */
# if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
|| defined(__powerpc64__) || defined(__ppc64__)
# include "atomic_ops/sysdeps/gcc/powerpc.h"
diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h
b/src/atomic_ops/sysdeps/gcc/nios2.h
new file mode 100644
index 0000000..41c86f7
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/nios2.h
@@ -0,0 +1,10 @@
+/*
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "../test_and_set_t_is_ao_t.h"
+#include "generic.h"
+
+#define AO_T_IS_INT
--
2.7.0.rc3
--------------------8<--------------------
-------------------->8--------------------
From cecaaf68e60bb07dffa8effb945bc43e2f4c87cb Mon Sep 17 00:00:00 2001
Date: Thu, 28 Jan 2016 04:13:13 +0100
Subject: [PATCH] Add nios2 support
Add simple nios2 configuration support.
---
include/private/gcconfig.h | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 1aa4923..b2c2d78 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -188,6 +188,10 @@
# endif
# define mach_type_known
# endif
+# if defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__)
+# define NIOS2 /* Altera NIOS2 */
+# define mach_type_known
+# endif
# if defined(__or1k__)
# define OR1K /* OpenRISC/or1k */
# define mach_type_known
@@ -1729,6 +1733,24 @@
# endif
# endif
+# ifdef NIOS2
+# define CPP_WORDSZ 32
+# define MACH_TYPE "NIOS2"
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define DYNAMIC_LOADING
+ extern int _end[];
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+# define DATAEND ((ptr_t)(_end))
+# define ALIGNMENT 4
+# ifndef HBLKSIZE
+# define HBLKSIZE 4096
+# endif
+# define LINUX_STACKBOTTOM
+# endif /* Linux */
+# endif
+
# ifdef OR1K
# define CPP_WORDSZ 32
# define MACH_TYPE "OR1K"
@@ -2800,7 +2822,7 @@
#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|| defined(OPENBSD) || defined(ARM32) \
|| defined(MIPS) || defined(AVR32) \
- || defined(OR1K))) \
+ || defined(OR1K) || defined(NIOS2))) \
|| (defined(LINUX) && !defined(__gnu_linux__)) \
|| (defined(RTEMS) && defined(I386)) ||
defined(PLATFORM_ANDROID)) \
&& !defined(NO_GETCONTEXT)
--
2.7.0.rc3
--------------------8<--------------------
Thanks!
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
--
Best regards,
Marek Vasut
Ivan Maidanski
2016-03-11 22:33:46 UTC
Permalink
 OK, shall I repost the patch with the license header copied from MIPS?
Yes, please, it would be ok. Ideally is to make a pull request on github.
Hello Marek,
Hello Ivan,
I've committed the proposed GC patch to master.
Thank you!
The patch for libatomic_ops does not fit the library license,
see https://github.com/ivmai/libatomic_ops/blob/master/doc/LICENSING.txt
As a reference for a file heading comment you could look e.g
at < https://github.com/ivmai/libatomic_ops/blob/master/doc/LICENSING.txt > https://github.com/ivmai/libatomic_ops/blob/master/src/atomic_ops/sysdeps/gcc/mips.h
OK, shall I repost the patch with the license header copied from MIPS?
I have no strong licensing preference.
Regards,
Ivan
Hi!
Can I get some feedback on these two patches below please ?
Do they make sense and shall I submit them normally or is there anything I
should change ?
-------------------->8--------------------
From dd3b4b22feb87fc18c188cf594b0e16afdc0caa8 Mon Sep 17 00:00:00 2001
Date: Tue, 26 Jan 2016 13:52:26 +0100
Subject: [PATCH] Add nios2 support
---
src/Makefile.am | 1 +
src/atomic_ops.h | 3 +++
src/atomic_ops/sysdeps/gcc/nios2.h | 10 ++++++++++
3 files changed, 14 insertions(+)
create mode 100644 src/atomic_ops/sysdeps/gcc/nios2.h
diff --git a/src/Makefile.am b/src/Makefile.am
index fc09b27..d463427 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/ia64.h \
atomic_ops/sysdeps/gcc/m68k.h \
atomic_ops/sysdeps/gcc/mips.h \
+ atomic_ops/sysdeps/gcc/nios2.h \
atomic_ops/sysdeps/gcc/powerpc.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index 33fe00e..ec02ba4 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -262,6 +262,9 @@
# if defined(__m68k__)
# include "atomic_ops/sysdeps/gcc/m68k.h"
# endif /* __m68k__ */
+# if defined(__nios2__)
+# include "atomic_ops/sysdeps/gcc/nios2.h"
+# endif /* __nios2__ */
# if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
|| defined(__powerpc64__) || defined(__ppc64__)
# include "atomic_ops/sysdeps/gcc/powerpc.h"
diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h
b/src/atomic_ops/sysdeps/gcc/nios2.h
new file mode 100644
index 0000000..41c86f7
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/nios2.h
@@ -0,0 +1,10 @@
+/*
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "../test_and_set_t_is_ao_t.h"
+#include "generic.h"
+
+#define AO_T_IS_INT
--
2.7.0.rc3
--------------------8<--------------------
-------------------->8--------------------
From cecaaf68e60bb07dffa8effb945bc43e2f4c87cb Mon Sep 17 00:00:00 2001
Date: Thu, 28 Jan 2016 04:13:13 +0100
Subject: [PATCH] Add nios2 support
Add simple nios2 configuration support.
---
include/private/gcconfig.h | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 1aa4923..b2c2d78 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -188,6 +188,10 @@
# endif
# define mach_type_known
# endif
+# if defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__)
+# define NIOS2 /* Altera NIOS2 */
+# define mach_type_known
+# endif
# if defined(__or1k__)
# define OR1K /* OpenRISC/or1k */
# define mach_type_known
@@ -1729,6 +1733,24 @@
# endif
# endif
+# ifdef NIOS2
+# define CPP_WORDSZ 32
+# define MACH_TYPE "NIOS2"
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define DYNAMIC_LOADING
+ extern int _end[];
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+# define DATAEND ((ptr_t)(_end))
+# define ALIGNMENT 4
+# ifndef HBLKSIZE
+# define HBLKSIZE 4096
+# endif
+# define LINUX_STACKBOTTOM
+# endif /* Linux */
+# endif
+
# ifdef OR1K
# define CPP_WORDSZ 32
# define MACH_TYPE "OR1K"
@@ -2800,7 +2822,7 @@
#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|| defined(OPENBSD) || defined(ARM32) \
|| defined(MIPS) || defined(AVR32) \
- || defined(OR1K))) \
+ || defined(OR1K) || defined(NIOS2))) \
|| (defined(LINUX) && !defined(__gnu_linux__)) \
|| (defined(RTEMS) && defined(I386)) ||
defined(PLATFORM_ANDROID)) \
&& !defined(NO_GETCONTEXT)
--
2.7.0.rc3
--------------------8<--------------------
Thanks!
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
--
Best regards,
Marek Vasut
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
Marek Vasut
2016-03-11 22:57:15 UTC
Permalink
Post by Marek Vasut
OK, shall I repost the patch with the license header copied from MIPS?
Yes, please, it would be ok. Ideally is to make a pull request on github.
Done. I don't use github, so I just sent you a patch.
Post by Marek Vasut
Hello Marek,
Hello Ivan,
Post by Marek Vasut
I've committed the proposed GC patch to master.
Thank you!
Post by Marek Vasut
The patch for libatomic_ops does not fit the library license,
see
https://github.com/ivmai/libatomic_ops/blob/master/doc/LICENSING.txt
Post by Marek Vasut
As a reference for a file heading comment you could look e.g
at
<https://github.com/ivmai/libatomic_ops/blob/master/doc/LICENSING.txt>https://github.com/ivmai/libatomic_ops/blob/master/src/atomic_ops/sysdeps/gcc/mips.h
OK, shall I repost the patch with the license header copied from MIPS?
I have no strong licensing preference.
Post by Marek Vasut
Regards,
Ivan
Hi!
Can I get some feedback on these two patches below please ?
Do they make sense and shall I submit them normally or is there anything I
should change ?
-------------------->8--------------------
From dd3b4b22feb87fc18c188cf594b0e16afdc0caa8 Mon Sep 17 00:00:00 2001
Date: Tue, 26 Jan 2016 13:52:26 +0100
Subject: [PATCH] Add nios2 support
---
src/Makefile.am | 1 +
src/atomic_ops.h | 3 +++
src/atomic_ops/sysdeps/gcc/nios2.h | 10 ++++++++++
3 files changed, 14 insertions(+)
create mode 100644 src/atomic_ops/sysdeps/gcc/nios2.h
diff --git a/src/Makefile.am b/src/Makefile.am
index fc09b27..d463427 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/ia64.h \
atomic_ops/sysdeps/gcc/m68k.h \
atomic_ops/sysdeps/gcc/mips.h \
+ atomic_ops/sysdeps/gcc/nios2.h \
atomic_ops/sysdeps/gcc/powerpc.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index 33fe00e..ec02ba4 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -262,6 +262,9 @@
# if defined(__m68k__)
# include "atomic_ops/sysdeps/gcc/m68k.h"
# endif /* __m68k__ */
+# if defined(__nios2__)
+# include "atomic_ops/sysdeps/gcc/nios2.h"
+# endif /* __nios2__ */
# if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
|| defined(__powerpc64__) || defined(__ppc64__)
# include "atomic_ops/sysdeps/gcc/powerpc.h"
diff --git a/src/atomic_ops/sysdeps/gcc/nios2.h
b/src/atomic_ops/sysdeps/gcc/nios2.h
new file mode 100644
index 0000000..41c86f7
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/nios2.h
@@ -0,0 +1,10 @@
+/*
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "../test_and_set_t_is_ao_t.h"
+#include "generic.h"
+
+#define AO_T_IS_INT
--
2.7.0.rc3
--------------------8<--------------------
-------------------->8--------------------
From cecaaf68e60bb07dffa8effb945bc43e2f4c87cb Mon Sep 17 00:00:00 2001
Date: Thu, 28 Jan 2016 04:13:13 +0100
Subject: [PATCH] Add nios2 support
Add simple nios2 configuration support.
---
include/private/gcconfig.h | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 1aa4923..b2c2d78 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -188,6 +188,10 @@
# endif
# define mach_type_known
# endif
+# if defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__)
+# define NIOS2 /* Altera NIOS2 */
+# define mach_type_known
+# endif
# if defined(__or1k__)
# define OR1K /* OpenRISC/or1k */
# define mach_type_known
@@ -1729,6 +1733,24 @@
# endif
# endif
+# ifdef NIOS2
+# define CPP_WORDSZ 32
+# define MACH_TYPE "NIOS2"
+# ifdef LINUX
+# define OS_TYPE "LINUX"
+# define DYNAMIC_LOADING
+ extern int _end[];
+ extern int __data_start[];
+# define DATASTART ((ptr_t)(__data_start))
+# define DATAEND ((ptr_t)(_end))
+# define ALIGNMENT 4
+# ifndef HBLKSIZE
+# define HBLKSIZE 4096
+# endif
+# define LINUX_STACKBOTTOM
+# endif /* Linux */
+# endif
+
# ifdef OR1K
# define CPP_WORDSZ 32
# define MACH_TYPE "OR1K"
@@ -2800,7 +2822,7 @@
#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HURD) \
|| defined(OPENBSD) || defined(ARM32) \
|| defined(MIPS) || defined(AVR32) \
- || defined(OR1K))) \
+ || defined(OR1K) || defined(NIOS2))) \
|| (defined(LINUX) && !defined(__gnu_linux__)) \
|| (defined(RTEMS) && defined(I386)) ||
defined(PLATFORM_ANDROID)) \
&& !defined(NO_GETCONTEXT)
--
2.7.0.rc3
--------------------8<--------------------
Thanks!
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
--
Best regards,
Marek Vasut
_______________________________________________
bdwgc mailing list
https://lists.opendylan.org/mailman/listinfo/bdwgc
--
Best regards,
Marek Vasut
Loading...