From c64e4ed48285a0c944905bc02de89c20038f428b Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 15 Jan 1996 21:50:28 +0000 Subject: updates from Tony Bennett for PA and UNIX ports --- c/build-tools/cklength.c | 17 +-- c/build-tools/eolstrip.c | 17 +-- c/build-tools/src/cklength.c | 17 +-- c/build-tools/src/eolstrip.c | 17 +-- c/build-tools/src/unhex.c | 4 +- c/build-tools/unhex.c | 4 +- c/src/exec/libcsupport/include/rtems/assoc.h | 34 ++--- c/src/exec/libcsupport/include/rtems/error.h | 14 +- c/src/exec/libcsupport/include/rtems/libcsupport.h | 6 +- c/src/exec/libcsupport/src/assoc.c | 77 +++++------ c/src/exec/libcsupport/src/error.c | 15 +-- c/src/exec/libcsupport/src/libio.c | 5 +- c/src/exec/libcsupport/src/no_libc.c | 2 +- c/src/exec/rtems/headers/types.h | 8 +- c/src/exec/rtems/include/rtems/rtems/types.h | 8 +- c/src/exec/score/cpu/hppa1.1/cpu.c | 113 ++++++++++------- c/src/exec/score/cpu/hppa1.1/cpu.h | 25 +++- c/src/exec/score/cpu/hppa1.1/cpu_asm.s | 141 ++++++++++----------- c/src/exec/score/cpu/hppa1.1/hppa.h | 25 ++-- c/src/exec/score/cpu/unix/cpu.c | 42 ++++-- c/src/exec/score/cpu/unix/cpu.h | 4 + c/src/exec/score/cpu/unix/unixtypes.h | 16 ++- c/src/exec/score/headers/system.h | 15 ++- c/src/exec/score/include/rtems/system.h | 15 ++- c/src/exec/score/inline/address.inl | 2 +- c/src/exec/score/inline/coremsg.inl | 2 + c/src/exec/score/inline/rtems/score/address.inl | 2 +- c/src/exec/score/inline/rtems/score/coremsg.inl | 2 + c/src/exec/score/inline/rtems/score/thread.inl | 14 +- c/src/exec/score/inline/thread.inl | 14 +- c/src/lib/include/rtems/assoc.h | 34 ++--- c/src/lib/include/rtems/error.h | 14 +- c/src/lib/include/rtems/libcsupport.h | 6 +- c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h | 29 ++++- c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c | 7 +- c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c | 5 +- c/src/lib/libbsp/shmdr/getlq.c | 2 +- c/src/lib/libbsp/shmdr/shm.h | 6 +- c/src/lib/libbsp/shmdr/shm_driver.h | 6 +- c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c | 3 +- c/src/lib/libbsp/unix/posix/shmsupp/intr.c | 3 +- c/src/lib/libbsp/unix/posix/shmsupp/lock.c | 2 - c/src/lib/libbsp/unix/posix/startup/no-ctor.c | 16 +++ c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc | 10 +- c/src/lib/libc/assoc.c | 77 +++++------ c/src/lib/libc/assoc.h | 34 ++--- c/src/lib/libc/error.c | 15 +-- c/src/lib/libc/error.h | 14 +- c/src/lib/libc/libcsupport.h | 6 +- c/src/lib/libc/libio.c | 5 +- c/src/lib/libc/no_libc.c | 2 +- c/src/lib/libmisc/assoc/assoc.c | 77 +++++------ c/src/lib/libmisc/assoc/assoc.h | 34 ++--- c/src/lib/libmisc/error/error.c | 15 +-- c/src/lib/libmisc/error/error.h | 14 +- c/src/lib/libmisc/monitor/mon-monitor.c | 37 ++++-- c/src/lib/libmisc/monitor/mon-prmisc.c | 2 +- c/src/lib/libmisc/monitor/monitor.h | 4 +- c/src/libchip/shmdr/getlq.c | 2 +- c/src/libchip/shmdr/shm_driver.h | 6 +- c/src/libmisc/assoc/assoc.c | 77 +++++------ c/src/libmisc/assoc/assoc.h | 34 ++--- c/src/libmisc/error/error.c | 15 +-- c/src/libmisc/error/error.h | 14 +- c/src/libmisc/monitor/mon-monitor.c | 37 ++++-- c/src/libmisc/monitor/mon-prmisc.c | 2 +- c/src/libmisc/monitor/monitor.h | 4 +- c/src/tests/sptests/sp09/screen02.c | 2 +- c/src/tests/sptests/sp11/sp11.scn | 6 +- c/src/tests/support/include/tmacros.h | 17 ++- c/src/tests/tools/generic/difftest | 2 +- 71 files changed, 766 insertions(+), 608 deletions(-) create mode 100644 c/src/lib/libbsp/unix/posix/startup/no-ctor.c (limited to 'c') diff --git a/c/build-tools/cklength.c b/c/build-tools/cklength.c index 0849b9bbf8..6059cacb1f 100644 --- a/c/build-tools/cklength.c +++ b/c/build-tools/cklength.c @@ -10,19 +10,6 @@ * -v -- verbose * * $Id$ - * $Log$ - * Revision 1.4 1995/10/06 20:00:38 joel - * SPARC merged and successfully tested w/o interrupt support - * - * Revision 1.3 1995/10/06 16:32:20 joel - * moved to new development machine and went to gcc 2.7.0 - * - * Revision 1.2 1995/05/31 16:44:26 joel - * fixing revision - * - * Revision 1.1.1.1 1995/05/11 17:35:11 joel - * Release 3.1.15 - * */ #define GETOPTARGS "l:nNv" @@ -274,8 +261,8 @@ error(int error_flag, ...) { if (error_flag & ERR_FATAL) { - error(0, local_errno ? "fatal error, exiting" : "exiting"); - exit(local_errno); + error(0, "fatal error, exiting"); + exit(local_errno ? local_errno : 1); } else { diff --git a/c/build-tools/eolstrip.c b/c/build-tools/eolstrip.c index e258fcd9be..b4e0d5d165 100644 --- a/c/build-tools/eolstrip.c +++ b/c/build-tools/eolstrip.c @@ -8,19 +8,6 @@ * -v -- verbose * * $Id$ - * $Log$ - * Revision 1.4 1995/10/06 20:00:39 joel - * SPARC merged and successfully tested w/o interrupt support - * - * Revision 1.3 1995/10/06 16:32:21 joel - * moved to new development machine and went to gcc 2.7.0 - * - * Revision 1.2 1995/05/31 16:44:28 joel - * fixing revision - * - * Revision 1.1.1.1 1995/05/11 17:35:12 joel - * Release 3.1.15 - * */ #define GETOPTARGS "vt" @@ -261,8 +248,8 @@ error(int error_flag, ...) { if (error_flag & ERR_FATAL) { - error(0, local_errno ? "fatal error, exiting" : "exiting"); - exit(local_errno); + error(0, "fatal error, exiting"); + exit(local_errno ? local_errno : 1); } else { diff --git a/c/build-tools/src/cklength.c b/c/build-tools/src/cklength.c index 0849b9bbf8..6059cacb1f 100644 --- a/c/build-tools/src/cklength.c +++ b/c/build-tools/src/cklength.c @@ -10,19 +10,6 @@ * -v -- verbose * * $Id$ - * $Log$ - * Revision 1.4 1995/10/06 20:00:38 joel - * SPARC merged and successfully tested w/o interrupt support - * - * Revision 1.3 1995/10/06 16:32:20 joel - * moved to new development machine and went to gcc 2.7.0 - * - * Revision 1.2 1995/05/31 16:44:26 joel - * fixing revision - * - * Revision 1.1.1.1 1995/05/11 17:35:11 joel - * Release 3.1.15 - * */ #define GETOPTARGS "l:nNv" @@ -274,8 +261,8 @@ error(int error_flag, ...) { if (error_flag & ERR_FATAL) { - error(0, local_errno ? "fatal error, exiting" : "exiting"); - exit(local_errno); + error(0, "fatal error, exiting"); + exit(local_errno ? local_errno : 1); } else { diff --git a/c/build-tools/src/eolstrip.c b/c/build-tools/src/eolstrip.c index e258fcd9be..b4e0d5d165 100644 --- a/c/build-tools/src/eolstrip.c +++ b/c/build-tools/src/eolstrip.c @@ -8,19 +8,6 @@ * -v -- verbose * * $Id$ - * $Log$ - * Revision 1.4 1995/10/06 20:00:39 joel - * SPARC merged and successfully tested w/o interrupt support - * - * Revision 1.3 1995/10/06 16:32:21 joel - * moved to new development machine and went to gcc 2.7.0 - * - * Revision 1.2 1995/05/31 16:44:28 joel - * fixing revision - * - * Revision 1.1.1.1 1995/05/11 17:35:12 joel - * Release 3.1.15 - * */ #define GETOPTARGS "vt" @@ -261,8 +248,8 @@ error(int error_flag, ...) { if (error_flag & ERR_FATAL) { - error(0, local_errno ? "fatal error, exiting" : "exiting"); - exit(local_errno); + error(0, "fatal error, exiting"); + exit(local_errno ? local_errno : 1); } else { diff --git a/c/build-tools/src/unhex.c b/c/build-tools/src/unhex.c index 22fbd8bf4c..ba099c4772 100644 --- a/c/build-tools/src/unhex.c +++ b/c/build-tools/src/unhex.c @@ -708,8 +708,8 @@ error(int error_flag, ...) { if (error_flag & ERR_FATAL) { - error(0, local_errno ? "fatal error, exiting" : "exiting"); - exit(local_errno); + error(0, "fatal error, exiting"); + exit(local_errno ? local_errno : 1); } else { diff --git a/c/build-tools/unhex.c b/c/build-tools/unhex.c index 22fbd8bf4c..ba099c4772 100644 --- a/c/build-tools/unhex.c +++ b/c/build-tools/unhex.c @@ -708,8 +708,8 @@ error(int error_flag, ...) { if (error_flag & ERR_FATAL) { - error(0, local_errno ? "fatal error, exiting" : "exiting"); - exit(local_errno); + error(0, "fatal error, exiting"); + exit(local_errno ? local_errno : 1); } else { diff --git a/c/src/exec/libcsupport/include/rtems/assoc.h b/c/src/exec/libcsupport/include/rtems/assoc.h index c820cfa973..f9a444374c 100644 --- a/c/src/exec/libcsupport/include/rtems/assoc.h +++ b/c/src/exec/libcsupport/include/rtems/assoc.h @@ -1,5 +1,5 @@ /* - * @(#)assoc.h 1.2 - 95/06/28 + * @(#)assoc.h 1.4 - 95/10/25 * * * Rtems associativity routines. Mainly used to convert a value from @@ -13,7 +13,7 @@ #define _INCLUDE_ASSOC_H typedef struct { - char *name; + const char *name; unsigned32 local_value; unsigned32 remote_value; } rtems_assoc_t; @@ -24,21 +24,21 @@ typedef struct { #define RTEMS_ASSOC_DEFAULT_NAME "(default)" -rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *); -rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32); -rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *); -unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *); -char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); +const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); +unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); +const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); +const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); +char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); +unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); #endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/exec/libcsupport/include/rtems/error.h b/c/src/exec/libcsupport/include/rtems/error.h index a41f0aa534..621ee16f65 100644 --- a/c/src/exec/libcsupport/include/rtems/error.h +++ b/c/src/exec/libcsupport/include/rtems/error.h @@ -1,5 +1,6 @@ + /* - * @(#)error.h 1.1 - 95/08/02 + * @(#)error.h 1.3 - 95/10/25 * * * Defines and externs for rtems error reporting @@ -7,6 +8,9 @@ * $Id$ */ +#ifndef __RTEMS_ERROR_h +#define __RTEMS_ERROR_h + /* * rtems_error() and rtems_panic() support */ @@ -18,9 +22,11 @@ #define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ RTEMS_ERROR_PANIC) /* all */ -char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, char *printf_format, ...); -void rtems_panic(char *printf_format, ...); +const char *rtems_status_text(rtems_status_code); +int rtems_error(int error_code, const char *printf_format, ...); +void rtems_panic(const char *printf_format, ...); extern int rtems_panic_in_progress; +#endif +/* end of include file */ diff --git a/c/src/exec/libcsupport/include/rtems/libcsupport.h b/c/src/exec/libcsupport/include/rtems/libcsupport.h index 063246f4e5..f43cd189e1 100644 --- a/c/src/exec/libcsupport/include/rtems/libcsupport.h +++ b/c/src/exec/libcsupport/include/rtems/libcsupport.h @@ -29,14 +29,14 @@ void RTEMS_Malloc_Initialize( size_t sbrk_amount ); +extern void malloc_dump(void); extern void libc_init(int reentrant); +extern int host_errno(void); +extern void fix_syscall_errno(void); #ifdef __cplusplus } #endif -extern int host_errno(void); -extern void fix_syscall_errno(void); - #endif /* end of include file */ diff --git a/c/src/exec/libcsupport/src/assoc.c b/c/src/exec/libcsupport/src/assoc.c index c18359ef8a..a3eabdb3b5 100644 --- a/c/src/exec/libcsupport/src/assoc.c +++ b/c/src/exec/libcsupport/src/assoc.c @@ -1,6 +1,6 @@ /* - * @(#)assoc.c 1.4 - 95/08/02 - * + * @(#)assoc.c 1.6 - 95/10/25 + * * * assoc.c * rtems assoc routines @@ -8,7 +8,6 @@ * $Id$ */ - #include #include "assoc.h" @@ -18,13 +17,13 @@ #define STREQ(a,b) (strcmp((a), (b)) == 0) #define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -36,13 +35,13 @@ rtems_assoc_ptr_by_name( return default_ap; } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -55,13 +54,13 @@ rtems_assoc_ptr_by_local( } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -80,11 +79,11 @@ rtems_assoc_ptr_by_remote( unsigned32 rtems_assoc_remote_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->remote_value; @@ -94,11 +93,11 @@ rtems_assoc_remote_by_local( unsigned32 rtems_assoc_local_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->local_value; @@ -108,11 +107,11 @@ rtems_assoc_local_by_remote( unsigned32 rtems_assoc_remote_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->remote_value; @@ -122,11 +121,11 @@ rtems_assoc_remote_by_name( unsigned32 rtems_assoc_local_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->local_value; @@ -139,25 +138,29 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -char * +const char * rtems_assoc_name_bad( unsigned32 bad_value ) { +#ifdef RTEMS_DEBUG static char bad_buffer[32]; sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif return bad_buffer; } -char * +const char * rtems_assoc_name_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->name; @@ -165,13 +168,13 @@ rtems_assoc_name_by_local( return rtems_assoc_name_bad(local_value); } -char * +const char * rtems_assoc_name_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->name; @@ -185,7 +188,7 @@ rtems_assoc_name_by_remote( */ unsigned32 rtems_assoc_remote_by_local_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { @@ -201,7 +204,7 @@ unsigned32 rtems_assoc_remote_by_local_bitfield( unsigned32 rtems_assoc_local_by_remote_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { @@ -215,8 +218,9 @@ unsigned32 rtems_assoc_local_by_remote_bitfield( return local_value; } -char *rtems_assoc_name_by_remote_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_remote_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) @@ -236,8 +240,9 @@ char *rtems_assoc_name_by_remote_bitfield( return buffer; } -char *rtems_assoc_name_by_local_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_local_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) diff --git a/c/src/exec/libcsupport/src/error.c b/c/src/exec/libcsupport/src/error.c index 56224f2a56..f9cee777ae 100644 --- a/c/src/exec/libcsupport/src/error.c +++ b/c/src/exec/libcsupport/src/error.c @@ -1,10 +1,9 @@ /* - * @(#)error.c 1.2 - 95/08/02 + * @(#)error.c 1.6 - 95/12/12 * * - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * + * report errors and panics to RTEMS' stderr. + * Currently just used by RTEMS monitor. * * $Id$ */ @@ -97,7 +96,7 @@ rtems_assoc_t rtems_status_assoc[] = { }; -char * +const char * rtems_status_text( rtems_status_code status ) @@ -108,7 +107,7 @@ rtems_status_text( static int rtems_verror( unsigned32 error_flag, - char *printf_format, + const char *printf_format, va_list arglist ) { @@ -181,7 +180,7 @@ static int rtems_verror( int rtems_error( int error_flag, - char *printf_format, + const char *printf_format, ... ) { @@ -200,7 +199,7 @@ int rtems_error( */ void rtems_panic( - char *printf_format, + const char *printf_format, ... ) { diff --git a/c/src/exec/libcsupport/src/libio.c b/c/src/exec/libcsupport/src/libio.c index a7ac5b2d3c..73b6adf298 100644 --- a/c/src/exec/libcsupport/src/libio.c +++ b/c/src/exec/libcsupport/src/libio.c @@ -15,12 +15,13 @@ #include /* O_RDONLY, et.al. */ #include /* O_RDONLY, et.al. */ -#include /* O_RDONLY, et.al. */ + #if defined(solaris2) #define O_NDELAY O_NONBLOCK #elif defined(RTEMS_NEWLIB) #define O_NDELAY _FNBIO #endif + #include #include /* strcmp */ #include @@ -208,7 +209,7 @@ rtems_libio_allocate(void) rc = rtems_semaphore_create( RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops), - 1, + 1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, RTEMS_NO_PRIORITY, &iop->sem diff --git a/c/src/exec/libcsupport/src/no_libc.c b/c/src/exec/libcsupport/src/no_libc.c index 43a91eb30e..9bb65f4df6 100644 --- a/c/src/exec/libcsupport/src/no_libc.c +++ b/c/src/exec/libcsupport/src/no_libc.c @@ -1,4 +1,4 @@ -#if !defined(RTEMS_LIBC) && !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX) +#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX) /* no_libc.h * diff --git a/c/src/exec/rtems/headers/types.h b/c/src/exec/rtems/headers/types.h index 48a0c247ed..1dc8cd5373 100644 --- a/c/src/exec/rtems/headers/types.h +++ b/c/src/exec/rtems/headers/types.h @@ -33,12 +33,18 @@ extern "C" { typedef unsigned8 rtems_unsigned8; /* unsigned 8-bit value */ typedef unsigned16 rtems_unsigned16; /* unsigned 16-bit value */ typedef unsigned32 rtems_unsigned32; /* unsigned 32-bit value */ -typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */ typedef signed8 rtems_signed8; /* signed 8-bit value */ typedef signed16 rtems_signed16; /* signed 16-bit value */ typedef signed32 rtems_signed32; /* signed 32-bit value */ + +/* + * some C++ compilers (eg: HP's) don't do 'long long' + */ +#if defined(__GNUC__) +typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */ typedef signed64 rtems_signed64; /* signed 64-bit value */ +#endif typedef single_precision rtems_single; /* single precision float */ typedef double_precision rtems_double; /* double precision float */ diff --git a/c/src/exec/rtems/include/rtems/rtems/types.h b/c/src/exec/rtems/include/rtems/rtems/types.h index 48a0c247ed..1dc8cd5373 100644 --- a/c/src/exec/rtems/include/rtems/rtems/types.h +++ b/c/src/exec/rtems/include/rtems/rtems/types.h @@ -33,12 +33,18 @@ extern "C" { typedef unsigned8 rtems_unsigned8; /* unsigned 8-bit value */ typedef unsigned16 rtems_unsigned16; /* unsigned 16-bit value */ typedef unsigned32 rtems_unsigned32; /* unsigned 32-bit value */ -typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */ typedef signed8 rtems_signed8; /* signed 8-bit value */ typedef signed16 rtems_signed16; /* signed 16-bit value */ typedef signed32 rtems_signed32; /* signed 32-bit value */ + +/* + * some C++ compilers (eg: HP's) don't do 'long long' + */ +#if defined(__GNUC__) +typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */ typedef signed64 rtems_signed64; /* signed 64-bit value */ +#endif typedef single_precision rtems_single; /* single precision float */ typedef double_precision rtems_double; /* double precision float */ diff --git a/c/src/exec/score/cpu/hppa1.1/cpu.c b/c/src/exec/score/cpu/hppa1.1/cpu.c index a6cddbc804..48e09b908a 100644 --- a/c/src/exec/score/cpu/hppa1.1/cpu.c +++ b/c/src/exec/score/cpu/hppa1.1/cpu.c @@ -24,29 +24,16 @@ void hppa_external_interrupt_initialize(void); void hppa_external_interrupt_enable(unsigned32); void hppa_external_interrupt_disable(unsigned32); void hppa_external_interrupt(unsigned32, CPU_Interrupt_frame *); +void hppa_cpu_halt(unsigned32); /* - * Our interrupt handlers take a 2nd argument: - * a pointer to a CPU_Interrupt_frame - * So we use our own prototype instead of rtems_isr_entry + * The first level interrupt handler for first 32 interrupts/traps. + * Indexed by vector; generally each entry is _Generic_ISR_Handler. + * Some TLB traps may have their own first level handler. */ -typedef void ( *hppa_rtems_isr_entry )( - ISR_Vector_number, - CPU_Interrupt_frame * - ); - - -/* - * who are we? cpu number - * Not used by executive proper, just kept (or not) as a convenience - * for libcpu and libbsp stuff that wants it. - * - * Defaults to 0. If the BSP doesn't like it, it can change it. - */ - -int cpu_number; /* from 0; cpu number in a multi cpu system */ - +extern void _Generic_ISR_Handler(void); +unsigned32 HPPA_first_level_interrupt_handler[HPPA_INTERNAL_INTERRUPTS]; /* _CPU_Initialize * @@ -85,6 +72,20 @@ void _CPU_Initialize( asm volatile( "stw %%r27,%0" : "=m" (_CPU_Default_gr27): ); + /* + * Init the first level interrupt handlers + */ + + for (i=0; i <= HPPA_INTERNAL_INTERRUPTS; i++) + HPPA_first_level_interrupt_handler[i] = (unsigned32) _Generic_ISR_Handler; + + /* + * Init the 2nd level interrupt handlers + */ + + for (i=0; i <= CPU_INTERRUPT_NUMBER_OF_VECTORS; i++) + _ISR_Vector_table[i] = (ISR_Handler_entry) hppa_cpu_halt; + /* * Stabilize the interrupt stuff */ @@ -96,6 +97,33 @@ void _CPU_Initialize( */ iva_table = (unsigned32) IVA_Table; +#if defined(hppa1_1) + /* + * HACK: (from PA72000 TRM, page 4-19) + * "The hardware TLB miss handler will never attempt to service + * a non-access TLB miss or a TLB protection violation. It + * will only attempt to service TLB accesses that would cause + * Trap Numbers 6 (Instruction TLB miss) and 15 (Data TLB miss)." + * + * The LPA instruction is used to translate a virtual address to + * a physical address, however, if the requested virtual address + * is not currently resident in the TLB, the hardware TLB miss + * handler will NOT insert it. In this situation Trap Number + * #17 is invoked (Non-access Data TLB miss fault). + * + * To work around this, a dummy data access is first performed + * to the virtual address prior to the LPA. The dummy access + * causes the TLB entry to be inserted (if not already present) + * and then the following LPA instruction will not generate + * a non-access data TLB miss fault. + * + * It is unclear whether or not this behaves the same way for + * the PA8000. + * + */ + iva = *(volatile unsigned32 *)iva_table; /* dummy access */ +#endif + HPPA_ASM_LPA(0, iva_table, iva); set_iva(iva); @@ -112,8 +140,8 @@ unsigned32 _CPU_ISR_Get_level(void) int level; HPPA_ASM_SSM(0, level); /* change no bits; just get copy */ if (level & HPPA_PSW_I) - return 1; - return 0; + return 0; + return 1; } /*PAGE @@ -184,12 +212,8 @@ void _CPU_ISR_install_vector( * Support for external and spurious interrupts on HPPA * * TODO: - * delete interrupt.c etc. * Count interrupts * make sure interrupts disabled properly - * should handler check again for more interrupts before exit? - * How to enable interrupts from an interrupt handler? - * Make sure there is an entry for everything in ISR_Vector_Table */ #define DISMISS(mask) set_eirr(mask) @@ -208,16 +232,14 @@ hppa_external_interrupt_initialize(void) proc_ptr ignore; /* mark them all unused */ - DISABLE(~0); DISMISS(~0); /* install the external interrupt handler */ - _CPU_ISR_install_vector( - HPPA_INTERRUPT_EXTERNAL_INTERRUPT, - (proc_ptr)hppa_external_interrupt, - &ignore - ); + _CPU_ISR_install_vector( + HPPA_INTERRUPT_EXTERNAL_INTERRUPT, + (proc_ptr)hppa_external_interrupt, &ignore +); } /* @@ -256,19 +278,21 @@ hppa_external_interrupt_spurious_handler(unsigned32 vector, printf("spurious external interrupt: %d at pc 0x%x; disabling\n", vector, iframe->Interrupt.pcoqfront); */ - DISMISS(VECTOR_TO_MASK(vector)); - DISABLE(VECTOR_TO_MASK(vector)); } void -hppa_external_interrupt_report_spurious(unsigned32 spurious, +hppa_external_interrupt_report_spurious(unsigned32 spurious_mask, CPU_Interrupt_frame *iframe) { int v; for (v=0; v < HPPA_EXTERNAL_INTERRUPTS; v++) - if (VECTOR_TO_MASK(v) & spurious) + if (VECTOR_TO_MASK(v) & spurious_mask) + { + DISMISS(VECTOR_TO_MASK(v)); + DISABLE(VECTOR_TO_MASK(v)); hppa_external_interrupt_spurious_handler(v, iframe); - DISMISS(spurious); + } + DISMISS(spurious_mask); } @@ -304,18 +328,18 @@ hppa_external_interrupt(unsigned32 vector, { DISMISS(m); mask &= ~m; - (*handler)(global_vector, iframe); + handler(global_vector, iframe); } } if (mask != 0) { if ( _CPU_Table.spurious_handler ) - (*((hppa_rtems_isr_entry) _CPU_Table.spurious_handler))( - mask, - iframe - ); + { + handler = (hppa_rtems_isr_entry) _CPU_Table.spurious_handler; + handler(mask, iframe); + } else - hppa_external_interrupt_report_spurious(mask, iframe); + hppa_external_interrupt_report_spurious(mask, iframe); } } } @@ -330,13 +354,12 @@ hppa_external_interrupt(unsigned32 vector, */ void -hppa_cpu_halt(unsigned32 type_of_halt, - unsigned32 the_error) +hppa_cpu_halt(unsigned32 the_error) { unsigned32 isrlevel; _CPU_ISR_Disable(isrlevel); - asm volatile( "copy %0,%%r1" : : "r" (the_error) ); + HPPA_ASM_LABEL("_hppa_cpu_halt"); HPPA_ASM_BREAK(1, 0); } diff --git a/c/src/exec/score/cpu/hppa1.1/cpu.h b/c/src/exec/score/cpu/hppa1.1/cpu.h index 095a03735f..a2b430ca28 100644 --- a/c/src/exec/score/cpu/hppa1.1/cpu.h +++ b/c/src/exec/score/cpu/hppa1.1/cpu.h @@ -195,6 +195,17 @@ typedef struct { Context_Control_fp Floating_Point; } CPU_Interrupt_frame; +/* + * Our interrupt handlers take a 2nd argument: + * a pointer to a CPU_Interrupt_frame + * So we use our own prototype instead of rtems_isr_entry + */ + +typedef void ( *hppa_rtems_isr_entry )( + unsigned32, + CPU_Interrupt_frame * + ); + /* * The following table contains the information required to configure * the HPPA specific parameters. @@ -226,7 +237,7 @@ typedef struct { unsigned32 external_interrupts; /* # of external interrupts we use */ unsigned32 external_interrupt[HPPA_EXTERNAL_INTERRUPTS]; - void (*spurious_handler)( unsigned32 mask, CPU_Interrupt_frame *); + hppa_rtems_isr_entry spurious_handler; unsigned32 itimer_clicks_per_microsecond; /* for use by Clock driver */ } rtems_cpu_table; @@ -238,14 +249,18 @@ EXTERN unsigned32 _CPU_Default_gr27; EXTERN void *_CPU_Interrupt_stack_low; EXTERN void *_CPU_Interrupt_stack_high; +/* entry points */ +void hppa_external_interrupt_spurious_handler(unsigned32, CPU_Interrupt_frame *); + #endif /* ! ASM */ /* - * context size area for floating point + * context sizes */ #ifndef ASM -#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp ) +#define CPU_CONTEXT_SIZE sizeof( Context_Control ) +#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp ) #endif /* @@ -439,9 +454,9 @@ unsigned32 _CPU_ISR_Get_level( void ); * + disable interrupts and halt the CPU */ -void hppa_cpu_halt(unsigned32 type_of_halt, unsigned32 the_error); +void hppa_cpu_halt(unsigned32 the_error); #define _CPU_Fatal_halt( _error ) \ - hppa_cpu_halt(0, _error) + hppa_cpu_halt(_error) /* end of Fatal Error manager macros */ diff --git a/c/src/exec/score/cpu/hppa1.1/cpu_asm.s b/c/src/exec/score/cpu/hppa1.1/cpu_asm.s index 3832385ccd..36650e7733 100644 --- a/c/src/exec/score/cpu/hppa1.1/cpu_asm.s +++ b/c/src/exec/score/cpu/hppa1.1/cpu_asm.s @@ -49,6 +49,7 @@ isr_arg0 .reg %cr24 isr_r9 .reg %cr25 +isr_r8 .reg %cr26 # # Interrupt stack frame looks like this @@ -105,30 +106,25 @@ isr_r9 .reg %cr25 # # The following macro and the 32 instantiations of the macro # are necessary to determine which interrupt vector occurred. -# The following macro allows a unique entry point to be defined -# for each vector. # -# r9 was loaded with the vector before branching here -# scratch registers available: gr1, gr8, gr9, gr16, gr17, gr24 +# r9 is loaded with the vector number and then we jump to +# the first level interrupt handler. In most cases this +# is _Generic_ISR_Handler. In a few cases (such as TLB misc) +# it may be to some other entry point. # -# NOTE: -# .align 32 doesn not seem to work in the continuation below -# so just have to count 8 instructions -# -# NOTE: -# this whole scheme needs to be rethought for TLB traps which -# have requirements about what tlb faults they can incur. -# ref: TLB Operation Requirements in 1.1 arch book + +# table for first level interrupt handlers + .import HPPA_first_level_interrupt_handler, data #define THANDLER(vector) \ - mtctl %r9, isr_r9 ! \ - b _Generic_ISR_Handler! \ - ldi vector, %r9! \ - nop ! \ - nop ! \ - nop ! \ - nop ! \ - nop + mtctl %r9, isr_r9 ! \ + mtctl %r8, isr_r8 ! \ + ldi vector, %r9 ! \ + ldil L%HPPA_first_level_interrupt_handler,%r8 ! \ + ldo R%HPPA_first_level_interrupt_handler(%r8),%r8 ! \ + ldwx,s %r9(%r8),%r8 ! \ + bv 0(%r8) ! \ + mfctl isr_r8, %r8 .align 4096 .EXPORT IVA_Table,ENTRY,PRIV_LEV=0 @@ -210,10 +206,6 @@ _Generic_ISR_Handler: .CALLINFO FRAME=0,NO_CALLS .ENTRY -# Turn on the D bit in psw so we can start saving stuff on stack -# (interrupt context pieces that need to be saved before the RFI) - - ssm HPPA_PSW_D, %r0 mtctl arg0, isr_arg0 # save interrupt state @@ -236,31 +228,6 @@ _Generic_ISR_Handler: mfctl %sar, arg0 stw arg0, SAR_OFFSET(sp) -# Prepare to re-enter virtual mode -# We need Q in case the interrupt handler enables interrupts -# - - ldil L%CPU_PSW_DEFAULT, arg0 - ldo R%CPU_PSW_DEFAULT(arg0), arg0 - mtctl arg0, ipsw - -# Now jump to "rest_of_isr_handler" with the rfi -# We are assuming the space queues are all correct already - - ldil L%rest_of_isr_handler, arg0 - ldo R%rest_of_isr_handler(arg0), arg0 - mtctl arg0, pcoq - ldo 4(arg0), arg0 - mtctl arg0, pcoq - - rfi - nop - -# At this point we are back in virtual mode and all our -# normal addressing is once again ok. - -rest_of_isr_handler: - # # Build an interrupt frame to hold the contexts we will need. # We have already saved the interrupt items on the stack @@ -281,7 +248,7 @@ rest_of_isr_handler: stw %r6,R6_OFFSET(sp) stw %r7,R7_OFFSET(sp) stw %r8,R8_OFFSET(sp) - stw %r9,R9_OFFSET(sp) +# skip r9 stw %r10,R10_OFFSET(sp) stw %r11,R11_OFFSET(sp) stw %r12,R12_OFFSET(sp) @@ -298,7 +265,7 @@ rest_of_isr_handler: stw %r23,R23_OFFSET(sp) stw %r24,R24_OFFSET(sp) stw %r25,R25_OFFSET(sp) - stw %r26,R26_OFFSET(sp) +# skip arg0 stw %r27,R27_OFFSET(sp) stw %r28,R28_OFFSET(sp) stw %r29,R29_OFFSET(sp) @@ -324,7 +291,33 @@ rest_of_isr_handler: # # At this point we are done with isr_arg0, and isr_r9 control registers # +# Prepare to re-enter virtual mode +# We need Q in case the interrupt handler enables interrupts +# + + ldil L%CPU_PSW_DEFAULT, arg0 + ldo R%CPU_PSW_DEFAULT(arg0), arg0 + mtctl arg0, ipsw + +# Now jump to "rest_of_isr_handler" with the rfi +# We are assuming the space queues are all correct already + + ldil L%rest_of_isr_handler, arg0 + ldo R%rest_of_isr_handler(arg0), arg0 + mtctl arg0, pcoq + ldo 4(arg0), arg0 + mtctl arg0, pcoq + + rfi + nop + +# At this point we are back in virtual mode and all our +# normal addressing is once again ok. +# +# It is now ok to take an exception or trap +# +rest_of_isr_handler: # Point to beginning of float context and # save the floating point context -- doing whatever patches are necessary @@ -408,7 +401,7 @@ post_user_interrupt_handler: # have turned them on) and return to the interrupted task stack (assuming # (_ISR_Nest_level == 0) - rsm HPPA_PSW_I, %r0 + rsm HPPA_PSW_I + HPPA_PSW_R, %r0 ldw -4(sp), sp # r3 -- &_ISR_Nest_level @@ -448,6 +441,7 @@ post_user_interrupt_handler: ldw R%_ISR_Signals_to_thread_executing(%r8),%r8 comibt,=,n 0,%r8,isr_restore + # OK, something happened while in ISR and we need to switch to a task # other than the one which was interrupted or the # ISR_Signals_to_thread_executing case @@ -465,10 +459,11 @@ ISR_dispatch: ldo -128(sp),sp - rsm HPPA_PSW_I, %r0 - isr_restore: +# enable interrupts during most of restore + ssm HPPA_PSW_I, %r0 + # Get a pointer to beginning of our stack frame ldo -CPU_INTERRUPT_FRAME_SIZE(sp), %arg1 @@ -489,21 +484,6 @@ isr_restore: .EXPORT _CPU_Context_restore _CPU_Context_restore: -# Turn off Q & I so we can write pcoq - rsm HPPA_PSW_Q + HPPA_PSW_I, %r0 - - ldw IPSW_OFFSET(arg0), %r8 - mtctl %r8, ipsw - - ldw SAR_OFFSET(arg0), %r9 - mtctl %r9, sar - - ldw PCOQFRONT_OFFSET(arg0), %r10 - mtctl %r10, pcoq - - ldw PCOQBACK_OFFSET(arg0), %r11 - mtctl %r11, pcoq - # # restore integer state # @@ -531,15 +511,32 @@ _CPU_Context_restore: ldw R22_OFFSET(arg0),%r22 ldw R23_OFFSET(arg0),%r23 ldw R24_OFFSET(arg0),%r24 - ldw R25_OFFSET(arg0),%r25 -# skipping r26 (aka arg0) until we are done with it +# skipping r25; used as scratch register below +# skipping r26 (arg0) until we are done with it ldw R27_OFFSET(arg0),%r27 ldw R28_OFFSET(arg0),%r28 ldw R29_OFFSET(arg0),%r29 ldw R30_OFFSET(arg0),%r30 ldw R31_OFFSET(arg0),%r31 -# Must load r26 last since it is arg0 +# Turn off Q & R & I so we can write interrupt control registers + rsm HPPA_PSW_Q + HPPA_PSW_R + HPPA_PSW_I, %r0 + + ldw IPSW_OFFSET(arg0), %r25 + mtctl %r25, ipsw + + ldw SAR_OFFSET(arg0), %r25 + mtctl %r25, sar + + ldw PCOQFRONT_OFFSET(arg0), %r25 + mtctl %r25, pcoq + + ldw PCOQBACK_OFFSET(arg0), %r25 + mtctl %r25, pcoq + +# Load r25 with interrupts off + ldw R25_OFFSET(arg0),%r25 +# Must load r26 (arg0) last ldw R26_OFFSET(arg0),%r26 isr_exit: diff --git a/c/src/exec/score/cpu/hppa1.1/hppa.h b/c/src/exec/score/cpu/hppa1.1/hppa.h index f8bb55c74c..55c2a63aee 100644 --- a/c/src/exec/score/cpu/hppa1.1/hppa.h +++ b/c/src/exec/score/cpu/hppa1.1/hppa.h @@ -1,6 +1,6 @@ /* - * @(#)hppa.h 1.13 - 95/09/21 - * + * @(#)hppa.h 1.17 - 95/12/13 + * * * Description: * @@ -209,6 +209,7 @@ extern "C" { #define HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER HPPA_INTERRUPT_EXTERNAL_0 #define HPPA_EXTERNAL_INTERRUPTS 32 +#define HPPA_INTERNAL_INTERRUPTS 32 /* BSP defined interrupts begin here */ @@ -646,7 +647,11 @@ extern "C" { #define HPPA_BREAK(i5,i13) (((i5) & 0x1F) | (((i13) & 0x1FFF) << 13)) -#ifndef ASM +/* + * this won't work in ASM or non-GNU compilers + */ + +#if !defined(ASM) && defined(__GNUC__) /* * static inline utility functions to get at control registers @@ -699,21 +704,15 @@ EMIT_CONTROLS(tr5, HPPA_TR5); /* CR29 */ EMIT_CONTROLS(tr6, HPPA_TR6); /* CR30 */ EMIT_CONTROLS(tr7, HPPA_CR31); /* CR31 */ +#endif /* ASM and GNU */ + /* * If and How to invoke the debugger (a ROM debugger generally) */ - -#ifdef SIMHPPA_ROM -/* invoke the pflow debugger */ -#define CPU_INVOKE_DEBUGGER \ +#define CPU_INVOKE_DEBUGGER \ do { \ - extern void debugger_break(void); \ - debugger_break(); \ + HPPA_ASM_BREAK(1,1); \ } while (0) -#endif - - -#endif /* ASM */ #ifdef __cplusplus } diff --git a/c/src/exec/score/cpu/unix/cpu.c b/c/src/exec/score/cpu/unix/cpu.c index c77276020b..de3e6a7118 100644 --- a/c/src/exec/score/cpu/unix/cpu.c +++ b/c/src/exec/score/cpu/unix/cpu.c @@ -87,7 +87,7 @@ void _CPU_ISR_From_CPU_Init() */ sigemptyset(&posix_empty_mask); - + /* * Block all the signals except SIGTRAP for the debugger * and SIGABRT for fatal errors. @@ -602,7 +602,6 @@ void _CPU_ISR_Handler(int vector) extern unsigned32 _Thread_Dispatch_disable_level; extern boolean _Context_Switch_necessary; - if (_ISR_Nest_level++ == 0) { /* switch to interrupt stack */ } @@ -635,19 +634,34 @@ void _CPU_ISR_Handler(int vector) void _CPU_Stray_signal(int sig_num) { - char buffer[ 4 ]; - - /* - * We avoid using the stdio section of the library. - * The following is generally safe. + char buffer[ 4 ]; + + /* + * print "stray" msg about ones which that might mean something + * Avoid using the stdio section of the library. + * The following is generally safe. */ - - buffer[ 0 ] = (sig_num >> 4) + 0x30; - buffer[ 1 ] = (sig_num & 0xf) + 0x30; - buffer[ 2 ] = '\n'; - - write( 2, "Stray signal 0x", 12 ); - write( 2, buffer, 3 ); + + switch (sig_num) + { + case SIGCLD: + break; + + default: + { + /* + * We avoid using the stdio section of the library. + * The following is generally safe. + */ + + buffer[ 0 ] = (sig_num >> 4) + 0x30; + buffer[ 1 ] = (sig_num & 0xf) + 0x30; + buffer[ 2 ] = '\n'; + + write( 2, "Stray signal 0x", 12 ); + write( 2, buffer, 3 ); + } + } /* * If it was a "fatal" signal, then exit here diff --git a/c/src/exec/score/cpu/unix/cpu.h b/c/src/exec/score/cpu/unix/cpu.h index e002a73f65..df582ab44b 100644 --- a/c/src/exec/score/cpu/unix/cpu.h +++ b/c/src/exec/score/cpu/unix/cpu.h @@ -278,7 +278,11 @@ extern "C" { * in the executive to justify turning this on. */ +#ifdef __GNUC__ #define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32))) +#else +#define CPU_STRUCTURE_ALIGNMENT +#endif /* * The following defines the number of bits actually used in the diff --git a/c/src/exec/score/cpu/unix/unixtypes.h b/c/src/exec/score/cpu/unix/unixtypes.h index f1dc442baa..45f5cf9366 100644 --- a/c/src/exec/score/cpu/unix/unixtypes.h +++ b/c/src/exec/score/cpu/unix/unixtypes.h @@ -23,6 +23,14 @@ extern "C" { #endif +/* + * some C++ compilers (eg: HP's) don't do 'signed' or 'volatile' + */ +#if defined(__cplusplus) && !defined(__GNUC__) +#define signed +#define volatile +#endif + /* * This section defines the basic types for this processor. */ @@ -30,14 +38,20 @@ extern "C" { typedef unsigned char unsigned8; /* unsigned 8-bit integer */ typedef unsigned short unsigned16; /* unsigned 16-bit integer */ typedef unsigned int unsigned32; /* unsigned 32-bit integer */ -typedef unsigned long long unsigned64; /* unsigned 64-bit integer */ typedef unsigned16 Priority_Bit_map_control; typedef signed char signed8; /* 8-bit signed integer */ typedef signed short signed16; /* 16-bit signed integer */ typedef signed int signed32; /* 32-bit signed integer */ + +/* + * some C++ compilers (eg: HP's) don't do 'long long' + */ +#if defined(__GNUC__) +typedef unsigned long long unsigned64; /* unsigned 64-bit integer */ typedef signed long long signed64; /* 64 bit signed integer */ +#endif typedef unsigned32 boolean; /* Boolean value */ diff --git a/c/src/exec/score/headers/system.h b/c/src/exec/score/headers/system.h index 22ae606342..9b50159c81 100644 --- a/c/src/exec/score/headers/system.h +++ b/c/src/exec/score/headers/system.h @@ -56,14 +56,15 @@ extern "C" { */ #ifdef USE_INLINES -#define STATIC static -#define INLINE __inline__ +# define STATIC static +# ifdef __GNUC__ +# define INLINE __inline__ +# else +# define INLINE inline +# endif #else -/* -#error Only the GNU C compiler is currently supported!!! -*/ -#define STATIC -#define INLINE +# define STATIC +# define INLINE #endif /* diff --git a/c/src/exec/score/include/rtems/system.h b/c/src/exec/score/include/rtems/system.h index 22ae606342..9b50159c81 100644 --- a/c/src/exec/score/include/rtems/system.h +++ b/c/src/exec/score/include/rtems/system.h @@ -56,14 +56,15 @@ extern "C" { */ #ifdef USE_INLINES -#define STATIC static -#define INLINE __inline__ +# define STATIC static +# ifdef __GNUC__ +# define INLINE __inline__ +# else +# define INLINE inline +# endif #else -/* -#error Only the GNU C compiler is currently supported!!! -*/ -#define STATIC -#define INLINE +# define STATIC +# define INLINE #endif /* diff --git a/c/src/exec/score/inline/address.inl b/c/src/exec/score/inline/address.inl index dd2a789b1e..c1bb098577 100644 --- a/c/src/exec/score/inline/address.inl +++ b/c/src/exec/score/inline/address.inl @@ -58,7 +58,7 @@ STATIC INLINE unsigned32 _Addresses_Subtract ( void *right ) { - return (left - right); + return ((char *) left - (char *) right); } /*PAGE diff --git a/c/src/exec/score/inline/coremsg.inl b/c/src/exec/score/inline/coremsg.inl index 6431979dd3..5a1b5d4a10 100644 --- a/c/src/exec/score/inline/coremsg.inl +++ b/c/src/exec/score/inline/coremsg.inl @@ -17,6 +17,8 @@ #ifndef __CORE_MESSAGE_QUEUE_inl #define __CORE_MESSAGE_QUEUE_inl +#include /* needed for memcpy */ + /*PAGE * * _CORE_message_queue_Send diff --git a/c/src/exec/score/inline/rtems/score/address.inl b/c/src/exec/score/inline/rtems/score/address.inl index dd2a789b1e..c1bb098577 100644 --- a/c/src/exec/score/inline/rtems/score/address.inl +++ b/c/src/exec/score/inline/rtems/score/address.inl @@ -58,7 +58,7 @@ STATIC INLINE unsigned32 _Addresses_Subtract ( void *right ) { - return (left - right); + return ((char *) left - (char *) right); } /*PAGE diff --git a/c/src/exec/score/inline/rtems/score/coremsg.inl b/c/src/exec/score/inline/rtems/score/coremsg.inl index 6431979dd3..5a1b5d4a10 100644 --- a/c/src/exec/score/inline/rtems/score/coremsg.inl +++ b/c/src/exec/score/inline/rtems/score/coremsg.inl @@ -17,6 +17,8 @@ #ifndef __CORE_MESSAGE_QUEUE_inl #define __CORE_MESSAGE_QUEUE_inl +#include /* needed for memcpy */ + /*PAGE * * _CORE_message_queue_Send diff --git a/c/src/exec/score/inline/rtems/score/thread.inl b/c/src/exec/score/inline/rtems/score/thread.inl index e326410112..3a96acf4ea 100644 --- a/c/src/exec/score/inline/rtems/score/thread.inl +++ b/c/src/exec/score/inline/rtems/score/thread.inl @@ -241,30 +241,36 @@ STATIC INLINE Thread_Control *_Thread_Get ( { Objects_Classes the_class; Objects_Information *information; + Thread_Control *tp = (Thread_Control *) 0; if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { _Thread_Disable_dispatch(); *location = OBJECTS_LOCAL; - return( _Thread_Executing ); + tp = _Thread_Executing; + goto done; } the_class = _Objects_Get_class( id ); if ( the_class > OBJECTS_CLASSES_LAST ) { *location = OBJECTS_ERROR; - return (Thread_Control *) 0; + goto done; } information = _Objects_Information_table[ the_class ]; if ( !information || !information->is_thread ) { *location = OBJECTS_ERROR; - return (Thread_Control *) 0; + goto done; } - return (Thread_Control *) _Objects_Get( information, id, location ); + tp = (Thread_Control *) _Objects_Get( information, id, location ); + +done: + return tp; } + /* * _Thread_Is_proxy_blocking * diff --git a/c/src/exec/score/inline/thread.inl b/c/src/exec/score/inline/thread.inl index e326410112..3a96acf4ea 100644 --- a/c/src/exec/score/inline/thread.inl +++ b/c/src/exec/score/inline/thread.inl @@ -241,30 +241,36 @@ STATIC INLINE Thread_Control *_Thread_Get ( { Objects_Classes the_class; Objects_Information *information; + Thread_Control *tp = (Thread_Control *) 0; if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { _Thread_Disable_dispatch(); *location = OBJECTS_LOCAL; - return( _Thread_Executing ); + tp = _Thread_Executing; + goto done; } the_class = _Objects_Get_class( id ); if ( the_class > OBJECTS_CLASSES_LAST ) { *location = OBJECTS_ERROR; - return (Thread_Control *) 0; + goto done; } information = _Objects_Information_table[ the_class ]; if ( !information || !information->is_thread ) { *location = OBJECTS_ERROR; - return (Thread_Control *) 0; + goto done; } - return (Thread_Control *) _Objects_Get( information, id, location ); + tp = (Thread_Control *) _Objects_Get( information, id, location ); + +done: + return tp; } + /* * _Thread_Is_proxy_blocking * diff --git a/c/src/lib/include/rtems/assoc.h b/c/src/lib/include/rtems/assoc.h index c820cfa973..f9a444374c 100644 --- a/c/src/lib/include/rtems/assoc.h +++ b/c/src/lib/include/rtems/assoc.h @@ -1,5 +1,5 @@ /* - * @(#)assoc.h 1.2 - 95/06/28 + * @(#)assoc.h 1.4 - 95/10/25 * * * Rtems associativity routines. Mainly used to convert a value from @@ -13,7 +13,7 @@ #define _INCLUDE_ASSOC_H typedef struct { - char *name; + const char *name; unsigned32 local_value; unsigned32 remote_value; } rtems_assoc_t; @@ -24,21 +24,21 @@ typedef struct { #define RTEMS_ASSOC_DEFAULT_NAME "(default)" -rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *); -rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32); -rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *); -unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *); -char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); +const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); +unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); +const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); +const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); +char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); +unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); #endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/lib/include/rtems/error.h b/c/src/lib/include/rtems/error.h index a41f0aa534..621ee16f65 100644 --- a/c/src/lib/include/rtems/error.h +++ b/c/src/lib/include/rtems/error.h @@ -1,5 +1,6 @@ + /* - * @(#)error.h 1.1 - 95/08/02 + * @(#)error.h 1.3 - 95/10/25 * * * Defines and externs for rtems error reporting @@ -7,6 +8,9 @@ * $Id$ */ +#ifndef __RTEMS_ERROR_h +#define __RTEMS_ERROR_h + /* * rtems_error() and rtems_panic() support */ @@ -18,9 +22,11 @@ #define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ RTEMS_ERROR_PANIC) /* all */ -char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, char *printf_format, ...); -void rtems_panic(char *printf_format, ...); +const char *rtems_status_text(rtems_status_code); +int rtems_error(int error_code, const char *printf_format, ...); +void rtems_panic(const char *printf_format, ...); extern int rtems_panic_in_progress; +#endif +/* end of include file */ diff --git a/c/src/lib/include/rtems/libcsupport.h b/c/src/lib/include/rtems/libcsupport.h index 063246f4e5..f43cd189e1 100644 --- a/c/src/lib/include/rtems/libcsupport.h +++ b/c/src/lib/include/rtems/libcsupport.h @@ -29,14 +29,14 @@ void RTEMS_Malloc_Initialize( size_t sbrk_amount ); +extern void malloc_dump(void); extern void libc_init(int reentrant); +extern int host_errno(void); +extern void fix_syscall_errno(void); #ifdef __cplusplus } #endif -extern int host_errno(void); -extern void fix_syscall_errno(void); - #endif /* end of include file */ diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h b/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h index 1f68dea214..ead24536f5 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h +++ b/c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h @@ -65,13 +65,38 @@ extern void Clock_delay(rtems_unsigned32 microseconds); #define delay( microseconds ) \ Clock_delay(microseconds); +/* + * Todo: this should be put somewhere else + */ + +#undef CLOCK_DRIVER_TABLE_ENTRY +#define CLOCK_DRIVER_TABLE_ENTRY { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp +); + /* * We printf() to a buffer if multiprocessing, *or* if this is set. - * ref: src/lib/libbsp/hppa/simhppa/iosupp/consupp.c + * ref: src/lib/libbsp/hppa/pxfl/iosupp/consupp.c */ extern int use_print_buffer; +/* + * When not doing printf to a buffer, we do printf thru RTEMS libio + * and our tty driver. Set it up so that console is right. + */ + +#define CONSOLE_DRIVER_TABLE_ENTRY \ + { tty_initialize, tty_open, tty_close, tty_read, tty_write, tty_control } + +/* + * How many libio files we want + */ +#define BSP_LIBIO_MAX_FDS 20 + /* * Device Driver Table Entries */ @@ -97,6 +122,8 @@ extern int use_print_buffer; rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int); +rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int); + void bsp_start( void ); void bsp_cleanup( void ); diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c index f2cd34d219..f29eecf093 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c +++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/getcfg.c @@ -35,7 +35,6 @@ */ #include -#include #include @@ -43,16 +42,16 @@ #define POLLING 1 #define HPPA_RUNWAY_PROC_HPA_BASE ((void *) 0xFFFA0000) - + /* given a processor number, where is its HPA? */ #define HPPA_RUNWAY_HPA(cpu) \ ((rtems_unsigned32) (HPPA_RUNWAY_PROC_HPA_BASE + ((cpu) * 0x2000))) - + #define HPPA_RUNWAY_REG_IO_EIR_OFFSET 0x000 shm_config_table BSP_shm_cfgtbl; -void Shm_Cause_interrupt_pxfl( rtems_unsigned32 node ); +extern void Shm_Cause_interrupt_pxfl( rtems_unsigned32 node ); void Shm_Get_configuration( rtems_unsigned32 localnode, diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c index fcd14428e1..161ae3f522 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c +++ b/c/src/lib/libbsp/hppa1.1/simhppa/shmsupp/intr.c @@ -22,6 +22,8 @@ #include #include +#include + #include void Shm_Cause_interrupt_pxfl( @@ -38,13 +40,12 @@ void Shm_Cause_interrupt_pxfl( switch ( intr->length ) { case NO_INTERRUPT: break; + case LONG: u32 = (rtems_unsigned32 *)intr->address; HPPA_ASM_STWAS( value, 0, u32 ); break; default: fprintf( stderr, "Shm_Cause_interrupt_pxfl: Unsupported length!!!\n" ); - rtems_shutdown_executive( 0 ); - break; } } diff --git a/c/src/lib/libbsp/shmdr/getlq.c b/c/src/lib/libbsp/shmdr/getlq.c index ebc5bed8b6..efc7b0996c 100644 --- a/c/src/lib/libbsp/shmdr/getlq.c +++ b/c/src/lib/libbsp/shmdr/getlq.c @@ -22,7 +22,7 @@ */ #include -#include "shm.h" +#include Shm_Envelope_control *Shm_Locked_queue_Get( Shm_Locked_queue_Control *lq_cb diff --git a/c/src/lib/libbsp/shmdr/shm.h b/c/src/lib/libbsp/shmdr/shm.h index f4671dde97..2b0e39320d 100644 --- a/c/src/lib/libbsp/shmdr/shm.h +++ b/c/src/lib/libbsp/shmdr/shm.h @@ -470,11 +470,7 @@ void Shm_Locked_queue_Initialize( /* portable routines */ void Init_env_pool(); void Shm_Print_statistics( void ); -void MPCI_Fatal( - Internal_errors_Source source, - boolean is_internal, - rtems_unsigned32 error - ); +void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 ); rtems_task Shm_Cause_interrupt( rtems_unsigned32 ); void Shm_Poll(); void Shm_setclockvec(); diff --git a/c/src/lib/libbsp/shmdr/shm_driver.h b/c/src/lib/libbsp/shmdr/shm_driver.h index f4671dde97..2b0e39320d 100644 --- a/c/src/lib/libbsp/shmdr/shm_driver.h +++ b/c/src/lib/libbsp/shmdr/shm_driver.h @@ -470,11 +470,7 @@ void Shm_Locked_queue_Initialize( /* portable routines */ void Init_env_pool(); void Shm_Print_statistics( void ); -void MPCI_Fatal( - Internal_errors_Source source, - boolean is_internal, - rtems_unsigned32 error - ); +void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 ); rtems_task Shm_Cause_interrupt( rtems_unsigned32 ); void Shm_Poll(); void Shm_setclockvec(); diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c b/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c index c912447631..cb3afabf98 100644 --- a/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c +++ b/c/src/lib/libbsp/unix/posix/shmsupp/getcfg.c @@ -27,10 +27,11 @@ #include #include +#include /* pid_t */ shm_config_table BSP_shm_cfgtbl; -int semid; +int semid; void Shm_Cause_interrupt_unix( rtems_unsigned32 node diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/intr.c b/c/src/lib/libbsp/unix/posix/shmsupp/intr.c index 243af403d9..845cedd36f 100644 --- a/c/src/lib/libbsp/unix/posix/shmsupp/intr.c +++ b/c/src/lib/libbsp/unix/posix/shmsupp/intr.c @@ -21,6 +21,7 @@ #include #include +#include /* pid_t */ void Shm_Cause_interrupt_unix( rtems_unsigned32 node @@ -29,5 +30,5 @@ void Shm_Cause_interrupt_unix( Shm_Interrupt_information *intr; intr = &Shm_Interrupt_table[node]; - _CPU_SHM_Send_interrupt( (int) intr->address, (int) intr->value ); + _CPU_SHM_Send_interrupt( (pid_t) intr->address, intr->value ); } diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/lock.c b/c/src/lib/libbsp/unix/posix/shmsupp/lock.c index 76a57d0a06..6ccd680842 100644 --- a/c/src/lib/libbsp/unix/posix/shmsupp/lock.c +++ b/c/src/lib/libbsp/unix/posix/shmsupp/lock.c @@ -20,8 +20,6 @@ #include #include -extern int semid; - /* * Shm_Initialize_lock * diff --git a/c/src/lib/libbsp/unix/posix/startup/no-ctor.c b/c/src/lib/libbsp/unix/posix/startup/no-ctor.c new file mode 100644 index 0000000000..349ad2b1dd --- /dev/null +++ b/c/src/lib/libbsp/unix/posix/startup/no-ctor.c @@ -0,0 +1,16 @@ +/* + * rtems, floss, libc are always compiled with GNU compilers + * application code may be compiled with some other C++ compiler + * that has a different global constructor technique. + * + * For the simple case, where the app has no global constructors or + * is compiled by g++, we provide this empty routine + * In order to get both g++ constructors (RTEMS::RTEMS, for example) + * and application constructors run, we provide this routine. + * + * $Id$ + */ + +void invoke_non_gnu_constructors(void) +{ +} diff --git a/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc b/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc index 6fb132b469..0b4278eb19 100644 --- a/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc +++ b/c/src/lib/libbsp/unix/posix/startup/rtems-ctor.cc @@ -1,5 +1,5 @@ -// @(#)rtems-ctor.cc 1.6 - 95/04/25 // +// @(#)rtems-ctor.cc 1.6 - 95/04/25 // /* @@ -81,6 +81,8 @@ RTEMS::~RTEMS() } extern "C" { + extern void invoke_non_gnu_constructors(void); + int main(int argc, char **argv, @@ -95,6 +97,12 @@ extern "C" { else rtems_progname = "RTEMS"; + /* + * run any non-gnu constructors we may need + */ + + invoke_non_gnu_constructors(); + /* * Start multitasking */ diff --git a/c/src/lib/libc/assoc.c b/c/src/lib/libc/assoc.c index c18359ef8a..a3eabdb3b5 100644 --- a/c/src/lib/libc/assoc.c +++ b/c/src/lib/libc/assoc.c @@ -1,6 +1,6 @@ /* - * @(#)assoc.c 1.4 - 95/08/02 - * + * @(#)assoc.c 1.6 - 95/10/25 + * * * assoc.c * rtems assoc routines @@ -8,7 +8,6 @@ * $Id$ */ - #include #include "assoc.h" @@ -18,13 +17,13 @@ #define STREQ(a,b) (strcmp((a), (b)) == 0) #define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -36,13 +35,13 @@ rtems_assoc_ptr_by_name( return default_ap; } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -55,13 +54,13 @@ rtems_assoc_ptr_by_local( } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -80,11 +79,11 @@ rtems_assoc_ptr_by_remote( unsigned32 rtems_assoc_remote_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->remote_value; @@ -94,11 +93,11 @@ rtems_assoc_remote_by_local( unsigned32 rtems_assoc_local_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->local_value; @@ -108,11 +107,11 @@ rtems_assoc_local_by_remote( unsigned32 rtems_assoc_remote_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->remote_value; @@ -122,11 +121,11 @@ rtems_assoc_remote_by_name( unsigned32 rtems_assoc_local_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->local_value; @@ -139,25 +138,29 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -char * +const char * rtems_assoc_name_bad( unsigned32 bad_value ) { +#ifdef RTEMS_DEBUG static char bad_buffer[32]; sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif return bad_buffer; } -char * +const char * rtems_assoc_name_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->name; @@ -165,13 +168,13 @@ rtems_assoc_name_by_local( return rtems_assoc_name_bad(local_value); } -char * +const char * rtems_assoc_name_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->name; @@ -185,7 +188,7 @@ rtems_assoc_name_by_remote( */ unsigned32 rtems_assoc_remote_by_local_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { @@ -201,7 +204,7 @@ unsigned32 rtems_assoc_remote_by_local_bitfield( unsigned32 rtems_assoc_local_by_remote_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { @@ -215,8 +218,9 @@ unsigned32 rtems_assoc_local_by_remote_bitfield( return local_value; } -char *rtems_assoc_name_by_remote_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_remote_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) @@ -236,8 +240,9 @@ char *rtems_assoc_name_by_remote_bitfield( return buffer; } -char *rtems_assoc_name_by_local_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_local_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) diff --git a/c/src/lib/libc/assoc.h b/c/src/lib/libc/assoc.h index c820cfa973..f9a444374c 100644 --- a/c/src/lib/libc/assoc.h +++ b/c/src/lib/libc/assoc.h @@ -1,5 +1,5 @@ /* - * @(#)assoc.h 1.2 - 95/06/28 + * @(#)assoc.h 1.4 - 95/10/25 * * * Rtems associativity routines. Mainly used to convert a value from @@ -13,7 +13,7 @@ #define _INCLUDE_ASSOC_H typedef struct { - char *name; + const char *name; unsigned32 local_value; unsigned32 remote_value; } rtems_assoc_t; @@ -24,21 +24,21 @@ typedef struct { #define RTEMS_ASSOC_DEFAULT_NAME "(default)" -rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *); -rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32); -rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *); -unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *); -char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); +const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); +unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); +const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); +const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); +char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); +unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); #endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/lib/libc/error.c b/c/src/lib/libc/error.c index 56224f2a56..f9cee777ae 100644 --- a/c/src/lib/libc/error.c +++ b/c/src/lib/libc/error.c @@ -1,10 +1,9 @@ /* - * @(#)error.c 1.2 - 95/08/02 + * @(#)error.c 1.6 - 95/12/12 * * - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * + * report errors and panics to RTEMS' stderr. + * Currently just used by RTEMS monitor. * * $Id$ */ @@ -97,7 +96,7 @@ rtems_assoc_t rtems_status_assoc[] = { }; -char * +const char * rtems_status_text( rtems_status_code status ) @@ -108,7 +107,7 @@ rtems_status_text( static int rtems_verror( unsigned32 error_flag, - char *printf_format, + const char *printf_format, va_list arglist ) { @@ -181,7 +180,7 @@ static int rtems_verror( int rtems_error( int error_flag, - char *printf_format, + const char *printf_format, ... ) { @@ -200,7 +199,7 @@ int rtems_error( */ void rtems_panic( - char *printf_format, + const char *printf_format, ... ) { diff --git a/c/src/lib/libc/error.h b/c/src/lib/libc/error.h index a41f0aa534..621ee16f65 100644 --- a/c/src/lib/libc/error.h +++ b/c/src/lib/libc/error.h @@ -1,5 +1,6 @@ + /* - * @(#)error.h 1.1 - 95/08/02 + * @(#)error.h 1.3 - 95/10/25 * * * Defines and externs for rtems error reporting @@ -7,6 +8,9 @@ * $Id$ */ +#ifndef __RTEMS_ERROR_h +#define __RTEMS_ERROR_h + /* * rtems_error() and rtems_panic() support */ @@ -18,9 +22,11 @@ #define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ RTEMS_ERROR_PANIC) /* all */ -char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, char *printf_format, ...); -void rtems_panic(char *printf_format, ...); +const char *rtems_status_text(rtems_status_code); +int rtems_error(int error_code, const char *printf_format, ...); +void rtems_panic(const char *printf_format, ...); extern int rtems_panic_in_progress; +#endif +/* end of include file */ diff --git a/c/src/lib/libc/libcsupport.h b/c/src/lib/libc/libcsupport.h index 063246f4e5..f43cd189e1 100644 --- a/c/src/lib/libc/libcsupport.h +++ b/c/src/lib/libc/libcsupport.h @@ -29,14 +29,14 @@ void RTEMS_Malloc_Initialize( size_t sbrk_amount ); +extern void malloc_dump(void); extern void libc_init(int reentrant); +extern int host_errno(void); +extern void fix_syscall_errno(void); #ifdef __cplusplus } #endif -extern int host_errno(void); -extern void fix_syscall_errno(void); - #endif /* end of include file */ diff --git a/c/src/lib/libc/libio.c b/c/src/lib/libc/libio.c index a7ac5b2d3c..73b6adf298 100644 --- a/c/src/lib/libc/libio.c +++ b/c/src/lib/libc/libio.c @@ -15,12 +15,13 @@ #include /* O_RDONLY, et.al. */ #include /* O_RDONLY, et.al. */ -#include /* O_RDONLY, et.al. */ + #if defined(solaris2) #define O_NDELAY O_NONBLOCK #elif defined(RTEMS_NEWLIB) #define O_NDELAY _FNBIO #endif + #include #include /* strcmp */ #include @@ -208,7 +209,7 @@ rtems_libio_allocate(void) rc = rtems_semaphore_create( RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops), - 1, + 1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, RTEMS_NO_PRIORITY, &iop->sem diff --git a/c/src/lib/libc/no_libc.c b/c/src/lib/libc/no_libc.c index 43a91eb30e..9bb65f4df6 100644 --- a/c/src/lib/libc/no_libc.c +++ b/c/src/lib/libc/no_libc.c @@ -1,4 +1,4 @@ -#if !defined(RTEMS_LIBC) && !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX) +#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX) /* no_libc.h * diff --git a/c/src/lib/libmisc/assoc/assoc.c b/c/src/lib/libmisc/assoc/assoc.c index c18359ef8a..a3eabdb3b5 100644 --- a/c/src/lib/libmisc/assoc/assoc.c +++ b/c/src/lib/libmisc/assoc/assoc.c @@ -1,6 +1,6 @@ /* - * @(#)assoc.c 1.4 - 95/08/02 - * + * @(#)assoc.c 1.6 - 95/10/25 + * * * assoc.c * rtems assoc routines @@ -8,7 +8,6 @@ * $Id$ */ - #include #include "assoc.h" @@ -18,13 +17,13 @@ #define STREQ(a,b) (strcmp((a), (b)) == 0) #define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -36,13 +35,13 @@ rtems_assoc_ptr_by_name( return default_ap; } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -55,13 +54,13 @@ rtems_assoc_ptr_by_local( } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -80,11 +79,11 @@ rtems_assoc_ptr_by_remote( unsigned32 rtems_assoc_remote_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->remote_value; @@ -94,11 +93,11 @@ rtems_assoc_remote_by_local( unsigned32 rtems_assoc_local_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->local_value; @@ -108,11 +107,11 @@ rtems_assoc_local_by_remote( unsigned32 rtems_assoc_remote_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->remote_value; @@ -122,11 +121,11 @@ rtems_assoc_remote_by_name( unsigned32 rtems_assoc_local_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->local_value; @@ -139,25 +138,29 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -char * +const char * rtems_assoc_name_bad( unsigned32 bad_value ) { +#ifdef RTEMS_DEBUG static char bad_buffer[32]; sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif return bad_buffer; } -char * +const char * rtems_assoc_name_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->name; @@ -165,13 +168,13 @@ rtems_assoc_name_by_local( return rtems_assoc_name_bad(local_value); } -char * +const char * rtems_assoc_name_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->name; @@ -185,7 +188,7 @@ rtems_assoc_name_by_remote( */ unsigned32 rtems_assoc_remote_by_local_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { @@ -201,7 +204,7 @@ unsigned32 rtems_assoc_remote_by_local_bitfield( unsigned32 rtems_assoc_local_by_remote_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { @@ -215,8 +218,9 @@ unsigned32 rtems_assoc_local_by_remote_bitfield( return local_value; } -char *rtems_assoc_name_by_remote_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_remote_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) @@ -236,8 +240,9 @@ char *rtems_assoc_name_by_remote_bitfield( return buffer; } -char *rtems_assoc_name_by_local_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_local_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) diff --git a/c/src/lib/libmisc/assoc/assoc.h b/c/src/lib/libmisc/assoc/assoc.h index c820cfa973..f9a444374c 100644 --- a/c/src/lib/libmisc/assoc/assoc.h +++ b/c/src/lib/libmisc/assoc/assoc.h @@ -1,5 +1,5 @@ /* - * @(#)assoc.h 1.2 - 95/06/28 + * @(#)assoc.h 1.4 - 95/10/25 * * * Rtems associativity routines. Mainly used to convert a value from @@ -13,7 +13,7 @@ #define _INCLUDE_ASSOC_H typedef struct { - char *name; + const char *name; unsigned32 local_value; unsigned32 remote_value; } rtems_assoc_t; @@ -24,21 +24,21 @@ typedef struct { #define RTEMS_ASSOC_DEFAULT_NAME "(default)" -rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *); -rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32); -rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *); -unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *); -char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); +const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); +unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); +const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); +const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); +char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); +unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); #endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/lib/libmisc/error/error.c b/c/src/lib/libmisc/error/error.c index 56224f2a56..f9cee777ae 100644 --- a/c/src/lib/libmisc/error/error.c +++ b/c/src/lib/libmisc/error/error.c @@ -1,10 +1,9 @@ /* - * @(#)error.c 1.2 - 95/08/02 + * @(#)error.c 1.6 - 95/12/12 * * - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * + * report errors and panics to RTEMS' stderr. + * Currently just used by RTEMS monitor. * * $Id$ */ @@ -97,7 +96,7 @@ rtems_assoc_t rtems_status_assoc[] = { }; -char * +const char * rtems_status_text( rtems_status_code status ) @@ -108,7 +107,7 @@ rtems_status_text( static int rtems_verror( unsigned32 error_flag, - char *printf_format, + const char *printf_format, va_list arglist ) { @@ -181,7 +180,7 @@ static int rtems_verror( int rtems_error( int error_flag, - char *printf_format, + const char *printf_format, ... ) { @@ -200,7 +199,7 @@ int rtems_error( */ void rtems_panic( - char *printf_format, + const char *printf_format, ... ) { diff --git a/c/src/lib/libmisc/error/error.h b/c/src/lib/libmisc/error/error.h index a41f0aa534..621ee16f65 100644 --- a/c/src/lib/libmisc/error/error.h +++ b/c/src/lib/libmisc/error/error.h @@ -1,5 +1,6 @@ + /* - * @(#)error.h 1.1 - 95/08/02 + * @(#)error.h 1.3 - 95/10/25 * * * Defines and externs for rtems error reporting @@ -7,6 +8,9 @@ * $Id$ */ +#ifndef __RTEMS_ERROR_h +#define __RTEMS_ERROR_h + /* * rtems_error() and rtems_panic() support */ @@ -18,9 +22,11 @@ #define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ RTEMS_ERROR_PANIC) /* all */ -char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, char *printf_format, ...); -void rtems_panic(char *printf_format, ...); +const char *rtems_status_text(rtems_status_code); +int rtems_error(int error_code, const char *printf_format, ...); +void rtems_panic(const char *printf_format, ...); extern int rtems_panic_in_progress; +#endif +/* end of include file */ diff --git a/c/src/lib/libmisc/monitor/mon-monitor.c b/c/src/lib/libmisc/monitor/mon-monitor.c index 5cf80d3ad6..98b4234c00 100644 --- a/c/src/lib/libmisc/monitor/mon-monitor.c +++ b/c/src/lib/libmisc/monitor/mon-monitor.c @@ -1,7 +1,8 @@ /* - * @(#)monitor.c 1.18 - 95/08/02 + * @(#)monitor.c 1.22 - 95/11/02 * * + * * RTEMS monitor main body * * TODO: @@ -17,6 +18,10 @@ * should have a separate monitor FILE stream (ala the debugger) * remote request/response stuff should be cleaned up * maybe we can use real rpc?? + * 'info' commadn to print out: + * interrupt stack location, direction and size + * floating point config stuff + * interrupt config stuff * * $Id$ */ @@ -227,7 +232,7 @@ rtems_monitor_command_entry_t rtems_monitor_commands[] = { " Enter the debugger, if possible.\n" " A continue from the debugger will return to the monitor.\n", 0, - CPU_INVOKE_DEBUGGER, + rtems_monitor_debugger_cmd, 0, }, #endif @@ -296,6 +301,18 @@ rtems_monitor_continue_cmd( rtems_monitor_suspend(RTEMS_NO_TIMEOUT); } +void +rtems_monitor_debugger_cmd( + int argc, + char **argv, + unsigned32 command_arg, + boolean verbose +) +{ +#ifdef CPU_INVOKE_DEBUGGER + CPU_INVOKE_DEBUGGER; +#endif +} void rtems_monitor_node_cmd( @@ -338,22 +355,14 @@ rtems_monitor_node_cmd( * 400a708c ? _Thread_Dispatch_disable_level * 400a7090 ? _Configuration_Table * - * * We ignore the type field. * - * Parameters: - * - * - * Returns: - * - * * Side Effects: * Creates and fills in 'rtems_monitor_symbols' table * - * Notes: - * - * - * Deficiencies/ToDo: + * TODO + * there should be a BSP #define or something like that + * to do this; Assuming stdio is crazy. * Someday this should know BFD * Maybe we could get objcopy to just copy the symbol areas * and copy that down. @@ -373,7 +382,7 @@ rtems_monitor_symbols_loadup(void) if (rtems_monitor_symbols == 0) return; -#ifdef simhppa +#ifdef SIMHPPA fp = fdopen(8, "r"); /* don't ask; don't tell */ #else fp = fopen("symbols", "r"); diff --git a/c/src/lib/libmisc/monitor/mon-prmisc.c b/c/src/lib/libmisc/monitor/mon-prmisc.c index 0a9f9bdf2e..6003695195 100644 --- a/c/src/lib/libmisc/monitor/mon-prmisc.c +++ b/c/src/lib/libmisc/monitor/mon-prmisc.c @@ -70,7 +70,7 @@ rtems_monitor_dump_assoc_bitfield( { unsigned32 b; unsigned32 length = 0; - char *name; + const char *name; for (b = 1; b; b <<= 1) if (b & value) diff --git a/c/src/lib/libmisc/monitor/monitor.h b/c/src/lib/libmisc/monitor/monitor.h index 2ee03f570b..2f20bd2937 100644 --- a/c/src/lib/libmisc/monitor/monitor.h +++ b/c/src/lib/libmisc/monitor/monitor.h @@ -1,6 +1,7 @@ /* - * @(#)monitor.h 1.14 - 95/08/02 + * @(#)monitor.h 1.20 - 95/12/12 * + * * $Id$ */ @@ -318,6 +319,7 @@ void rtems_monitor_wakeup(void); void rtems_monitor_pause_cmd(int, char **, unsigned32, boolean); void rtems_monitor_fatal_cmd(int, char **, unsigned32, boolean); void rtems_monitor_continue_cmd(int, char **, unsigned32, boolean); +void rtems_monitor_debugger_cmd(int, char **, unsigned32, boolean); void rtems_monitor_node_cmd(int, char **, unsigned32, boolean); void rtems_monitor_symbols_loadup(void); void rtems_monitor_task(rtems_task_argument); diff --git a/c/src/libchip/shmdr/getlq.c b/c/src/libchip/shmdr/getlq.c index ebc5bed8b6..efc7b0996c 100644 --- a/c/src/libchip/shmdr/getlq.c +++ b/c/src/libchip/shmdr/getlq.c @@ -22,7 +22,7 @@ */ #include -#include "shm.h" +#include Shm_Envelope_control *Shm_Locked_queue_Get( Shm_Locked_queue_Control *lq_cb diff --git a/c/src/libchip/shmdr/shm_driver.h b/c/src/libchip/shmdr/shm_driver.h index f4671dde97..2b0e39320d 100644 --- a/c/src/libchip/shmdr/shm_driver.h +++ b/c/src/libchip/shmdr/shm_driver.h @@ -470,11 +470,7 @@ void Shm_Locked_queue_Initialize( /* portable routines */ void Init_env_pool(); void Shm_Print_statistics( void ); -void MPCI_Fatal( - Internal_errors_Source source, - boolean is_internal, - rtems_unsigned32 error - ); +void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 ); rtems_task Shm_Cause_interrupt( rtems_unsigned32 ); void Shm_Poll(); void Shm_setclockvec(); diff --git a/c/src/libmisc/assoc/assoc.c b/c/src/libmisc/assoc/assoc.c index c18359ef8a..a3eabdb3b5 100644 --- a/c/src/libmisc/assoc/assoc.c +++ b/c/src/libmisc/assoc/assoc.c @@ -1,6 +1,6 @@ /* - * @(#)assoc.c 1.4 - 95/08/02 - * + * @(#)assoc.c 1.6 - 95/10/25 + * * * assoc.c * rtems assoc routines @@ -8,7 +8,6 @@ * $Id$ */ - #include #include "assoc.h" @@ -18,13 +17,13 @@ #define STREQ(a,b) (strcmp((a), (b)) == 0) #define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -36,13 +35,13 @@ rtems_assoc_ptr_by_name( return default_ap; } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -55,13 +54,13 @@ rtems_assoc_ptr_by_local( } -rtems_assoc_t * +const rtems_assoc_t * rtems_assoc_ptr_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *default_ap = 0; + const rtems_assoc_t *default_ap = 0; if (rtems_assoc_is_default(ap)) default_ap = ap++; @@ -80,11 +79,11 @@ rtems_assoc_ptr_by_remote( unsigned32 rtems_assoc_remote_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->remote_value; @@ -94,11 +93,11 @@ rtems_assoc_remote_by_local( unsigned32 rtems_assoc_local_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->local_value; @@ -108,11 +107,11 @@ rtems_assoc_local_by_remote( unsigned32 rtems_assoc_remote_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->remote_value; @@ -122,11 +121,11 @@ rtems_assoc_remote_by_name( unsigned32 rtems_assoc_local_by_name( - rtems_assoc_t *ap, - char *name + const rtems_assoc_t *ap, + const char *name ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_name(ap, name); if (nap) return nap->local_value; @@ -139,25 +138,29 @@ rtems_assoc_local_by_name( * this is not reentrant, but it really shouldn't be invoked anyway */ -char * +const char * rtems_assoc_name_bad( unsigned32 bad_value ) { +#ifdef RTEMS_DEBUG static char bad_buffer[32]; sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); +#else + static char bad_buffer[32] = ""; +#endif return bad_buffer; } -char * +const char * rtems_assoc_name_by_local( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_local(ap, local_value); if (nap) return nap->name; @@ -165,13 +168,13 @@ rtems_assoc_name_by_local( return rtems_assoc_name_bad(local_value); } -char * +const char * rtems_assoc_name_by_remote( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { - rtems_assoc_t *nap; + const rtems_assoc_t *nap; nap = rtems_assoc_ptr_by_remote(ap, remote_value); if (nap) return nap->name; @@ -185,7 +188,7 @@ rtems_assoc_name_by_remote( */ unsigned32 rtems_assoc_remote_by_local_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 local_value ) { @@ -201,7 +204,7 @@ unsigned32 rtems_assoc_remote_by_local_bitfield( unsigned32 rtems_assoc_local_by_remote_bitfield( - rtems_assoc_t *ap, + const rtems_assoc_t *ap, unsigned32 remote_value ) { @@ -215,8 +218,9 @@ unsigned32 rtems_assoc_local_by_remote_bitfield( return local_value; } -char *rtems_assoc_name_by_remote_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_remote_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) @@ -236,8 +240,9 @@ char *rtems_assoc_name_by_remote_bitfield( return buffer; } -char *rtems_assoc_name_by_local_bitfield( - rtems_assoc_t *ap, +char * +rtems_assoc_name_by_local_bitfield( + const rtems_assoc_t *ap, unsigned32 value, char *buffer ) diff --git a/c/src/libmisc/assoc/assoc.h b/c/src/libmisc/assoc/assoc.h index c820cfa973..f9a444374c 100644 --- a/c/src/libmisc/assoc/assoc.h +++ b/c/src/libmisc/assoc/assoc.h @@ -1,5 +1,5 @@ /* - * @(#)assoc.h 1.2 - 95/06/28 + * @(#)assoc.h 1.4 - 95/10/25 * * * Rtems associativity routines. Mainly used to convert a value from @@ -13,7 +13,7 @@ #define _INCLUDE_ASSOC_H typedef struct { - char *name; + const char *name; unsigned32 local_value; unsigned32 remote_value; } rtems_assoc_t; @@ -24,21 +24,21 @@ typedef struct { #define RTEMS_ASSOC_DEFAULT_NAME "(default)" -rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *); -rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32); -rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *); -unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *); -char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_remote(rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); +const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); +const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); +unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); +const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); +const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); +char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); +unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); #endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/libmisc/error/error.c b/c/src/libmisc/error/error.c index 56224f2a56..f9cee777ae 100644 --- a/c/src/libmisc/error/error.c +++ b/c/src/libmisc/error/error.c @@ -1,10 +1,9 @@ /* - * @(#)error.c 1.2 - 95/08/02 + * @(#)error.c 1.6 - 95/12/12 * * - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * + * report errors and panics to RTEMS' stderr. + * Currently just used by RTEMS monitor. * * $Id$ */ @@ -97,7 +96,7 @@ rtems_assoc_t rtems_status_assoc[] = { }; -char * +const char * rtems_status_text( rtems_status_code status ) @@ -108,7 +107,7 @@ rtems_status_text( static int rtems_verror( unsigned32 error_flag, - char *printf_format, + const char *printf_format, va_list arglist ) { @@ -181,7 +180,7 @@ static int rtems_verror( int rtems_error( int error_flag, - char *printf_format, + const char *printf_format, ... ) { @@ -200,7 +199,7 @@ int rtems_error( */ void rtems_panic( - char *printf_format, + const char *printf_format, ... ) { diff --git a/c/src/libmisc/error/error.h b/c/src/libmisc/error/error.h index a41f0aa534..621ee16f65 100644 --- a/c/src/libmisc/error/error.h +++ b/c/src/libmisc/error/error.h @@ -1,5 +1,6 @@ + /* - * @(#)error.h 1.1 - 95/08/02 + * @(#)error.h 1.3 - 95/10/25 * * * Defines and externs for rtems error reporting @@ -7,6 +8,9 @@ * $Id$ */ +#ifndef __RTEMS_ERROR_h +#define __RTEMS_ERROR_h + /* * rtems_error() and rtems_panic() support */ @@ -18,9 +22,11 @@ #define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ RTEMS_ERROR_PANIC) /* all */ -char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, char *printf_format, ...); -void rtems_panic(char *printf_format, ...); +const char *rtems_status_text(rtems_status_code); +int rtems_error(int error_code, const char *printf_format, ...); +void rtems_panic(const char *printf_format, ...); extern int rtems_panic_in_progress; +#endif +/* end of include file */ diff --git a/c/src/libmisc/monitor/mon-monitor.c b/c/src/libmisc/monitor/mon-monitor.c index 5cf80d3ad6..98b4234c00 100644 --- a/c/src/libmisc/monitor/mon-monitor.c +++ b/c/src/libmisc/monitor/mon-monitor.c @@ -1,7 +1,8 @@ /* - * @(#)monitor.c 1.18 - 95/08/02 + * @(#)monitor.c 1.22 - 95/11/02 * * + * * RTEMS monitor main body * * TODO: @@ -17,6 +18,10 @@ * should have a separate monitor FILE stream (ala the debugger) * remote request/response stuff should be cleaned up * maybe we can use real rpc?? + * 'info' commadn to print out: + * interrupt stack location, direction and size + * floating point config stuff + * interrupt config stuff * * $Id$ */ @@ -227,7 +232,7 @@ rtems_monitor_command_entry_t rtems_monitor_commands[] = { " Enter the debugger, if possible.\n" " A continue from the debugger will return to the monitor.\n", 0, - CPU_INVOKE_DEBUGGER, + rtems_monitor_debugger_cmd, 0, }, #endif @@ -296,6 +301,18 @@ rtems_monitor_continue_cmd( rtems_monitor_suspend(RTEMS_NO_TIMEOUT); } +void +rtems_monitor_debugger_cmd( + int argc, + char **argv, + unsigned32 command_arg, + boolean verbose +) +{ +#ifdef CPU_INVOKE_DEBUGGER + CPU_INVOKE_DEBUGGER; +#endif +} void rtems_monitor_node_cmd( @@ -338,22 +355,14 @@ rtems_monitor_node_cmd( * 400a708c ? _Thread_Dispatch_disable_level * 400a7090 ? _Configuration_Table * - * * We ignore the type field. * - * Parameters: - * - * - * Returns: - * - * * Side Effects: * Creates and fills in 'rtems_monitor_symbols' table * - * Notes: - * - * - * Deficiencies/ToDo: + * TODO + * there should be a BSP #define or something like that + * to do this; Assuming stdio is crazy. * Someday this should know BFD * Maybe we could get objcopy to just copy the symbol areas * and copy that down. @@ -373,7 +382,7 @@ rtems_monitor_symbols_loadup(void) if (rtems_monitor_symbols == 0) return; -#ifdef simhppa +#ifdef SIMHPPA fp = fdopen(8, "r"); /* don't ask; don't tell */ #else fp = fopen("symbols", "r"); diff --git a/c/src/libmisc/monitor/mon-prmisc.c b/c/src/libmisc/monitor/mon-prmisc.c index 0a9f9bdf2e..6003695195 100644 --- a/c/src/libmisc/monitor/mon-prmisc.c +++ b/c/src/libmisc/monitor/mon-prmisc.c @@ -70,7 +70,7 @@ rtems_monitor_dump_assoc_bitfield( { unsigned32 b; unsigned32 length = 0; - char *name; + const char *name; for (b = 1; b; b <<= 1) if (b & value) diff --git a/c/src/libmisc/monitor/monitor.h b/c/src/libmisc/monitor/monitor.h index 2ee03f570b..2f20bd2937 100644 --- a/c/src/libmisc/monitor/monitor.h +++ b/c/src/libmisc/monitor/monitor.h @@ -1,6 +1,7 @@ /* - * @(#)monitor.h 1.14 - 95/08/02 + * @(#)monitor.h 1.20 - 95/12/12 * + * * $Id$ */ @@ -318,6 +319,7 @@ void rtems_monitor_wakeup(void); void rtems_monitor_pause_cmd(int, char **, unsigned32, boolean); void rtems_monitor_fatal_cmd(int, char **, unsigned32, boolean); void rtems_monitor_continue_cmd(int, char **, unsigned32, boolean); +void rtems_monitor_debugger_cmd(int, char **, unsigned32, boolean); void rtems_monitor_node_cmd(int, char **, unsigned32, boolean); void rtems_monitor_symbols_loadup(void); void rtems_monitor_task(rtems_task_argument); diff --git a/c/src/tests/sptests/sp09/screen02.c b/c/src/tests/sptests/sp09/screen02.c index 02eb5e4498..5f2ef82205 100644 --- a/c/src/tests/sptests/sp09/screen02.c +++ b/c/src/tests/sptests/sp09/screen02.c @@ -188,5 +188,5 @@ void Screen2() RTEMS_INVALID_CLOCK, "rtems_task_wake_when before current time" ); - puts( " - RTEMS_INVALID_CLOCK" ); + puts( " - RTEMS_INVALID_CLOCK" ); } diff --git a/c/src/tests/sptests/sp11/sp11.scn b/c/src/tests/sptests/sp11/sp11.scn index f34a9eac5f..db0469eb60 100644 --- a/c/src/tests/sptests/sp11/sp11.scn +++ b/c/src/tests/sptests/sp11/sp11.scn @@ -29,7 +29,7 @@ TA2 - rtems_task_delete - deletes self TA1 - RTEMS_EVENT_18 received - eventout => 00040000 TA1 - rtems_clock_get - 08:15:05 02/12/1988 TA1 - rtems_event_send - send RTEMS_EVENT_3 to self -TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY +TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY TA1 - RTEMS_EVENT_3 received - eventout => 00000008 TA1 - rtems_event_send - send RTEMS_EVENT_4 to self TA1 - rtems_event_receive - RTEMS_EVENT_4 or RTEMS_EVENT_5 - forever and ANY @@ -63,10 +63,10 @@ TA1 - rtems_clock_set - 08:15:00 02/12/1988 TA1 - rtems_event_receive all outstanding events TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days -TA1 - rtems_clock_set - 07:15:00 02/12/1988 +TA1 - rtems_clock_set - 07:15:00 02/12/1988 TA1 - set time backwards TA1 - no events received -TA1 - rtems_clock_set - 07:15:00 02/14/1988 +TA1 - rtems_clock_set - 07:15:00 02/14/1988 TA1 - set time forwards (leave a timer) TA1 - RTEMS_EVENT_10 received TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks diff --git a/c/src/tests/support/include/tmacros.h b/c/src/tests/support/include/tmacros.h index dc2a82f397..affc132edd 100644 --- a/c/src/tests/support/include/tmacros.h +++ b/c/src/tests/support/include/tmacros.h @@ -21,8 +21,7 @@ extern "C" { #endif -#include -#include +#include /* includes */ #include #include @@ -40,23 +39,29 @@ extern "C" { fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg ) #define fatal_directive_status( stat, desired, msg ) \ - { \ + do { \ if ( (stat) != (desired) ) { \ printf( "\n%s FAILED -- expected (%d) got (%d)\n", \ (msg), (desired), (stat) ); \ + fflush(stdout); \ exit( stat ); \ } \ - } + } while ( 0 ) #define sprint_time(str,s1,tb,s2) \ + do { \ sprintf( (str), "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ s1, (tb)->hour, (tb)->minute, (tb)->second, \ - (tb)->month, (tb)->day, (tb)->year, s2 ); + (tb)->month, (tb)->day, (tb)->year, s2 ); \ + } while ( 0 ) #define print_time(s1,tb,s2) \ + do { \ printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ s1, (tb)->hour, (tb)->minute, (tb)->second, \ - (tb)->month, (tb)->day, (tb)->year, s2 ); + (tb)->month, (tb)->day, (tb)->year, s2 ); \ + fflush(stdout); \ + } while ( 0 ) #define put_dot( c ) putchar( c ); fflush( stdout ) diff --git a/c/src/tests/tools/generic/difftest b/c/src/tests/tools/generic/difftest index 7c21155dbb..1f76cdf356 100644 --- a/c/src/tests/tools/generic/difftest +++ b/c/src/tests/tools/generic/difftest @@ -55,7 +55,7 @@ do fatal;; esac done -((shiftcount = $OPTIND - 1)) +shiftcount=`expr $OPTIND - 1` shift $shiftcount args=$* -- cgit v1.2.3