From 981b99faf208e2c7f6e2b83d73e1b89b669112ee Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 10 Aug 1999 16:41:44 +0000 Subject: Patch from Eric Valette and Emmanuel Raguet : - the dec21140 driver code has been hardened (various bug fixed) Emmanuel, - bug in the mcp750 init code have been fixed (interrupt stack/initial stack initialization), BSS correctly cleared (Eric V) - remote debugging over TCP/IP is nearly complete (berakpoints, backtrace, variables,...) (Eric V), - exception handling code has also been improved in order to fully support RDBG requirements (Eric V), --- c/src/lib/include/rdbg/i386/rdbg_f.h | 46 ++++++++++++--------------------- c/src/lib/include/rdbg/i386/reg.h | 6 ++++- c/src/lib/include/rdbg/powerpc/rdbg_f.h | 38 +++++++++++++++++++++++++++ c/src/lib/include/rdbg/powerpc/reg.h | 16 ++++++++++++ c/src/lib/include/rdbg/rdbg.h | 44 ++++++++++++++++++++++++++++++- c/src/lib/include/rdbg/servrpc.h | 12 +++++++++ 6 files changed, 131 insertions(+), 31 deletions(-) create mode 100644 c/src/lib/include/rdbg/powerpc/rdbg_f.h create mode 100644 c/src/lib/include/rdbg/powerpc/reg.h (limited to 'c/src/lib/include/rdbg') diff --git a/c/src/lib/include/rdbg/i386/rdbg_f.h b/c/src/lib/include/rdbg/i386/rdbg_f.h index 3fd087f50a..c75cecc7bc 100644 --- a/c/src/lib/include/rdbg/i386/rdbg_f.h +++ b/c/src/lib/include/rdbg/i386/rdbg_f.h @@ -6,6 +6,8 @@ * * Synopsis = Machine-dependent header file * + * $Id$ + * ************************************************************************** */ @@ -17,35 +19,21 @@ #define EFLAGS_TF 0x00100 -typedef struct Exception_context_struct { - struct Exception_context_struct *next; - struct Exception_context_struct *previous; - Objects_Id id; - Objects_Id semaphoreId; - CPU_Exception_frame *ctx; -} Exception_context; - -extern int PushExceptCtx (Objects_Id Id, - Objects_Id semId, - CPU_Exception_frame *ctx); -extern int PopExceptCtx (Objects_Id Id); -extern Exception_context *GetExceptCtx (Objects_Id Id); -extern int Single_Step (CPU_Exception_frame* ctx); -extern int CheckForSingleStep (CPU_Exception_frame* ctx); -extern void BreakPointExcHdl (CPU_Exception_frame *ctx); -extern void CtxToRegs (const CPU_Exception_frame*,xdr_regs*); -extern void RegsToCtx (const xdr_regs*,CPU_Exception_frame*); - -extern void enterRdbg (); -extern void get_ctx_thread (Thread_Control *thread, - CPU_Exception_frame* ctx); -extern void set_ctx_thread (Thread_Control *thread, - CPU_Exception_frame* ctx); - -void copyback_data_cache_and_invalidate_instr_cache(); - -extern int ExitForSingleStep; - +static inline int isRdbgException(Exception_context *ctx) +{ + if ( + ctx->ctx->idtIndex != I386_EXCEPTION_DEBUG && + ctx->ctx->idtIndex != I386_EXCEPTION_BREAKPOINT && + ctx->ctx->idtIndex != I386_EXCEPTION_ENTER_RDBG + ) return 0; + else return 1; +} +static inline int getExcNum(Exception_context *ctx) +{ + return ctx->ctx->idtIndex; +} + +extern void connect_rdbg_exception(); #endif diff --git a/c/src/lib/include/rdbg/i386/reg.h b/c/src/lib/include/rdbg/i386/reg.h index d6b34f3c28..06fb8340e1 100644 --- a/c/src/lib/include/rdbg/i386/reg.h +++ b/c/src/lib/include/rdbg/i386/reg.h @@ -1,4 +1,8 @@ - +/* + * Registers Offset in frame definition + * + * $Id$ + */ #define NBREGS 19 diff --git a/c/src/lib/include/rdbg/powerpc/rdbg_f.h b/c/src/lib/include/rdbg/powerpc/rdbg_f.h new file mode 100644 index 0000000000..521595407e --- /dev/null +++ b/c/src/lib/include/rdbg/powerpc/rdbg_f.h @@ -0,0 +1,38 @@ +/* + ************************************************************************** + * + * Component = RDBG + * Module = rdbg_f.h + * + * Synopsis = Machine-dependent header file + * + * $Id$ + * + ************************************************************************** + */ + +#ifndef RDBG_F_H +#define RDBG_F_H + +#include +#include + +static inline int isRdbgException(Exception_context *ctx) +{ + if ( + ctx->ctx->_EXC_number != ASM_SYS_VECTOR && + ctx->ctx->_EXC_number != ASM_TRACE_VECTOR + ) return 0; + else return 1; +} +static inline int getExcNum(Exception_context *ctx) +{ + return ctx->ctx->_EXC_number; +} + +extern void connect_rdbg_exception(); + +#endif + + + diff --git a/c/src/lib/include/rdbg/powerpc/reg.h b/c/src/lib/include/rdbg/powerpc/reg.h new file mode 100644 index 0000000000..9a6af28118 --- /dev/null +++ b/c/src/lib/include/rdbg/powerpc/reg.h @@ -0,0 +1,16 @@ +/* + * Registers frame offset definition + * + * $Id$ + */ + +#define NBREGS 43 + +typedef unsigned int regs[NBREGS]; + +/* To be used in common code */ +typedef regs REGS; + + + + diff --git a/c/src/lib/include/rdbg/rdbg.h b/c/src/lib/include/rdbg/rdbg.h index 737edd5575..6d03a573d1 100644 --- a/c/src/lib/include/rdbg/rdbg.h +++ b/c/src/lib/include/rdbg/rdbg.h @@ -5,6 +5,8 @@ * * Synopsis = rdbg.h * + * $Id$ + * ************************************************************************** */ @@ -14,9 +16,9 @@ #include #include #include -#include #include /* For malloc() and free() prototypes */ #include +#include #define Malloc(size) malloc (size) #define Free(block) free (block) @@ -49,5 +51,45 @@ void svc_processrequest (SVCXPRT* xprt, void (*dispatch)()); int svcudp_enablecache (SVCXPRT *transp, u_long size); +typedef struct Exception_context_struct { + struct Exception_context_struct *next; + struct Exception_context_struct *previous; + Objects_Id id; + Objects_Id semaphoreId; + CPU_Exception_frame *ctx; +} Exception_context; + +struct xdr_regs; + +extern int PushExceptCtx (Objects_Id Id, + Objects_Id semId, + CPU_Exception_frame *ctx); +extern int PopExceptCtx (Objects_Id Id); +extern Exception_context *GetExceptCtx (Objects_Id Id); +extern int Single_Step (CPU_Exception_frame* ctx); +extern int CheckForSingleStep (CPU_Exception_frame* ctx); +extern void BreakPointExcHdl (CPU_Exception_frame *ctx); +extern void CtxToRegs (const CPU_Exception_frame*,struct xdr_regs*); +extern void RegsToCtx (const struct xdr_regs*,CPU_Exception_frame*); + +extern void enterRdbg (); +extern void get_ctx_thread (Thread_Control *thread, + CPU_Exception_frame* ctx); +extern void set_ctx_thread (Thread_Control *thread, + CPU_Exception_frame* ctx); +extern int PushSavedExceptCtx ( Objects_Id Id, + CPU_Exception_frame *ctx ); +extern int ExcepToSig (Exception_context *ctx); + +extern int ExitForSingleStep; + +extern rtems_id serializeSemId; +extern rtems_id wakeupEventSemId; +extern volatile unsigned int NbSerializedCtx; + +void copyback_data_cache_and_invalidate_instr_cache(unsigned char* addr, int size); + +#include + #endif /* !RDBG_H */ diff --git a/c/src/lib/include/rdbg/servrpc.h b/c/src/lib/include/rdbg/servrpc.h index 71198d4d1f..e183e1af7d 100644 --- a/c/src/lib/include/rdbg/servrpc.h +++ b/c/src/lib/include/rdbg/servrpc.h @@ -1,3 +1,6 @@ +/* + * $Id$ + */ #ifndef SERVRPC_H #define SERVRPC_H @@ -30,6 +33,15 @@ extern const char* PtraceNames[]; /* list of ptrace requests for debug out */ extern const char* BmsgNames[]; /* list of BMSG_xxx names */ extern const char* PtraceName(int req); +#ifdef i386 /* low-high machine such as 386 */ +#define HL_W(w) (((UINT16)(w)>>8)+((((w)&0xFF)<<8))) +#define HL_D(d) (((UINT32)(d)>>24)+(((d)&0x00FF0000)>>8) \ + +(((d)&0xFF00)<<8)+(((d)&0xFF)<<24)) +#else +#define HL_W(w) w +#define HL_D(d) d +#endif + # define DPRINTF(a) (rdb_debug ? printk ("%d >>> ", getId()), printk a : 0) #else # define DPRINTF(a) /* suppress */ -- cgit v1.2.3