This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Export _NCPUWORDS as variable for access from within the gnat-rts


Hi,

This patch will make the define _NCPUWORDS accessible for the ada runtime. It is necessary to model the pthread_attr_t implementation for rtems  in Ada.
We had a stack corruption because the C an Ada declarations of the type where out of synch.
I will send the updated s-osinte-rtems.ads to  gcc if this patch is accepted.

I put devel@rtems.org CC for input from the rtems developers.

Best regards,

    Jan
>From c8df985ac8bc4cd92e4bbbf6588e71b85d059524 Mon Sep 17 00:00:00 2001
From: Jan Sommer <soja-lists@aries.uberspace.de>
Date: Thu, 29 Oct 2015 13:59:14 +0100
Subject: [PATCH] Export _NCPUWORDS as variable for access from within the
 gnat-rts

---
 newlib/libc/sys/rtems/cpusetalloc.c        | 2 ++
 newlib/libc/sys/rtems/include/sys/cpuset.h | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/newlib/libc/sys/rtems/cpusetalloc.c b/newlib/libc/sys/rtems/cpusetalloc.c
index e2b1985..20544b0 100644
--- a/newlib/libc/sys/rtems/cpusetalloc.c
+++ b/newlib/libc/sys/rtems/cpusetalloc.c
@@ -32,6 +32,8 @@
 #include <sys/cpuset.h>
 #include <stdlib.h>
 
+const size_t _ADA_NCPUWORDS = _NCPUWORDS - 1;
+
 cpu_set_t *__cpuset_alloc(int num_cpus)
 {
   return (cpu_set_t *)malloc(CPU_ALLOC_SIZE(num_cpus));
diff --git a/newlib/libc/sys/rtems/include/sys/cpuset.h b/newlib/libc/sys/rtems/include/sys/cpuset.h
index 8fae475..50a07e7 100644
--- a/newlib/libc/sys/rtems/include/sys/cpuset.h
+++ b/newlib/libc/sys/rtems/include/sys/cpuset.h
@@ -70,6 +70,9 @@ typedef struct _cpuset {
   cpu_set_word_t __bits[_NCPUWORDS];
 } cpu_set_t;
 
+/* Make _NCPUWORDS accessible for the ada runtime */
+extern const size_t _ADA_NCPUWORDS;
+
 /* determine the mask for a particular cpu within the element */
 static __inline cpu_set_word_t  __cpuset_mask(int cpu)
 {
-- 
2.5.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]