diff options
Diffstat (limited to 'c/src/lib')
28 files changed, 280 insertions, 199 deletions
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 @@ -66,13 +66,38 @@ extern void Clock_delay(rtems_unsigned32 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 <bsp.h> -#include <runway.h> #include <shm.h> @@ -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 <stdio.h> #include <rtems.h> +#include <rtems/error.h> + #include <shm.h> 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 <rtems.h> -#include "shm.h" +#include <shm.h> 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 <bsp.h> #include <shm.h> +#include <sys/types.h> /* 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 <bsp.h> #include <shm.h> +#include <sys/types.h> /* 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 <bsp.h> #include <shm.h> -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, @@ -96,6 +98,12 @@ extern "C" { 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 <rtems.h> #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] = "<assoc.c: BAD NAME>"; +#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 <stdio.h> /* O_RDONLY, et.al. */ #include <fcntl.h> /* O_RDONLY, et.al. */ -#include <sys/fcntl.h> /* O_RDONLY, et.al. */ + #if defined(solaris2) #define O_NDELAY O_NONBLOCK #elif defined(RTEMS_NEWLIB) #define O_NDELAY _FNBIO #endif + #include <errno.h> #include <string.h> /* strcmp */ #include <unistd.h> @@ -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 <rtems.h> #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] = "<assoc.c: BAD NAME>"; +#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); |