Re: Move POSIX network headers like etc. to Newlib?
On 7/04/2016 4:45 PM, Sebastian Huber wrote: Hello, what about moving the POSIX network headers arpa/inet.h netdb.h net/if.h netinet/in.h netinet/tcp.h syslog.h sys/socket.h sys/uio.h sys/un.h to Newlib? Where are these taken from? Do they allow the in-tree stack to build? [1] This has the following benefits. 1. It ensures compatibility between the standard and libbsd network stack at user API level. Would this have to have a broader reach than just libbsd? What about other parts of the networking software API a package may depend on? How are those parts added onto this base level? For example I have an app which also includes .. #include #include #include Would we support all these? Maybe looking at boosts source for asio would be worth doing. 2. These files may be used by lwIP to provide the standard API. Is this something to be added to lwIP or this is there now? 3. It allows 3rd party code depending only on the POSIX network headers to build without RTEMS, e.g. GCC Ada and Go languages, libressl library etc. Allows build of libraries per multilib. Does this mean networking is always shown to be present even if the user does not want to enable networking functionality in a 3rd party package? If this helps us remove the in-tree stack from the source tree I am all for it. Would this allow the existing NSF client to build with the new stack? In general I think this is a good idea, however I do see some detail we need to sort out. Thanks for raising this. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: Move POSIX network headers like etc. to Newlib?
On 07/04/16 11:05, Chris Johns wrote: On 7/04/2016 4:45 PM, Sebastian Huber wrote: Hello, what about moving the POSIX network headers arpa/inet.h netdb.h net/if.h netinet/in.h netinet/tcp.h syslog.h sys/socket.h sys/uio.h sys/un.h to Newlib? Where are these taken from? From the POSIX standard: http://pubs.opengroup.org/onlinepubs/9699919799/ http://pubs.opengroup.org/onlinepubs/9699919799/idx/head.html Do they allow the in-tree stack to build? [1] Probably not without modifications, but it is the goal. Before we start working on this we have to be sure that the general change is acceptable. This has the following benefits. 1. It ensures compatibility between the standard and libbsd network stack at user API level. Would this have to have a broader reach than just libbsd? What about other parts of the networking software API a package may depend on? How are those parts added onto this base level? For example I have an app which also includes .. #include #include #include These header are not defined by POSIX. However, it probably makes sense to add the usual network headers as well. Would we support all these? Maybe looking at boosts source for asio would be worth doing. Yes, but we do not plan to work on this. 2. These files may be used by lwIP to provide the standard API. Is this something to be added to lwIP or this is there now? As far as I know lwIP doesn't provide the standard headers. They must be supplied externally. 3. It allows 3rd party code depending only on the POSIX network headers to build without RTEMS, e.g. GCC Ada and Go languages, libressl library etc. Allows build of libraries per multilib. Does this mean networking is always shown to be present even if the user does not want to enable networking functionality in a 3rd party package? Yes, in case it only checks the header files. If this helps us remove the in-tree stack from the source tree I am all for it. Would this allow the existing NSF client to build with the new stack? I don't think so, due to the dependency on the RPC support (which is a real hack and a ticking security bomb). In general I think this is a good idea, however I do see some detail we need to sort out. Thanks for raising this. Chris -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: Move POSIX network headers like etc. to Newlib?
On 7/04/2016 7:25 PM, Sebastian Huber wrote: On 07/04/16 11:05, Chris Johns wrote: Do they allow the in-tree stack to build? [1] Probably not without modifications, but it is the goal. Removing the stack from RTEMS is something I would like to see happen but this effects the other networking code in the tree. The plan is to make the stack build externally. Before we start working on this we have to be sure that the general change is acceptable. What sort of time frame are you thinking about? If this helps us remove the in-tree stack from the source tree I am all for it. Would this allow the existing NSF client to build with the new stack? I don't think so, due to the dependency on the RPC support (which is a real hack and a ticking security bomb). That may be true but it allows an NFS connection which is currently more than the new stack can do and that has caught a few people out. I suspect the users who need an NFS mount do not have security concerns. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: Move POSIX network headers like etc. to Newlib?
On 07/04/16 11:56, Chris Johns wrote: On 7/04/2016 7:25 PM, Sebastian Huber wrote: On 07/04/16 11:05, Chris Johns wrote: Do they allow the in-tree stack to build? [1] Probably not without modifications, but it is the goal. Removing the stack from RTEMS is something I would like to see happen but this effects the other networking code in the tree. The plan is to make the stack build externally. Before we start working on this we have to be sure that the general change is acceptable. What sort of time frame are you thinking about? Our primary goal is to make it possible to compile libressl per multilib and to simplify the standard/libbsd stack handling. We only have a very limited time budget for this and is should be available as soon as possible. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/2] Drop include from RTEMS
This include is not present in default Newlib, glibc and FreeBSD . With it there is now a conflict with introduced by ecf453f9635fb278cff4d4bae21a1e249313b817. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/param.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/newlib/libc/sys/rtems/include/sys/param.h b/newlib/libc/sys/rtems/include/sys/param.h index aa04352..db9786b 100644 --- a/newlib/libc/sys/rtems/include/sys/param.h +++ b/newlib/libc/sys/rtems/include/sys/param.h @@ -47,8 +47,6 @@ /* end of from newlib's */ -#include - #defineBSD 199506 /* System version (year & month). */ #define BSD4_3 1 #define BSD4_4 1 -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 1/2] Move kernel dependent parts of
Move the kernel dependent parts of to new system-specific header file . Provide an empty default implementation. Add a specialized implementation for RTEMS. Signed-off-by: Sebastian Huber --- newlib/libc/include/machine/_time.h | 3 + newlib/libc/include/sys/time.h| 151 +-- newlib/libc/sys/rtems/include/machine/_time.h | 199 ++ 3 files changed, 204 insertions(+), 149 deletions(-) create mode 100644 newlib/libc/include/machine/_time.h create mode 100644 newlib/libc/sys/rtems/include/machine/_time.h diff --git a/newlib/libc/include/machine/_time.h b/newlib/libc/include/machine/_time.h new file mode 100644 index 000..476760c --- /dev/null +++ b/newlib/libc/include/machine/_time.h @@ -0,0 +1,3 @@ +#ifndef _SYS_TIME_H_ +#error "must be included via " +#endif /* !_SYS_TIME_H_ */ diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index 326d1a6..84c2ad2 100644 --- a/newlib/libc/include/sys/time.h +++ b/newlib/libc/include/sys/time.h @@ -251,47 +251,6 @@ tvtosbt(struct timeval _tv) } #endif /* __BSD_VISIBLE */ -#ifdef _KERNEL - -/* Operations on timespecs */ -#definetimespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0) -#definetimespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) -#definetimespeccmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ - ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \ - ((tvp)->tv_sec cmp (uvp)->tv_sec)) -#definetimespecadd(vvp, uvp) \ - do {\ - (vvp)->tv_sec += (uvp)->tv_sec; \ - (vvp)->tv_nsec += (uvp)->tv_nsec; \ - if ((vvp)->tv_nsec >= 10) { \ - (vvp)->tv_sec++;\ - (vvp)->tv_nsec -= 10; \ - } \ - } while (0) -#definetimespecsub(vvp, uvp) \ - do {\ - (vvp)->tv_sec -= (uvp)->tv_sec; \ - (vvp)->tv_nsec -= (uvp)->tv_nsec; \ - if ((vvp)->tv_nsec < 0) { \ - (vvp)->tv_sec--;\ - (vvp)->tv_nsec += 10; \ - } \ - } while (0) - -/* Operations on timevals. */ - -#definetimevalclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) -#definetimevalisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#definetimevalcmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ - ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ - ((tvp)->tv_sec cmp (uvp)->tv_sec)) - -/* timevaladd and timevalsub are not inlined */ - -#endif /* _KERNEL */ - /* * Names of the interval timers, and structure * defining a timer setting. @@ -305,116 +264,9 @@ struct itimerval { struct timeval it_value; /* current value */ }; -#ifdef _KERNEL - -/* - * Kernel to clock driver interface. - */ -void inittodr(time_t base); -void resettodr(void); - -extern volatile time_t time_second; -extern volatile time_t time_uptime; -extern struct bintime boottimebin; -extern struct timeval boottime; -extern struct bintime tc_tick_bt; -extern sbintime_t tc_tick_sbt; -extern struct bintime tick_bt; -extern sbintime_t tick_sbt; -extern int tc_precexp; -extern int tc_timepercentage; -extern struct bintime bt_timethreshold; -extern struct bintime bt_tickthreshold; -extern sbintime_t sbt_timethreshold; -extern sbintime_t sbt_tickthreshold; - -/* - * Functions for looking at our clock: [get]{bin,nano,micro}[up]time() - * - * Functions without the "get" prefix returns the best timestamp - * we can produce in the given format. - * - * "bin" == struct bintime == seconds + 64 bit fraction of seconds. - * "nano" == struct timespec == seconds + nanoseconds. - * "micro" == struct timeval == seconds + microseconds. - * - * Functions containing "up" returns time relative to boot and - * should be used for calculating time intervals. - * - * Functions without "up" returns UTC time. - * - * Functions with the "get" prefix returns a less precise result - * much faster than the functions without "get" prefix and should - * be used where a precision of 1/hz seconds is acceptable or where - * performance is priority. (NB: "precis
Re: Move POSIX network headers like etc. to Newlib?
On Apr 7, 2016 5:56 AM, "Sebastian Huber" < sebastian.hu...@embedded-brains.de> wrote: > > > > On 07/04/16 11:56, Chris Johns wrote: >> >> On 7/04/2016 7:25 PM, Sebastian Huber wrote: >>> >>> On 07/04/16 11:05, Chris Johns wrote: Do they allow the in-tree stack to build? [1] >>> >>> >>> Probably not without modifications, but it is the goal. >> Good. >> Removing the stack from RTEMS is something I would like to see happen but this effects the other networking code in the tree. >> >> The plan is to make the stack build externally. So this is part of this upcoming effort? Chris and I chatted last week that once this happens, the number of configure options should really be able to decline. SMP, MP, and the set of tests to build are the primary ones we would need to have. >>> Before we start >>> working on this we have to be sure that the general change is acceptable. Yes. Moving POSIX .h files to newlib is good IMO. And if Cygwin decides to also use them, it is better for a broader community. Check with the newlib community to see if there bite. Corrina and Jeff usually like to share the headers. >> >> What sort of time frame are you thinking about? > > > Our primary goal is to make it possible to compile libressl per multilib and to simplify the standard/libbsd stack handling. We only have a very limited time budget for this and is should be available as soon as possible. > Any thoughts on how to move the drivers that are in BSPs when the old stack is external? Obviously they need to go along with the stack. Chris and I have discussed at least some of the network services being considered packages beyond the stack. Stuff like httpd, ftpd, and telnetd should be able to work with either stack. Having one instance of those to maintain would be great. I'm happy to see all this happen. Hopefully it can show up in digestable pieces. > > -- > Sebastian Huber, embedded brains GmbH > > Address : Dornierstr. 4, D-82178 Puchheim, Germany > Phone : +49 89 189 47 41-16 > Fax : +49 89 189 47 41-09 > E-Mail : sebastian.hu...@embedded-brains.de > PGP : Public key available on request. > > Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. > > ___ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 1/2] 4.12/rtems-moxie.bset: Include dtc needed by gdb build
--- rtems/config/4.12/rtems-moxie.bset | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtems/config/4.12/rtems-moxie.bset b/rtems/config/4.12/rtems-moxie.bset index bfc649f..d9d6c16 100644 --- a/rtems/config/4.12/rtems-moxie.bset +++ b/rtems/config/4.12/rtems-moxie.bset @@ -5,4 +5,7 @@ %define rtems_arch moxie %define win32-gdb-disable-sim %define with_libgomp + +# Moxie needs dtc to build gdb, then pick up the rest of the set +devel/dtc-1.4.1-1 %include 4.12/rtems-default.bset -- 1.8.3.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/2] Update rtems-default to gcc 6.20160327 and newlib-2.4.0
--- rtems/config/4.12/rtems-default.bset | 2 +- .../tools/rtems-gcc-6-20160327-newlib-2.4.0-1.cfg | 22 ++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 rtems/config/tools/rtems-gcc-6-20160327-newlib-2.4.0-1.cfg diff --git a/rtems/config/4.12/rtems-default.bset b/rtems/config/4.12/rtems-default.bset index 48092c4..70520ed 100644 --- a/rtems/config/4.12/rtems-default.bset +++ b/rtems/config/4.12/rtems-default.bset @@ -3,7 +3,7 @@ 4.12/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.26-1 -tools/rtems-gcc-6-20160228-newlib-2.3.0.20160226-1 +tools/rtems-gcc-6-20160327-newlib-2.4.0-1 tools/rtems-gdb-7.11-1 tools/rtems-tools-4.12-1 tools/rtems-kernel-4.12 diff --git a/rtems/config/tools/rtems-gcc-6-20160327-newlib-2.4.0-1.cfg b/rtems/config/tools/rtems-gcc-6-20160327-newlib-2.4.0-1.cfg new file mode 100644 index 000..d47ec43 --- /dev/null +++ b/rtems/config/tools/rtems-gcc-6-20160327-newlib-2.4.0-1.cfg @@ -0,0 +1,22 @@ +%include %{_configdir}/checks.cfg +%include %{_configdir}/base.cfg + +%define gcc_version6-20160327 +%define newlib_version 2.4.0 +%define mpfr_version 2.4.2 +%define mpc_version0.8.1 +%define gmp_version4.3.2 + +%hash sha512 gcc-6-20160327.tar.bz2 0213c44e457585d15ad13fc3a7c665ba78faba0d1685e71cbf0cf32e44523394589ac60c7aea567e29c6f5e18159b446b1b0a7d39e330021c40efd8077aa5ad7 +%hash sha512 newlib-2.4.0.tar.gz c60665e793dce2368a5baf23560beb50f641e1831854d702d1d7629fb6e9200cf814527f29796792a3d2dff81afee4255723df99ceb0732f99dd9580a17d2ac0 +%hash sha512 mpfr-2.4.2.tar.bz2 c004b3dbf86c04960e4a1f8db37a409a7cc4cb76135e76e98dcc5ad93aaa8deb62334ee13ff84447a7c12a5e8cb57f25c62ac908c24920f1fb1a38d79d4a4c5e +%hash sha512 mpc-0.8.1.tar.gz 14cb9ae3d33caed24d5ae648eed28b2e00ad047a8baeff25981129af88245b4def2948573d7a00d65c5bd34e53524aa6a7351b76703c9f888b41830c1a1daae2 +%hash sha512 gmp-4.3.2.tar.bz2 2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf + +%define with_threads 1 +%define with_plugin 0 +%define with_iconv 1 + +%source set gcc ftp://gcc.gnu.org/pub/gcc/snapshots/%{gcc_version}/gcc-%{gcc_version}.tar.bz2 + +%include %{_configdir}/gcc-6-1.cfg -- 1.8.3.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [rtems-testing commit] bit_rtems: Disable C++ on architectures it is broken on
I'm interested in this too. What's broken, and how could we go about fixing it? ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 1/2] Move kernel dependent parts of
Does this address the warning in the RTEMS main_date.c command that popped up with the newlib guard changes? I am guessing not. Have you looked at that warning when using a toolset with a recent newlib? On Apr 7, 2016 5:58 AM, "Sebastian Huber" < sebastian.hu...@embedded-brains.de> wrote: > Move the kernel dependent parts of to new system-specific > header file . Provide an empty default implementation. > Add a specialized implementation for RTEMS. > > Signed-off-by: Sebastian Huber > --- > newlib/libc/include/machine/_time.h | 3 + > newlib/libc/include/sys/time.h| 151 +-- > newlib/libc/sys/rtems/include/machine/_time.h | 199 > ++ > 3 files changed, 204 insertions(+), 149 deletions(-) > create mode 100644 newlib/libc/include/machine/_time.h > create mode 100644 newlib/libc/sys/rtems/include/machine/_time.h > > diff --git a/newlib/libc/include/machine/_time.h > b/newlib/libc/include/machine/_time.h > new file mode 100644 > index 000..476760c > --- /dev/null > +++ b/newlib/libc/include/machine/_time.h > @@ -0,0 +1,3 @@ > +#ifndef _SYS_TIME_H_ > +#error "must be included via " > +#endif /* !_SYS_TIME_H_ */ > diff --git a/newlib/libc/include/sys/time.h > b/newlib/libc/include/sys/time.h > index 326d1a6..84c2ad2 100644 > --- a/newlib/libc/include/sys/time.h > +++ b/newlib/libc/include/sys/time.h > @@ -251,47 +251,6 @@ tvtosbt(struct timeval _tv) > } > #endif /* __BSD_VISIBLE */ > > -#ifdef _KERNEL > - > -/* Operations on timespecs */ > -#definetimespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = > 0) > -#definetimespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) > -#definetimespeccmp(tvp, uvp, cmp) > \ > - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ > - ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \ > - ((tvp)->tv_sec cmp (uvp)->tv_sec)) > -#definetimespecadd(vvp, uvp) > \ > - do {\ > - (vvp)->tv_sec += (uvp)->tv_sec; \ > - (vvp)->tv_nsec += (uvp)->tv_nsec; \ > - if ((vvp)->tv_nsec >= 10) { \ > - (vvp)->tv_sec++;\ > - (vvp)->tv_nsec -= 10; \ > - } \ > - } while (0) > -#definetimespecsub(vvp, uvp) > \ > - do {\ > - (vvp)->tv_sec -= (uvp)->tv_sec; \ > - (vvp)->tv_nsec -= (uvp)->tv_nsec; \ > - if ((vvp)->tv_nsec < 0) { \ > - (vvp)->tv_sec--;\ > - (vvp)->tv_nsec += 10; \ > - } \ > - } while (0) > - > -/* Operations on timevals. */ > - > -#definetimevalclear(tvp) ((tvp)->tv_sec = > (tvp)->tv_usec = 0) > -#definetimevalisset(tvp) ((tvp)->tv_sec || > (tvp)->tv_usec) > -#definetimevalcmp(tvp, uvp, cmp) > \ > - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ > - ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ > - ((tvp)->tv_sec cmp (uvp)->tv_sec)) > - > -/* timevaladd and timevalsub are not inlined */ > - > -#endif /* _KERNEL */ > - > /* > * Names of the interval timers, and structure > * defining a timer setting. > @@ -305,116 +264,9 @@ struct itimerval { > struct timeval it_value; /* current value */ > }; > > -#ifdef _KERNEL > - > -/* > - * Kernel to clock driver interface. > - */ > -void inittodr(time_t base); > -void resettodr(void); > - > -extern volatile time_t time_second; > -extern volatile time_t time_uptime; > -extern struct bintime boottimebin; > -extern struct timeval boottime; > -extern struct bintime tc_tick_bt; > -extern sbintime_t tc_tick_sbt; > -extern struct bintime tick_bt; > -extern sbintime_t tick_sbt; > -extern int tc_precexp; > -extern int tc_timepercentage; > -extern struct bintime bt_timethreshold; > -extern struct bintime bt_tickthreshold; > -extern sbintime_t sbt_timethreshold; > -extern sbintime_t sbt_tickthreshold; > - > -/* > - * Functions for looking at our clock: [get]{bin,nano,micro}[up]time() > - * > - * Functions without the "get" prefix returns the best timestamp > - * we can produce in the given format. > - * > - * "bin" == struct bintime == seconds + 64 bit fraction of seconds. > - * "nano" == struct timespec == seconds + nanoseconds. > - * "micro" == struct timeval == seconds + microseconds. > - * > - * Functions containing "
Re: Advice Wanted on sonic.c Indentation Warning
Hi again, are there any news on this? I haven't heard back from Amar yet. On Tue, Mar 29, 2016 at 11:25 AM, Martin Galvan wrote: > Hi again, I'm attaching the patch for review. It compiles fine for erc32, > though I couldn't test the samples (I don't have any sparc boards, and QEMU > only > has leon3 and sun-4m). > > I wrote to Amar about my write access but I didn't hear back from him. > Is there a way to check if my account exists using ssh? E.g. for sourceware > we have 'ssh sourceware.org alive'. > > --- > c/src/libchip/network/sonic.c | 24 +++- > 1 file changed, 11 insertions(+), 13 deletions(-) > > diff --git a/c/src/libchip/network/sonic.c b/c/src/libchip/network/sonic.c > index 1cd6cba..6e69b9e 100644 > --- a/c/src/libchip/network/sonic.c > +++ b/c/src/libchip/network/sonic.c > @@ -826,19 +826,17 @@ SONIC_STATIC void sonic_rda_wait( > * driver has to move the RRP back *two* entries to > * reuse the receive buffer holding the giant packet. > */ > - for (i = 0 ; i < 2 ; i++) { > -if ((*sc->read_register)( rp, SONIC_REG_RRP ) == > -(*sc->read_register)( rp, SONIC_REG_RSA )) > - (*sc->write_register)( > -rp, > -SONIC_REG_RRP, > -(*sc->read_register)( rp, SONIC_REG_REA ) > - ); > - (*sc->write_register)( > - rp, > - SONIC_REG_RRP, > - (*sc->read_register)(rp, SONIC_REG_RRP) - > sizeof(ReceiveResource_t) > - ); > + for (i = 0; i < 2; ++i) { > + uint32_t rrp = (*sc->read_register)( rp, SONIC_REG_RRP ); > + const uint32_t rsa = (*sc->read_register)( rp, SONIC_REG_RSA ); > + > + if (rrp == rsa) { > + const uint32_t rea = (*sc->read_register)( rp, SONIC_REG_REA ); > + (*sc->write_register)( rp, SONIC_REG_RRP, rea ); > + } > + > + rrp = (*sc->read_register)(rp, SONIC_REG_RRP); > + (*sc->write_register)( rp, SONIC_REG_RRP, rrp - > sizeof(ReceiveResource_t) ); >} > >/* > -- > 2.8.0 > -- Martin Galvan Software Engineer Taller Technologies Argentina San Lorenzo 47, 3rd Floor, Office 5 Córdoba, Argentina Phone: 54 351 4217888 / +54 351 4218211 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [rtems-testing commit] bit_rtems: Disable C++ on architectures it is broken on
On Apr 7, 2016 1:07 PM, "Martin Galvan" < martin.gal...@tallertechnologies.com> wrote: > > I'm interested in this too. What's broken, and how could we go about fixing it? I started a build of all BSPs with C++ enabled before I boarded a plane a few hours ago. I will report all the outstanding issues when that finished and I am somewhere I can work. My recollection is that it is a combination of some links failing due to missing atomic operations and some targets really not having working C++ support. But I disabled them one at a time without keeping good notes. So I owe a report. Maybe with that list, someone can fix a few. --Joel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Error building RTEMS tools 4.12 for Sparc CPU
Greetings, I am building RTEMS tools version 4.12 for Sparc and I have been receiving the error message attached in the rsb-report error log. I am using the branch pulled from github with commit eac749bb80b184c1f5e34e40d745e0c428cb9f73 I don't know how to proceed from here. Any help on how to debug this errors will be greatly appreciated. Thanks. Best regards, Habeeb RTEMS Tools Project - Source Builder Error Report Build: error: building sparc-rtems4.12-gdb-7.11-i686-linux-gnu-1 Command Line: ../source-builder/sb-set-builder --prefix=/home/dipupo/development/rtems/4.12 4.12/rtems-sparc Python: 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] git://git.rtems.org/rtems-source-builder.git/origin/eac749bb80b184c1f5e34e40d745e0c428cb9f73 Linux dipupo-VirtualBox 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 14:46:51 UTC 2015 i686 Tail of the build log: checking for struct reg.r_fs... no checking for struct reg.r_gs... no checking for struct user_regs_struct.fs_base... no checking for struct user_regs_struct.gs_base... no checking for PTRACE_GETREGS... yes checking for PTRACE_GETFPXREGS... yes checking for PT_GETDBREGS... no checking for PT_GETXMMREGS... no checking for struct ptrace_lwpinfo.pl_tdname... no checking for gregset_t in sys/procfs.h... no checking for fpregset_t in sys/procfs.h... no checking for prgregset_t in sys/procfs.h... yes checking for prfpregset_t in sys/procfs.h... yes checking for prgregset32_t in sys/procfs.h... no checking for lwpid_t in sys/procfs.h... yes checking for psaddr_t in sys/procfs.h... yes checking for prsysent_t in sys/procfs.h... no checking for pr_sigset_t in sys/procfs.h... no checking for pr_sigaction64_t in sys/procfs.h... no checking for pr_siginfo64_t in sys/procfs.h... no checking whether prfpregset_t type is broken... no checking for long long support in compiler... yes checking for long long support in printf... yes checking for decfloat support in printf... no checking for long double support in compiler... yes checking for long double support in printf... yes checking for long double support in scanf... yes checking for the dynamic export flag... -rdynamic checking whether has TD_NOTALLOC... yes checking whether has TD_VERSION... yes checking whether has TD_NOTLS... yes checking whether ADDR_NO_RANDOMIZE is declared... yes checking compiler warning flags... -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral checking for cygwin... no checking for ELF support in BFD... yes checking for library containing dlopen... (cached) -ldl checking for Mach-O support in BFD... no checking whether to use lzma... auto checking for liblzma... no checking for X... no enable_sim = yes enableval = yes checking whether to use babeltrace... auto checking for libbabeltrace... no configure: WARNING: babeltrace is missing or unusable; GDB is unable to read CTF data. configure: updating cache ./config.cache configure: creating ./config.status config.status: creating jit-reader.h config.status: creating gcore config.status: creating Makefile config.status: creating gdb-gdb.gdb config.status: creating doc/Makefile config.status: creating data-directory/Makefile config.status: creating config.h config.status: executing depdir commands mkdir -p -- .deps === configuring in testsuite (/home/dipupo/development/rtems/rsb/rtems/build/sparc-rtems4.12-gdb-7.11-i686-linux-gnu-1/build/gdb/testsuite) configure: running /bin/bash ../../../gdb-7.11/gdb/testsuite/configure --disable-option-checking '--prefix=/home/dipupo/development/rtems/4.12' '--verbose' '--disable-nls' '--without-included-gettext' '--disable-win32-registry' '--disable-werror' '--enable-sim' '--without-zlib' '--with-expat' '--with-python' '--bindir=/home/dipupo/development/rtems/4.12/bin' '--exec-prefix=/home/dipupo/development/rtems/4.12' '--includedir=/home/dipupo/development/rtems/4.12/include' '--libdir=/home/dipupo/development/rtems/4.12/lib' '--mandir=/home/dipupo/development/rtems/4.12/share/man' '--infodir=/home/dipupo/development/rtems/4.12/share/info' '--program-transform-name=s&^&sparc-rtems4.12-&' '--build=i686-linux-gnu' '--host=i686-linux-gnu' '--target=sparc-rtems4.12' 'build_alias=i686-linux-gnu' 'host_alias=i686-linux-gnu' 'target_alias=sparc-rtems4.12' 'CC=/usr/bin/gcc -O2 -pipe -I/home/dipupo/development/rtems/rsb/rtems/build/tmp/sb-dipupo/4.12/rtems-sparc/home/dipupo/development/rtems/4.12/include' 'CFLAGS=-g -O2' 'LDFLAGS=-static-libstdc++ -static-libgcc -L/home/dipupo/development/rtems/rsb/rtems/build/tmp/sb-dipupo/4.12/rtems-sparc/home/dipupo/development/rtems/4.12/lib' 'CXX=/usr/bin/g++ -O2 -pipe -I/home/dipupo/development/rtems/rsb/rtems/build/tmp/sb-dipupo/4.12/rtems-sparc/home/dipupo/development/rtems/4.12/include' 'CXXFLAGS=-g -O2' 'MAKEIN
Re: Move POSIX network headers like etc. to Newlib?
On 8/04/2016 12:37 AM, Joel Sherrill wrote: Chris and I have discussed at least some of the network services being considered packages beyond the stack. Stuff like httpd, ftpd, and telnetd should be able to work with either stack. Having one instance of those to maintain would be great. I'm happy to see all this happen. Hopefully it can show up in digestable pieces. We need to maintain our current functionality and I am prepared to bridge but not abandon. The libbsd stack has made progress but does not support as much as the old stack does. Until it does I feel we need to keep the old stack going and to support it. To me this means adding headers to newlib requires the in-tree stack and libbsd work with out impacting users and existing applications. If I understand what is bring proposed any suitable networking software should be able to be built against just the compiler, newlib etc and it does not need a built and installed RTEMS with a specific networking implementation. This means networking could become a link time setting. An interesting challenge. Sebastian, I know you have talked about libressl, but it is still not clear to me why doing this is needed. Do you have a specific use case? Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 1/2] Move kernel dependent parts of
On 07/04/16 17:56, Joel Sherrill wrote: Does this address the warning in the RTEMS main_date.c command that popped up with the newlib guard changes? No, this patch solves a completely different problem. The strptime() is declared in via #if __XSI_VISIBLE char *_EXFUN(strptime, (const char *__restrict, const char *__restrict, struct tm *__restrict)); #endif which uses #if (_XOPEN_SOURCE - 0) >= 700 #define__XSI_VISIBLE700 #elif (_XOPEN_SOURCE - 0) >= 600 #define__XSI_VISIBLE600 #elif (_XOPEN_SOURCE - 0) >= 500 #define__XSI_VISIBLE500 #elif defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED) #define__XSI_VISIBLE4 #elif defined(_XOPEN_SOURCE) #define__XSI_VISIBLE1 #else #define__XSI_VISIBLE0 #endif I guess we need an #define _XOPEN_SOURCE #include -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] shell: Fix warning visible with latest Newlib
--- cpukit/libmisc/shell/main_date.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpukit/libmisc/shell/main_date.c b/cpukit/libmisc/shell/main_date.c index 9b970a6..cae403b 100644 --- a/cpukit/libmisc/shell/main_date.c +++ b/cpukit/libmisc/shell/main_date.c @@ -16,10 +16,13 @@ #include "config.h" #endif +#define _DEFAULT_SOURCE +#define _XOPEN_SOURCE #include #include #include #include +#include #include #include -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 01/12] posix: Use proper lock for sigaction()
Update #2555. --- cpukit/posix/src/sigaction.c | 29 + 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/cpukit/posix/src/sigaction.c b/cpukit/posix/src/sigaction.c index a2f9028..177dcd1 100644 --- a/cpukit/posix/src/sigaction.c +++ b/cpukit/posix/src/sigaction.c @@ -24,17 +24,8 @@ #include #include -#include -#include #include #include -#include - -/* - * PARAMETERS_PASSING_S is defined in ptimer.c - */ - -extern void PARAMETERS_PASSING_S (int num_signal, const struct sigaction inf); int sigaction( int sig, @@ -42,7 +33,7 @@ int sigaction( struct sigaction *__restrict oact ) { - ISR_Level level; + ISR_lock_Context lock_context; if ( !sig ) rtems_set_errno_and_return_minus_one( EINVAL ); @@ -60,7 +51,7 @@ int sigaction( if ( sig == SIGKILL ) rtems_set_errno_and_return_minus_one( EINVAL ); - _Thread_Disable_dispatch(); + _POSIX_signals_Acquire( &lock_context ); if ( oact ) *oact = _POSIX_signals_Vectors[ sig ]; @@ -77,17 +68,15 @@ int sigaction( * we can just copy the provided sigaction structure into the vectors. */ -_ISR_Disable( level ); - if ( act->sa_handler == SIG_DFL ) { -_POSIX_signals_Vectors[ sig ] = _POSIX_signals_Default_vectors[ sig ]; - } else { - _POSIX_signals_Clear_process_signals( sig ); - _POSIX_signals_Vectors[ sig ] = *act; - } -_ISR_Enable( level ); +if ( act->sa_handler == SIG_DFL ) { + _POSIX_signals_Vectors[ sig ] = _POSIX_signals_Default_vectors[ sig ]; +} else { + _POSIX_signals_Clear_process_signals( sig ); + _POSIX_signals_Vectors[ sig ] = *act; +} } - _Thread_Enable_dispatch(); + _POSIX_signals_Release( &lock_context ); return 0; } -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 04/12] posix: Use a dedicated lock for scheduler changes
Update #2555. --- cpukit/posix/include/rtems/posix/pthreadimpl.h | 17 +++ cpukit/posix/include/rtems/posix/threadsup.h | 3 ++ cpukit/posix/src/pthread.c | 65 -- cpukit/posix/src/pthreadcreate.c | 4 +- cpukit/posix/src/pthreadsetschedparam.c| 34 -- 5 files changed, 83 insertions(+), 40 deletions(-) diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h b/cpukit/posix/include/rtems/posix/pthreadimpl.h index 42f10b0..ef5821e 100644 --- a/cpukit/posix/include/rtems/posix/pthreadimpl.h +++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h @@ -223,6 +223,23 @@ RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Join_dequeue( ); } +RTEMS_INLINE_ROUTINE void _POSIX_Threads_Scheduler_acquire( + POSIX_API_Control *api, + ISR_lock_Context *lock_context +) +{ + _ISR_lock_ISR_disable_and_acquire( &api->Scheduler_lock, lock_context ); +} + +RTEMS_INLINE_ROUTINE void _POSIX_Threads_Scheduler_release( + POSIX_API_Control *api, + ISR_lock_Context *lock_context +) +{ + _ISR_lock_Release_and_ISR_enable( &api->Scheduler_lock, lock_context ); +} + + /** @} */ #ifdef __cplusplus diff --git a/cpukit/posix/include/rtems/posix/threadsup.h b/cpukit/posix/include/rtems/posix/threadsup.h index 7cd2354..93ba2c1 100644 --- a/cpukit/posix/include/rtems/posix/threadsup.h +++ b/cpukit/posix/include/rtems/posix/threadsup.h @@ -19,6 +19,7 @@ #define _RTEMS_POSIX_THREADSUP_H #include +#include #include #include #include @@ -51,6 +52,8 @@ typedef struct { /** This is the set of threads waiting for the thread to exit. */ Thread_queue_ControlJoin_List; /** This is the thread's current scheduling policy. */ + ISR_LOCK_MEMBER(Scheduler_lock ) + /** This is the thread's current scheduling policy. */ int schedpolicy; /** This is the thread's current set of scheduling parameters. */ struct sched_param schedparam; diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 12f02df..f3d45c9 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -106,39 +106,37 @@ static bool _POSIX_Threads_Sporadic_budget_TSR_filter( */ void _POSIX_Threads_Sporadic_budget_TSR( Watchdog_Control *watchdog ) { - uint32_tticks; POSIX_API_Control *api; Thread_Control *the_thread; - ISR_Level level; + ISR_lock_Contextlock_context; + Priority_Controlnew_priority; api = RTEMS_CONTAINER_OF( watchdog, POSIX_API_Control, Sporadic_timer ); the_thread = api->thread; - /* ticks is guaranteed to be at least one */ - ticks = _Timespec_To_ticks( &api->schedparam.sched_ss_init_budget ); + _POSIX_Threads_Scheduler_acquire( api, &lock_context ); - the_thread->cpu_time_budget = ticks; + the_thread->cpu_time_budget = +_Timespec_To_ticks( &api->schedparam.sched_ss_init_budget ); + + _Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer ); + _Watchdog_Per_CPU_insert_relative( +&api->Sporadic_timer, +_Per_CPU_Get(), +_Timespec_To_ticks( &api->schedparam.sched_ss_repl_period ) + ); + + new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority ); + + _POSIX_Threads_Scheduler_acquire( api, &lock_context ); _Thread_Change_priority( the_thread, -_POSIX_Priority_To_core( api->schedparam.sched_priority ), +new_priority, NULL, _POSIX_Threads_Sporadic_budget_TSR_filter, true ); - - /* ticks is guaranteed to be at least one */ - ticks = _Timespec_To_ticks( &api->schedparam.sched_ss_repl_period ); - - _Thread_Disable_dispatch(); - _ISR_Disable( level ); - _Watchdog_Per_CPU_insert_relative( -&api->Sporadic_timer, -_Per_CPU_Get(), -ticks - ); - _ISR_Enable( level ); - _Thread_Unnest_dispatch(); } static bool _POSIX_Threads_Sporadic_budget_callout_filter( @@ -202,6 +200,8 @@ static bool _POSIX_Threads_Create_extension( api = created->API_Extensions[ THREAD_API_POSIX ]; + _ISR_lock_Initialize( &api->Scheduler_lock, "POSIX Threads Scheduler" ); + /* XXX check all fields are touched */ api->thread = created; _POSIX_Threads_Initialize_attributes( &api->Attributes ); @@ -244,12 +244,26 @@ static bool _POSIX_Threads_Create_extension( return true; } +static void _POSIX_Threads_Delete_extension( + Thread_Control *executing, + Thread_Control *deleted +) +{ + POSIX_API_Control *api; + + api = deleted->API_Extensions[ THREAD_API_POSIX ]; + + _ISR_lock_Destroy( &api->Scheduler_lock ); + _Thread_queue_Destroy( &api->Join_List ); +} + static void _POSIX_Threads_Terminate_extension( Thread_Control *executing ) { Thread_Control *the_thread; POSIX_API_Control *api; + ISR_lock_Contextlock_context; void **value_ptr; api = executing->API_Extensions[ THREAD_API_POSIX ]; @@ -265,12 +279,15 @@ static void _POSIX_Threads_Terminate_extension( *(void **)the_thread->Wait.return_a
[PATCH 07/12] score: Simplify _Objects_Get_no_protection()
This functions supports only local objects. Thus, drop the location parameter which was unused by all callers. Remove superfluous includes from Classic Region implementation. --- cpukit/posix/include/rtems/posix/keyimpl.h| 9 +- cpukit/rtems/include/rtems/rtems/regionimpl.h | 16 +--- cpukit/rtems/src/regiondelete.c | 45 +++--- cpukit/rtems/src/regionextend.c | 73 ++-- cpukit/rtems/src/regiongetfreeinfo.c | 48 -- cpukit/rtems/src/regiongetinfo.c | 39 +++-- cpukit/rtems/src/regiongetsegment.c | 121 -- cpukit/rtems/src/regiongetsegmentsize.c | 41 - cpukit/rtems/src/regionprocessqueue.c | 12 +-- cpukit/rtems/src/regionresizesegment.c| 71 ++- cpukit/rtems/src/regionreturnsegment.c| 51 --- cpukit/score/include/rtems/score/objectimpl.h | 6 +- cpukit/score/src/objectgetnext.c | 9 +- cpukit/score/src/objectgetnoprotection.c | 7 +- 14 files changed, 207 insertions(+), 341 deletions(-) diff --git a/cpukit/posix/include/rtems/posix/keyimpl.h b/cpukit/posix/include/rtems/posix/keyimpl.h index 0f255ba..1f87470 100644 --- a/cpukit/posix/include/rtems/posix/keyimpl.h +++ b/cpukit/posix/include/rtems/posix/keyimpl.h @@ -76,13 +76,8 @@ RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free( RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get( pthread_key_t key ) { - Objects_Locations location; - - return (POSIX_Keys_Control *) _Objects_Get_no_protection( -&_POSIX_Keys_Information, -(Objects_Id) key, -&location - ); + return (POSIX_Keys_Control *) +_Objects_Get_no_protection( &_POSIX_Keys_Information, (Objects_Id) key ); } RTEMS_INLINE_ROUTINE void _POSIX_Keys_Key_value_acquire( diff --git a/cpukit/rtems/include/rtems/rtems/regionimpl.h b/cpukit/rtems/include/rtems/rtems/regionimpl.h index 4598351..60cf50c 100644 --- a/cpukit/rtems/include/rtems/rtems/regionimpl.h +++ b/cpukit/rtems/include/rtems/rtems/regionimpl.h @@ -67,23 +67,11 @@ RTEMS_INLINE_ROUTINE void _Region_Free ( _Objects_Free( &_Region_Information, &the_region->Object ); } -/** - * @brief Region_Get - * - * This function maps region IDs to region control blocks. - * If ID corresponds to a local region, then it returns - * the_region control pointer which maps to ID and location - * is set to OBJECTS_LOCAL. Otherwise, location is set - * to OBJECTS_ERROR and the_region is undefined. - */ -RTEMS_INLINE_ROUTINE Region_Control *_Region_Get ( - Objects_Id id, - Objects_Locations *location -) +RTEMS_INLINE_ROUTINE Region_Control *_Region_Get( Objects_Id id ) { _Assert( _RTEMS_Allocator_is_owner() ); return (Region_Control *) -_Objects_Get_no_protection( &_Region_Information, id, location ); +_Objects_Get_no_protection( &_Region_Information, id ); } /** diff --git a/cpukit/rtems/src/regiondelete.c b/cpukit/rtems/src/regiondelete.c index f256423..3927a54 100644 --- a/cpukit/rtems/src/regiondelete.c +++ b/cpukit/rtems/src/regiondelete.c @@ -18,50 +18,33 @@ #include "config.h" #endif -#include -#include -#include -#include #include -#include -#include rtems_status_code rtems_region_delete( rtems_id id ) { - Objects_Locations location; - rtems_status_code return_status; - Region_Control *the_region; + rtems_status_code status; + Region_Control*the_region; _Objects_Allocator_lock(); _RTEMS_Lock_allocator(); -the_region = _Region_Get( id, &location ); -switch ( location ) { + the_region = _Region_Get( id ); - case OBJECTS_LOCAL: -if ( the_region->number_of_used_blocks != 0 ) - return_status = RTEMS_RESOURCE_IN_USE; -else { - _Objects_Close( &_Region_Information, &the_region->Object ); - _Region_Free( the_region ); - return_status = RTEMS_SUCCESSFUL; -} -break; - -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE:/* this error cannot be returned */ -#endif - - case OBJECTS_ERROR: - default: -return_status = RTEMS_INVALID_ID; -break; + if ( the_region != NULL ) { +if ( the_region->number_of_used_blocks != 0 ) { + status = RTEMS_RESOURCE_IN_USE; +} else { + _Objects_Close( &_Region_Information, &the_region->Object ); + _Region_Free( the_region ); + status = RTEMS_SUCCESSFUL; } + } else { +status = RTEMS_INVALID_ID; + } _RTEMS_Unlock_allocator(); _Objects_Allocator_unlock(); - - return return_status; + return status; } diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c index 2ee2b99..b1df066 100644 --- a/cpukit/rtems/src/regionextend.c +++ b/cpukit/rtems/src/regionextend.c @@ -18,13 +18,7 @@ #include "config.h" #endif -#include -#include -#include -#include #include -#include -#include rtems_status_code rtems_region_extend(
[PATCH 12/12] rtems: Delete Region_Control::page_size
--- cpukit/libmisc/monitor/mon-region.c | 2 +- cpukit/rtems/include/rtems/rtems/region.h | 1 - cpukit/rtems/src/regioncreate.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cpukit/libmisc/monitor/mon-region.c b/cpukit/libmisc/monitor/mon-region.c index cc5c04b..8734222 100644 --- a/cpukit/libmisc/monitor/mon-region.c +++ b/cpukit/libmisc/monitor/mon-region.c @@ -24,7 +24,7 @@ rtems_monitor_region_canonical( canonical_region->attribute = rtems_region->attribute_set; canonical_region->start_addr = (void *) heap->area_begin; canonical_region->length = heap->area_end - heap->area_begin; -canonical_region->page_size = rtems_region->page_size; +canonical_region->page_size = heap->page_size; canonical_region->max_seg_size = rtems_region->maximum_segment_size; canonical_region->used_blocks = heap->stats.used_blocks; } diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h index 78f6686..4772e28 100644 --- a/cpukit/rtems/include/rtems/rtems/region.h +++ b/cpukit/rtems/include/rtems/rtems/region.h @@ -60,7 +60,6 @@ typedef struct { Objects_Control Object; Thread_queue_Control Wait_queue;/* waiting threads*/ const Thread_queue_Operations *wait_operations; - uintptr_t page_size; /* in bytes */ uintptr_t maximum_segment_size; /* in bytes */ rtems_attribute attribute_set; Heap_Control Memory; diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index cb19416..430de3b 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -87,7 +87,6 @@ rtems_status_code rtems_region_create( _Region_Free( the_region ); return_status = RTEMS_INVALID_SIZE; } else { -the_region->page_size = page_size; the_region->attribute_set = attribute_set; _Objects_Open( -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 03/12] score: Simplify _Timespec_To_ticks()
--- cpukit/score/src/timespectoticks.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cpukit/score/src/timespectoticks.c b/cpukit/score/src/timespectoticks.c index d02a350..61ee06d 100644 --- a/cpukit/score/src/timespectoticks.c +++ b/cpukit/score/src/timespectoticks.c @@ -30,8 +30,7 @@ uint32_t _Timespec_To_ticks( uint32_t ticks; uint32_t nanoseconds_per_tick; - if ( (time->tv_sec == 0) && (time->tv_nsec == 0) ) -return 0; + nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick(); /** * We should ensure the ticks not be truncated by integer division. We @@ -39,11 +38,7 @@ uint32_t _Timespec_To_ticks( * should not be shorter. */ ticks = time->tv_sec * rtems_configuration_get_ticks_per_second(); - nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick(); - ticks+= time->tv_nsec / nanoseconds_per_tick; - - if ( (time->tv_nsec % nanoseconds_per_tick) != 0 ) -ticks += 1; + ticks += ( time->tv_nsec + nanoseconds_per_tick - 1 ) / nanoseconds_per_tick; return ticks; } -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 02/12] score: Add ticks per second to configuration
This avoids the calculation of this value at run-time, similar to rtems_configuration_get_nanoseconds_per_tick(). Delete TOD_TICKS_PER_SECOND and replace it with rtems_configuration_get_ticks_per_second(). --- cpukit/posix/src/alarm.c | 3 ++- cpukit/sapi/include/confdefs.h | 1 + cpukit/sapi/include/rtems/config.h | 9 + cpukit/score/Makefile.am | 1 - cpukit/score/include/rtems/score/todimpl.h | 20 cpukit/score/src/coretodtickspersec.c | 28 cpukit/score/src/timespectoticks.c | 7 +++ 7 files changed, 15 insertions(+), 54 deletions(-) delete mode 100644 cpukit/score/src/coretodtickspersec.c diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c index 10443e4..6140095 100644 --- a/cpukit/posix/src/alarm.c +++ b/cpukit/posix/src/alarm.c @@ -26,6 +26,7 @@ #include #include +#include ISR_LOCK_DEFINE( static, _POSIX_signals_Alarm_lock, "POSIX Alarm" ) @@ -64,7 +65,7 @@ unsigned int alarm( uint32_t ticks; the_watchdog = &_POSIX_signals_Alarm_watchdog; - ticks_per_second = TOD_TICKS_PER_SECOND; + ticks_per_second = rtems_configuration_get_ticks_per_second(); ticks = seconds * ticks_per_second; _ISR_lock_ISR_disable_and_acquire( diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index e0b2a80..9e5bd14 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -3413,6 +3413,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS, /* enabled */ CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */ 1000 * CONFIGURE_MICROSECONDS_PER_TICK, /* nanoseconds per clock tick */ +100 / CONFIGURE_MICROSECONDS_PER_TICK,/* ticks per second */ CONFIGURE_TICKS_PER_TIMESLICE,/* ticks per timeslice quantum */ CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */ CONFIGURE_IDLE_TASK_STACK_SIZE, /* IDLE task stack size */ diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h index 1b48ea9..a2fb833 100644 --- a/cpukit/sapi/include/rtems/config.h +++ b/cpukit/sapi/include/rtems/config.h @@ -173,6 +173,13 @@ typedef struct { uint32_t nanoseconds_per_tick; /** + * This field specifies the number of clock ticks per second. This value is + * derived from the microseconds_per_tick field and provided to avoid + * calculation at run-time. + */ + uint32_t ticks_per_second; + + /** * This field specifies the number of ticks in each task's timeslice. */ uint32_t ticks_per_timeslice; @@ -309,6 +316,8 @@ extern const rtems_configuration_table Configuration; (Configuration.microseconds_per_tick / 1000) #define rtems_configuration_get_nanoseconds_per_tick() \ (Configuration.nanoseconds_per_tick) +#define rtems_configuration_get_ticks_per_second() \ +(Configuration.ticks_per_second) #define rtems_configuration_get_ticks_per_timeslice() \ (Configuration.ticks_per_timeslice) diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 455c99d..f7affdf 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -330,7 +330,6 @@ libscore_a_SOURCES += src/timespecaddto.c src/timespecfromticks.c \ ## TOD_C_FILES libscore_a_SOURCES += src/coretod.c src/coretodset.c \ -src/coretodtickspersec.c \ src/coretodadjust.c libscore_a_SOURCES += src/coretodabsolutetimeout.c diff --git a/cpukit/score/include/rtems/score/todimpl.h b/cpukit/score/include/rtems/score/todimpl.h index b1f8a6d..2968bf6 100644 --- a/cpukit/score/include/rtems/score/todimpl.h +++ b/cpukit/score/include/rtems/score/todimpl.h @@ -264,26 +264,6 @@ static inline uint32_t _TOD_Seconds_since_epoch( void ) } /** - * @brief Gets number of ticks in a second. - * - * This method returns the number of ticks in a second. - * - * @note If the clock tick value does not multiply evenly into a second - *then this number of ticks will be slightly shorter than a second. - */ -uint32_t TOD_TICKS_PER_SECOND_method(void); - -/** - * @brief Gets number of ticks in a second. - * - * This method exists to hide the fact that TOD_TICKS_PER_SECOND can not - * be implemented as a macro in a .h file due to visibility issues. - * The Configuration Table is not available to SuperCore .h files but - * is available to their .c files. - */ -#define TOD_TICKS_PER_SECOND TOD_TICKS_PER_SECOND_method() - -/** * This routine returns a timeval based upon the internal timespec format TOD. */ diff --git a/cpukit/score/src/coretodtickspersec.c b/cpukit/score/src/coretodtickspersec.c deleted file mode 100644 index cfe53ce..000 --- a/cpukit/score/src/coretodtickspersec.c +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @fil
[PATCH 09/12] rtems: Delete Region_Control::number_of_used_blocks
Use Heap_Statistics::used_blocks instead. --- cpukit/libmisc/monitor/mon-region.c | 3 ++- cpukit/rtems/include/rtems/rtems/region.h | 1 - cpukit/rtems/src/regioncreate.c | 9 - cpukit/rtems/src/regiondelete.c | 2 +- cpukit/rtems/src/regiongetsegment.c | 1 - cpukit/rtems/src/regionprocessqueue.c | 1 - cpukit/rtems/src/regionreturnsegment.c| 2 -- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/cpukit/libmisc/monitor/mon-region.c b/cpukit/libmisc/monitor/mon-region.c index 289a00b..17e6d18 100644 --- a/cpukit/libmisc/monitor/mon-region.c +++ b/cpukit/libmisc/monitor/mon-region.c @@ -19,13 +19,14 @@ rtems_monitor_region_canonical( ) { const Region_Control *rtems_region = (const Region_Control *) region_void; +const Heap_Control *heap = &rtems_region->Memory; canonical_region->attribute = rtems_region->attribute_set; canonical_region->start_addr = rtems_region->starting_address; canonical_region->length = rtems_region->length; canonical_region->page_size = rtems_region->page_size; canonical_region->max_seg_size = rtems_region->maximum_segment_size; -canonical_region->used_blocks = rtems_region->number_of_used_blocks; +canonical_region->used_blocks = heap->stats.used_blocks; } diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h index 0c28899..8ae52f3 100644 --- a/cpukit/rtems/include/rtems/rtems/region.h +++ b/cpukit/rtems/include/rtems/rtems/region.h @@ -65,7 +65,6 @@ typedef struct { uintptr_t page_size; /* in bytes */ uintptr_t maximum_segment_size; /* in bytes */ rtems_attribute attribute_set; - uint32_t number_of_used_blocks; /* blocks allocated */ Heap_Control Memory; } Region_Control; diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index 482c43b..8f1f7c5 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -87,11 +87,10 @@ rtems_status_code rtems_region_create( _Region_Free( the_region ); return_status = RTEMS_INVALID_SIZE; } else { -the_region->starting_address = starting_address; -the_region->length= length; -the_region->page_size = page_size; -the_region->attribute_set = attribute_set; -the_region->number_of_used_blocks = 0; +the_region->starting_address = starting_address; +the_region->length = length; +the_region->page_size= page_size; +the_region->attribute_set= attribute_set; _Objects_Open( &_Region_Information, diff --git a/cpukit/rtems/src/regiondelete.c b/cpukit/rtems/src/regiondelete.c index 7897646..2161335 100644 --- a/cpukit/rtems/src/regiondelete.c +++ b/cpukit/rtems/src/regiondelete.c @@ -35,7 +35,7 @@ rtems_status_code rtems_region_delete( return RTEMS_INVALID_ID; } - if ( the_region->number_of_used_blocks != 0 ) { + if ( the_region->Memory.stats.used_blocks != 0 ) { status = RTEMS_RESOURCE_IN_USE; } else { _Objects_Close( &_Region_Information, &the_region->Object ); diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c index ecc6378..d59de38 100644 --- a/cpukit/rtems/src/regiongetsegment.c +++ b/cpukit/rtems/src/regiongetsegment.c @@ -58,7 +58,6 @@ rtems_status_code rtems_region_get_segment( the_segment = _Region_Allocate_segment( the_region, size ); if ( the_segment != NULL ) { - the_region->number_of_used_blocks += 1; *segment = the_segment; status = RTEMS_SUCCESSFUL; } else if ( _Options_Is_no_wait( option_set ) ) { diff --git a/cpukit/rtems/src/regionprocessqueue.c b/cpukit/rtems/src/regionprocessqueue.c index 1c9d273..db5759a 100644 --- a/cpukit/rtems/src/regionprocessqueue.c +++ b/cpukit/rtems/src/regionprocessqueue.c @@ -64,7 +64,6 @@ void _Region_Process_queue( break; *(void **)the_thread->Wait.return_argument = the_segment; -the_region->number_of_used_blocks += 1; _Thread_queue_Extract( the_thread ); the_thread->Wait.return_code = RTEMS_SUCCESSFUL; } diff --git a/cpukit/rtems/src/regionreturnsegment.c b/cpukit/rtems/src/regionreturnsegment.c index 8ec84fb..ff742cf 100644 --- a/cpukit/rtems/src/regionreturnsegment.c +++ b/cpukit/rtems/src/regionreturnsegment.c @@ -34,8 +34,6 @@ rtems_status_code rtems_region_return_segment( } if ( _Region_Free_segment( the_region, segment ) ) { -the_region->number_of_used_blocks -= 1; - /* Unlocks allocator */ _Region_Process_queue( the_region ); return RTEMS_SUCCESSFUL; -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 05/12] rtems: Remove dead code
The heap protection enabled by RTEMS_DEBUG offers the same functionality and more. --- cpukit/rtems/src/regionreturnsegment.c | 20 1 file changed, 20 deletions(-) diff --git a/cpukit/rtems/src/regionreturnsegment.c b/cpukit/rtems/src/regionreturnsegment.c index 1af54f2..aeff1df 100644 --- a/cpukit/rtems/src/regionreturnsegment.c +++ b/cpukit/rtems/src/regionreturnsegment.c @@ -18,14 +18,6 @@ #include "config.h" #endif -#ifdef RTEMS_REGION_SHRED_ON_FREE -#include - -#ifndef RTEMS_REGION_FREE_SHRED_PATTERN -#define RTEMS_REGION_FREE_SHRED_PATTERN 0x00 -#endif -#endif - #include #include #include @@ -41,9 +33,6 @@ rtems_status_code rtems_region_return_segment( { Objects_Locationslocation; rtems_status_codereturn_status; -#ifdef RTEMS_REGION_FREE_SHRED_PATTERN - uint32_t size; -#endif int status; Region_Control *the_region; @@ -53,12 +42,6 @@ rtems_status_code rtems_region_return_segment( switch ( location ) { case OBJECTS_LOCAL: -#ifdef RTEMS_REGION_FREE_SHRED_PATTERN -if ( !_Heap_Size_of_alloc_area( &the_region->Memory, segment, &size ) ) - return_status = RTEMS_INVALID_ADDRESS; -else { - memset( segment, (RTEMS_REGION_FREE_SHRED_PATTERN & 0xFF), size ); -#endif status = _Region_Free_segment( the_region, segment ); if ( !status ) @@ -70,9 +53,6 @@ rtems_status_code rtems_region_return_segment( return RTEMS_SUCCESSFUL; } -#ifdef RTEMS_REGION_FREE_SHRED_PATTERN -} -#endif break; #if defined(RTEMS_MULTIPROCESSING) -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 10/12] rtems: Delete Region_Control::starting_address
--- cpukit/libmisc/monitor/mon-region.c | 2 +- cpukit/rtems/include/rtems/rtems/region.h | 1 - cpukit/rtems/src/regioncreate.c | 7 +++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cpukit/libmisc/monitor/mon-region.c b/cpukit/libmisc/monitor/mon-region.c index 17e6d18..60136c9 100644 --- a/cpukit/libmisc/monitor/mon-region.c +++ b/cpukit/libmisc/monitor/mon-region.c @@ -22,7 +22,7 @@ rtems_monitor_region_canonical( const Heap_Control *heap = &rtems_region->Memory; canonical_region->attribute = rtems_region->attribute_set; -canonical_region->start_addr = rtems_region->starting_address; +canonical_region->start_addr = (void *) heap->area_begin; canonical_region->length = rtems_region->length; canonical_region->page_size = rtems_region->page_size; canonical_region->max_seg_size = rtems_region->maximum_segment_size; diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h index 8ae52f3..eb7e4af 100644 --- a/cpukit/rtems/include/rtems/rtems/region.h +++ b/cpukit/rtems/include/rtems/rtems/region.h @@ -60,7 +60,6 @@ typedef struct { Objects_Control Object; Thread_queue_Control Wait_queue;/* waiting threads*/ const Thread_queue_Operations *wait_operations; - void *starting_address; /* physical start addr*/ uintptr_t length;/* physical length(bytes) */ uintptr_t page_size; /* in bytes */ uintptr_t maximum_segment_size; /* in bytes */ diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index 8f1f7c5..f6dfe82 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -87,10 +87,9 @@ rtems_status_code rtems_region_create( _Region_Free( the_region ); return_status = RTEMS_INVALID_SIZE; } else { -the_region->starting_address = starting_address; -the_region->length = length; -the_region->page_size= page_size; -the_region->attribute_set= attribute_set; +the_region->length= length; +the_region->page_size = page_size; +the_region->attribute_set = attribute_set; _Objects_Open( &_Region_Information, -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 06/12] rtems: Ensure lock ownership for _Region_Get()
--- cpukit/rtems/include/rtems/rtems/regionimpl.h | 3 +++ cpukit/rtems/src/regiondelete.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/cpukit/rtems/include/rtems/rtems/regionimpl.h b/cpukit/rtems/include/rtems/rtems/regionimpl.h index 724a1c1..4598351 100644 --- a/cpukit/rtems/include/rtems/rtems/regionimpl.h +++ b/cpukit/rtems/include/rtems/rtems/regionimpl.h @@ -18,6 +18,8 @@ #define _RTEMS_RTEMS_REGIONIMPL_H #include +#include +#include #include #include #include @@ -79,6 +81,7 @@ RTEMS_INLINE_ROUTINE Region_Control *_Region_Get ( Objects_Locations *location ) { + _Assert( _RTEMS_Allocator_is_owner() ); return (Region_Control *) _Objects_Get_no_protection( &_Region_Information, id, location ); } diff --git a/cpukit/rtems/src/regiondelete.c b/cpukit/rtems/src/regiondelete.c index bf6e461..f256423 100644 --- a/cpukit/rtems/src/regiondelete.c +++ b/cpukit/rtems/src/regiondelete.c @@ -35,6 +35,7 @@ rtems_status_code rtems_region_delete( Region_Control *the_region; _Objects_Allocator_lock(); + _RTEMS_Lock_allocator(); the_region = _Region_Get( id, &location ); switch ( location ) { @@ -59,6 +60,7 @@ rtems_status_code rtems_region_delete( break; } + _RTEMS_Unlock_allocator(); _Objects_Allocator_unlock(); return return_status; -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 11/12] rtems: Delete Region_Control::length
--- cpukit/libmisc/monitor/mon-region.c | 2 +- cpukit/rtems/include/rtems/rtems/region.h | 1 - cpukit/rtems/src/regioncreate.c | 1 - cpukit/rtems/src/regionextend.c | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/cpukit/libmisc/monitor/mon-region.c b/cpukit/libmisc/monitor/mon-region.c index 60136c9..cc5c04b 100644 --- a/cpukit/libmisc/monitor/mon-region.c +++ b/cpukit/libmisc/monitor/mon-region.c @@ -23,7 +23,7 @@ rtems_monitor_region_canonical( canonical_region->attribute = rtems_region->attribute_set; canonical_region->start_addr = (void *) heap->area_begin; -canonical_region->length = rtems_region->length; +canonical_region->length = heap->area_end - heap->area_begin; canonical_region->page_size = rtems_region->page_size; canonical_region->max_seg_size = rtems_region->maximum_segment_size; canonical_region->used_blocks = heap->stats.used_blocks; diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h index eb7e4af..78f6686 100644 --- a/cpukit/rtems/include/rtems/rtems/region.h +++ b/cpukit/rtems/include/rtems/rtems/region.h @@ -60,7 +60,6 @@ typedef struct { Objects_Control Object; Thread_queue_Control Wait_queue;/* waiting threads*/ const Thread_queue_Operations *wait_operations; - uintptr_t length;/* physical length(bytes) */ uintptr_t page_size; /* in bytes */ uintptr_t maximum_segment_size; /* in bytes */ rtems_attribute attribute_set; diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index f6dfe82..cb19416 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -87,7 +87,6 @@ rtems_status_code rtems_region_create( _Region_Free( the_region ); return_status = RTEMS_INVALID_SIZE; } else { -the_region->length= length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c index e6cadf8..3153889 100644 --- a/cpukit/rtems/src/regionextend.c +++ b/cpukit/rtems/src/regionextend.c @@ -48,7 +48,6 @@ rtems_status_code rtems_region_extend( ); if ( amount_extended > 0 ) { -the_region->length += amount_extended; the_region->maximum_segment_size += amount_extended; status = RTEMS_SUCCESSFUL; } else { -- 1.8.4.5 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 08/12] rtems: Add and use _Region_Get_and_lock()
Get region and lock allocator in _Region_Get_and_lock() in case the region exists and unlock it in _Region_Unlock(). --- cpukit/rtems/include/rtems/rtems/regionimpl.h | 24 +-- cpukit/rtems/src/regiondelete.c | 27 cpukit/rtems/src/regionextend.c | 40 ++- cpukit/rtems/src/regiongetfreeinfo.c | 22 +++--- cpukit/rtems/src/regiongetinfo.c | 20 +++--- cpukit/rtems/src/regiongetsegment.c | 96 +-- cpukit/rtems/src/regiongetsegmentsize.c | 18 +++-- cpukit/rtems/src/regionprocessqueue.c | 2 +- cpukit/rtems/src/regionresizesegment.c| 50 +++--- cpukit/rtems/src/regionreturnsegment.c| 29 10 files changed, 161 insertions(+), 167 deletions(-) diff --git a/cpukit/rtems/include/rtems/rtems/regionimpl.h b/cpukit/rtems/include/rtems/rtems/regionimpl.h index 60cf50c..4db6599 100644 --- a/cpukit/rtems/include/rtems/rtems/regionimpl.h +++ b/cpukit/rtems/include/rtems/rtems/regionimpl.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -67,11 +66,28 @@ RTEMS_INLINE_ROUTINE void _Region_Free ( _Objects_Free( &_Region_Information, &the_region->Object ); } -RTEMS_INLINE_ROUTINE Region_Control *_Region_Get( Objects_Id id ) +RTEMS_INLINE_ROUTINE Region_Control *_Region_Get_and_lock( Objects_Id id ) { - _Assert( _RTEMS_Allocator_is_owner() ); - return (Region_Control *) + Region_Control *the_region; + + _RTEMS_Lock_allocator(); + + the_region = (Region_Control *) _Objects_Get_no_protection( &_Region_Information, id ); + + if ( the_region != NULL ) { +/* Keep allocator lock */ +return the_region; + } + + _RTEMS_Unlock_allocator(); + return NULL; +} + +RTEMS_INLINE_ROUTINE void _Region_Unlock( Region_Control *the_region ) +{ + (void) the_region; + _RTEMS_Unlock_allocator(); } /** diff --git a/cpukit/rtems/src/regiondelete.c b/cpukit/rtems/src/regiondelete.c index 3927a54..7897646 100644 --- a/cpukit/rtems/src/regiondelete.c +++ b/cpukit/rtems/src/regiondelete.c @@ -28,23 +28,22 @@ rtems_status_code rtems_region_delete( Region_Control*the_region; _Objects_Allocator_lock(); - _RTEMS_Lock_allocator(); - - the_region = _Region_Get( id ); - - if ( the_region != NULL ) { -if ( the_region->number_of_used_blocks != 0 ) { - status = RTEMS_RESOURCE_IN_USE; -} else { - _Objects_Close( &_Region_Information, &the_region->Object ); - _Region_Free( the_region ); - status = RTEMS_SUCCESSFUL; -} + + the_region = _Region_Get_and_lock( id ); + + if ( the_region == NULL ) { +return RTEMS_INVALID_ID; + } + + if ( the_region->number_of_used_blocks != 0 ) { +status = RTEMS_RESOURCE_IN_USE; } else { -status = RTEMS_INVALID_ID; +_Objects_Close( &_Region_Information, &the_region->Object ); +_Region_Free( the_region ); +status = RTEMS_SUCCESSFUL; } - _RTEMS_Unlock_allocator(); + _Region_Unlock( the_region ); _Objects_Allocator_unlock(); return status; } diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c index b1df066..e6cadf8 100644 --- a/cpukit/rtems/src/regionextend.c +++ b/cpukit/rtems/src/regionextend.c @@ -34,29 +34,27 @@ rtems_status_code rtems_region_extend( return RTEMS_INVALID_ADDRESS; } - _RTEMS_Lock_allocator(); - - the_region = _Region_Get( id ); - - if ( the_region != NULL ) { -amount_extended = _Heap_Extend( - &the_region->Memory, - starting_address, - length, - 0 -); - -if ( amount_extended > 0 ) { - the_region->length += amount_extended; - the_region->maximum_segment_size += amount_extended; - status = RTEMS_SUCCESSFUL; -} else { - status = RTEMS_INVALID_ADDRESS; -} + the_region = _Region_Get_and_lock( id ); + + if ( the_region == NULL ) { +return RTEMS_INVALID_ID; + } + + amount_extended = _Heap_Extend( +&the_region->Memory, +starting_address, +length, +0 + ); + + if ( amount_extended > 0 ) { +the_region->length += amount_extended; +the_region->maximum_segment_size += amount_extended; +status = RTEMS_SUCCESSFUL; } else { -status = RTEMS_INVALID_ID; +status = RTEMS_INVALID_ADDRESS; } - _RTEMS_Unlock_allocator(); + _Region_Unlock( the_region ); return status; } diff --git a/cpukit/rtems/src/regiongetfreeinfo.c b/cpukit/rtems/src/regiongetfreeinfo.c index 7924c0f..c35d888 100644 --- a/cpukit/rtems/src/regiongetfreeinfo.c +++ b/cpukit/rtems/src/regiongetfreeinfo.c @@ -27,25 +27,21 @@ rtems_status_code rtems_region_get_free_information( Heap_Information_block *the_info ) { - rtems_status_code status; - Region_Control*the_region; + Region_Control *the_region; if ( the_info == NULL ) { return RTEMS_INVALID_ADDRESS; } - _RTEMS_Lock_allocator(); + the_region = _Region_Get_and_lock( id ); - the_region = _Region_