diff options
Diffstat (limited to 'c/src/librdbg/src/powerpc/new_exception_processing')
3 files changed, 81 insertions, 201 deletions
diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h index 07f50eed15..00260d8ac1 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h +++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h @@ -16,7 +16,7 @@ extern "C" { #define RTEMS_PORT 2071 #define RTEMS_BACK_PORT 2073 #ifndef REMDEB_H -#define RPCGENSRVNAME(a) a +#define RPCGENSRVNAME(a) a enum rpc_type { SUNRPC = 0, @@ -99,62 +99,62 @@ struct xdr_regs { typedef struct xdr_regs xdr_regs; /* now define register macros to apply to xdr_regs struct */ -#define R_PC 0 -#define R_MSR 1 -#define R_EXCEPNB 2 -#define R_R0 3 -#define R_R1 (R_R0 + 1) -#define R_R2 (R_R0 + 2) -#define R_R3 (R_R0 + 3) -#define R_R4 (R_R0 + 4) -#define R_R5 (R_R0 + 5) -#define R_R6 (R_R0 + 6) -#define R_R7 (R_R0 + 7) -#define R_R8 (R_R0 + 8) -#define R_R9 (R_R0 + 9) -#define R_R10 (R_R0 + 10) -#define R_R11 (R_R0 + 11) -#define R_R12 (R_R0 + 12) -#define R_R13 (R_R0 + 13) -#define R_R14 (R_R0 + 14) -#define R_R15 (R_R0 + 15) -#define R_R16 (R_R0 + 16) -#define R_R17 (R_R0 + 17) -#define R_R18 (R_R0 + 18) -#define R_R19 (R_R0 + 19) -#define R_R20 (R_R0 + 20) -#define R_R21 (R_R0 + 21) -#define R_R22 (R_R0 + 22) -#define R_R23 (R_R0 + 23) -#define R_R24 (R_R0 + 24) -#define R_R25 (R_R0 + 25) -#define R_R26 (R_R0 + 26) -#define R_R27 (R_R0 + 27) -#define R_R28 (R_R0 + 28) -#define R_R29 (R_R0 + 29) -#define R_R30 (R_R0 + 30) -#define R_R31 (R_R0 + 31) -#define R_CR 35 -#define R_CTR 36 -#define R_XER 37 -#define R_LR 38 -#define R_MQ 39 +#define R_PC 0 +#define R_MSR 1 +#define R_EXCEPNB 2 +#define R_R0 3 +#define R_R1 (R_R0 + 1) +#define R_R2 (R_R0 + 2) +#define R_R3 (R_R0 + 3) +#define R_R4 (R_R0 + 4) +#define R_R5 (R_R0 + 5) +#define R_R6 (R_R0 + 6) +#define R_R7 (R_R0 + 7) +#define R_R8 (R_R0 + 8) +#define R_R9 (R_R0 + 9) +#define R_R10 (R_R0 + 10) +#define R_R11 (R_R0 + 11) +#define R_R12 (R_R0 + 12) +#define R_R13 (R_R0 + 13) +#define R_R14 (R_R0 + 14) +#define R_R15 (R_R0 + 15) +#define R_R16 (R_R0 + 16) +#define R_R17 (R_R0 + 17) +#define R_R18 (R_R0 + 18) +#define R_R19 (R_R0 + 19) +#define R_R20 (R_R0 + 20) +#define R_R21 (R_R0 + 21) +#define R_R22 (R_R0 + 22) +#define R_R23 (R_R0 + 23) +#define R_R24 (R_R0 + 24) +#define R_R25 (R_R0 + 25) +#define R_R26 (R_R0 + 26) +#define R_R27 (R_R0 + 27) +#define R_R28 (R_R0 + 28) +#define R_R29 (R_R0 + 29) +#define R_R30 (R_R0 + 30) +#define R_R31 (R_R0 + 31) +#define R_CR 35 +#define R_CTR 36 +#define R_XER 37 +#define R_LR 38 +#define R_MQ 39 #include <libcpu/raw_exception.h> -#define REG_PC tabreg[R_PC] /* PC register offset */ -#define REG_SP tabreg[R_R1] /* SP register offset */ -#define REG_FP tabreg[R_R1] /* SP register offset (no FP on PPC) */ -#define BREAK_SIZE 4 /* Breakpoint occupies 4 bytes */ -#define BREAK_ADJ 0 /* Nothing to subtract from address after bp */ -#define IS_BREAK(l) ((l) == 0x7d8d6808) -#define SET_BREAK(l) (0x7d8d6808) +#define REG_PC tabreg[R_PC] /* PC register offset */ +#define REG_SP tabreg[R_R1] /* SP register offset */ +#define REG_FP tabreg[R_R1] /* SP register offset (no FP on PPC) */ +#define BREAK_SIZE 4 /* Breakpoint occupies 4 bytes */ +#define BREAK_ADJ 0 /* Nothing to subtract from address after bp */ +#define IS_BREAK(l) ((l) == 0x7d8d6808) +#define SET_BREAK(l) (0x7d8d6808) #define ORG_BREAK(c,p) (p) -#define IS_STEP(regs) (regs.tabreg[R_EXCEPNB] == ASM_TRACE_VECTOR) /* Was step and not break */ -#define TARGET_PROC_TYPE 3 +#define IS_STEP(regs) (regs.tabreg[R_EXCEPNB] == ASM_TRACE_VECTOR) /* Was step and not break */ +#define TARGET_PROC_TYPE 3 #define MAXDEBUGGEE 150 #define NAMEMAX 17 - /* + /* * Memory data for read/write text or data. The size is in data. The target * addr is in the addr field. * Be careful before modifying because this value goes into internal @@ -252,7 +252,7 @@ typedef struct { } CHAR_DATA; typedef char *one_arg; - /* now open_connex() routine which establishes a connection to server */ + /* now open_connex() routine which establishes a connection to server */ enum debug_type { DEBTYP_PROCESS = 0, @@ -261,7 +261,7 @@ enum debug_type { DEBTYP_OTHER = 3, }; typedef enum debug_type debug_type; -#define DEBUGGER_IS_GDB 0x2 /* */ +#define DEBUGGER_IS_GDB 0x2 /* */ struct open_in { u_char back_port[16]; @@ -281,7 +281,7 @@ struct open_out { u_short server_vers; }; typedef struct open_out open_out; - /* now close_connex() routine which detaches from server */ + /* now close_connex() routine which detaches from server */ enum close_control { CLOSE_IGNORE = 0, @@ -294,7 +294,7 @@ struct close_in { close_control control; }; typedef struct close_in close_in; - /* now send_signal() routine which sends signals to processes like kill(2) */ + /* now send_signal() routine which sends signals to processes like kill(2) */ struct signal_in { int pid; @@ -307,7 +307,7 @@ struct signal_out { int errNo; }; typedef struct signal_out signal_out; - /* now wait_info() routine which returns results of polling the wait status + /* now wait_info() routine which returns results of polling the wait status of a process/actor. It may return 0 if running, else pid or -1 */ enum stop_code { @@ -342,8 +342,8 @@ struct wait_out { u_long thread; }; typedef struct wait_out wait_out; - /* now ptrace() routine. This matches the Sun UNIX ptrace as well as - some additions */ + /* now ptrace() routine. This matches the Sun UNIX ptrace as well as + some additions */ #define PTRFLG_FORCE 1 #define PTRFLG_NON_OWNER 2 #define PTRFLG_FREE 4 @@ -411,7 +411,7 @@ struct get_signal_names_out { all_signals signals; }; typedef struct get_signal_names_out get_signal_names_out; - /* now define the actual calls we support */ + /* now define the actual calls we support */ #define REMDEB_H #endif diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c index 88c15cc708..e69de29bb2 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c +++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c @@ -1,120 +0,0 @@ -#include <rpc/types.h> -#include <rpc/rpc.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <bsp.h> -#include <rdbg/servrpc.h> -#include <rdbg/remdeb.h> -#define printf(c) -/*HEADER_START*/ -#define RTEMS_PORT 2071 -#define RTEMS_BACK_PORT 2073 -/* - * Sun request values for the remote ptrace system call - */ - - /* - * Memory data for read/write text or data. The size is in data. The target - * addr is in the addr field. - * Be careful before modifying because this value goes into internal - * pipes and is allocated on stack too. Pipes and/or the stack could - * become too small if this value gets incremented. - */ - /* now open_connex() routine which establishes a connection to server */ -#define DEBUGGER_IS_GDB 0x2 /* */ - /* now close_connex() routine which detaches from server */ - /* now send_signal() routine which sends signals to processes like kill(2) */ - /* now wait_info() routine which returns results of polling the wait status - of a process/actor. It may return 0 if running, else pid or -1 */ - /* now ptrace() routine. This matches the Sun UNIX ptrace as well as - some additions */ - /* now define the actual calls we support */ -const char* names [] = { - "NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3", - "name4", "name5", "name6", "name7", - "name8", "name9", "CLOSE_CONNEX", "PTRACE", - "name12", "WAIT_INFO", "name14", "name15", - "name16", "GET_SIGNAL_NAMES", "name18" -}; - -void -remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp) -{ - union { - open_in open_connex_2_arg; - signal_in send_signal_2_arg; - close_in close_connex_2_arg; - ptrace_in ptrace_2_arg; - wait_in wait_info_2_arg; - } argument; - char *result; - xdrproc_t _xdr_argument, _xdr_result; - char *(*local)(char *, struct svc_req *); - - DPRINTF (("remotedeb_2: %s (%d)\n", - (unsigned) rqstp->rq_proc < - (unsigned) (sizeof names / sizeof names[0]) ? - names [rqstp->rq_proc] : "???", - (int) rqstp->rq_proc)); - - switch (rqstp->rq_proc) { - case NULLPROC: - (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); - return; - - case OPEN_CONNEX: - _xdr_argument = (xdrproc_t) xdr_open_in; - _xdr_result = (xdrproc_t) xdr_open_out; - local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc; - break; - - case SEND_SIGNAL: - _xdr_argument = (xdrproc_t) xdr_signal_in; - _xdr_result = (xdrproc_t) xdr_signal_out; - local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc; - break; - - case CLOSE_CONNEX: - _xdr_argument = (xdrproc_t) xdr_close_in; - _xdr_result = (xdrproc_t) xdr_void; - local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc; - break; - - case PTRACE: - _xdr_argument = (xdrproc_t) xdr_ptrace_in; - _xdr_result = (xdrproc_t) xdr_ptrace_out; - local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc; - break; - - case WAIT_INFO: - _xdr_argument = (xdrproc_t) xdr_wait_in; - _xdr_result = (xdrproc_t) xdr_wait_out; - local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc; - break; - - case GET_SIGNAL_NAMES: - _xdr_argument = (xdrproc_t) xdr_void; - _xdr_result = (xdrproc_t) xdr_get_signal_names_out; - local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc; - break; - - default: - svcerr_noproc (transp); - return; - } - memset ((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) { - svcerr_decode (transp); - return; - } - result = (*local)((char *)&argument, rqstp); - if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) { - svcerr_systemerr (transp); - } - if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) { - printf( "unable to free arguments"); - exit (1); - } - return; -} diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c index defadeca19..faa4989c29 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c +++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c @@ -97,7 +97,7 @@ xdr_xdr_regs (XDR *xdrs, xdr_regs *objp) return FALSE; return TRUE; } - /* + /* * Memory data for read/write text or data. The size is in data. The target * addr is in the addr field. * Be careful before modifying because this value goes into internal @@ -105,16 +105,16 @@ xdr_xdr_regs (XDR *xdrs, xdr_regs *objp) * become too small if this value gets incremented. */ bool_t xdr_xdr_mem(xdrs, objp) - XDR *xdrs; - struct xdr_mem *objp; + XDR *xdrs; + struct xdr_mem *objp; { - if (!xdr_u_long(xdrs, &objp->addr)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->dataNb)) { - return(FALSE); - } - return (xdr_opaque(xdrs, objp->data, objp->dataNb)); + if (!xdr_u_long(xdrs, &objp->addr)) { + return (FALSE); + } + if (!xdr_u_int(xdrs, &objp->dataNb)) { + return(FALSE); + } + return (xdr_opaque(xdrs, objp->data, objp->dataNb)); } bool_t @@ -262,11 +262,11 @@ xdr_KernThread (XDR *xdrs, KernThread *objp) return TRUE; } bool_t xdr_thread_list(xdrs, objp) - XDR *xdrs; - struct thread_list *objp; + XDR *xdrs; + struct thread_list *objp; { - return (xdr_array(xdrs, (char**)&objp->threads, &objp->nbThread, - UTHREAD_MAX, sizeof(KernThread), xdr_KernThread)); + return (xdr_array(xdrs, (char**)&objp->threads, &objp->nbThread, + UTHREAD_MAX, sizeof(KernThread), xdr_KernThread)); } bool_t @@ -396,7 +396,7 @@ xdr_one_arg (XDR *xdrs, one_arg *objp) return FALSE; return TRUE; } - /* now open_connex() routine which establishes a connection to server */ + /* now open_connex() routine which establishes a connection to server */ bool_t xdr_debug_type (XDR *xdrs, debug_type *objp) @@ -407,7 +407,7 @@ xdr_debug_type (XDR *xdrs, debug_type *objp) return FALSE; return TRUE; } -#define DEBUGGER_IS_GDB 0x2 /* */ +#define DEBUGGER_IS_GDB 0x2 /* */ bool_t xdr_open_in (XDR *xdrs, open_in *objp) @@ -514,7 +514,7 @@ xdr_open_out (XDR *xdrs, open_out *objp) return FALSE; return TRUE; } - /* now close_connex() routine which detaches from server */ + /* now close_connex() routine which detaches from server */ bool_t xdr_close_control (XDR *xdrs, close_control *objp) @@ -535,7 +535,7 @@ xdr_close_in (XDR *xdrs, close_in *objp) return FALSE; return TRUE; } - /* now send_signal() routine which sends signals to processes like kill(2) */ + /* now send_signal() routine which sends signals to processes like kill(2) */ bool_t xdr_signal_in (XDR *xdrs, signal_in *objp) @@ -560,7 +560,7 @@ xdr_signal_out (XDR *xdrs, signal_out *objp) return FALSE; return TRUE; } - /* now wait_info() routine which returns results of polling the wait status + /* now wait_info() routine which returns results of polling the wait status of a process/actor. It may return 0 if running, else pid or -1 */ bool_t @@ -685,8 +685,8 @@ xdr_wait_out (XDR *xdrs, wait_out *objp) return FALSE; return TRUE; } - /* now ptrace() routine. This matches the Sun UNIX ptrace as well as - some additions */ + /* now ptrace() routine. This matches the Sun UNIX ptrace as well as + some additions */ bool_t xdr_ptrace_in (XDR *xdrs, ptrace_in *objp) @@ -866,4 +866,4 @@ xdr_get_signal_names_out (XDR *xdrs, get_signal_names_out *objp) return FALSE; return TRUE; } - /* now define the actual calls we support */ + /* now define the actual calls we support */ |