rmoncmds.c
5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* ==========================================================================
* Copyright (c) 1994, Silicon Graphics, Inc. All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied
* or duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc. handleSelectExceptions
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished
* rights reserved under the Copyright Laws of the United States.
* ==========================================================================
*/
/************************************************************************
Program: rmon (reality monitor) in-circuit target monitor
File: cmds.c
Author: Kenneth F. Greenberg
Purpose: The command dispatcher/interpreter
Revision history:
94.10.21 Original
************************************************************************/
#ifndef _FINALROM
#include "dbgdefs.h" /* definitions needed by the following file */
#include "dbgproto.h" /* standard protocol definitions */
#include "rmonint.h" /* needs info in above files */
/************************************************************************
Function: (static) NotImplemented
Args: KKHeader * request - not used but declared for compatibility
Type: int - returns ILLEGAL_CALL always.
Purpose: This function is a placeholder in the dispatch table for
standard commands provided in the protocol but not implemented
in the Reality system.
************************************************************************/
static int NotImplemented( KKHeader * dummy )
{
return TV_ERROR_ILLEGAL_CALL;
}
static FUNPTR dispatchTable[] = {
__rmonLoadProgram, /* cmd 0 */
__rmonListProcesses, /* cmd 1 */
__rmonGetExeName, /* cmd 2 */
__rmonListThreads, /* cmd 3 */
__rmonThreadStatus, /* cnd 4 */
NotImplemented, /* _KK_REQ_STOPPROC */
__rmonStopThread, /* cmd 6 */
__rmonRunThread, /* cmd 7 */
NotImplemented, /* _KK_REQ_RUNPROC */
NotImplemented, /* _KK_REQ_KILLPROC */
__rmonSetFault, /* cmd 10 */
NotImplemented, /* _KK_REQ_GETFAULT */
__rmonGetRegionCount, /* cmd 12 */
__rmonGetRegions, /* cmd 13 */
__rmonGetGRegisters, /* cmd 14 */
__rmonSetGRegisters, /* cmd 15 */
__rmonGetFRegisters, /* cmd 16 */
__rmonSetFRegisters, /* cmd 17 */
__rmonReadMem, /* cmd 18 */
__rmonWriteMem, /* cmd 19 */
__rmonSetBreak, /* cmd 20 */
__rmonClearBreak, /* cmd 21 */
__rmonListBreak, /* cmd 22 */
NotImplemented, /* _KK_REQ_NUMWATCH */
NotImplemented, /* _KK_REQ_SETWATCH */
NotImplemented, /* _KK_REQ_GETWATCH */
NotImplemented, /* _KK_REQ_USAGE */
NotImplemented, /* _KK_REQ_GETPATHLIST */
NotImplemented, /* _KK_REQ_GETFRAME */
NotImplemented, /* _KK_REQ_REBOOT */
__rmonSetComm, /* cmd 30 */
NotImplemented, /* _KK_REQ_SETSYSENTRY */
NotImplemented, /* _KK_REQ_GETSYSENTRY */
NotImplemented, /* _KK_REQ_SETSYSEXIT */
NotImplemented, /* _KK_REQ_GETSYSEXIT */
NotImplemented, /* _KK_REQ_ENABLELOG */
NotImplemented, /* _KK_REQ_DISABLELOG */
NotImplemented, /* _KK_REQ_FLUSHLOG */
NotImplemented, /* _KK_REQ_NEWLOG */
NotImplemented, /* _KK_REQ_GETMASK */
NotImplemented, /* _KK_REQ_AMCMD */
NotImplemented, /* _KK_REQ_REMOTE */
NotImplemented, /* _KK_REQ_LOGCONTROL */
NotImplemented, /* _KK_REQ_LOGSTATUS */
NotImplemented, /* _KK_REQ_GETLOGFILE */
NotImplemented, /* _KK_REQ_GETSYSUSAGE */
NotImplemented, /* _KK_REQ_SETTRPT */
NotImplemented, /* _KK_REQ_CLRTRPT */
NotImplemented, /* _KK_REQ_LISTTRPTS */
__rmonGetSRegs, /* cmd 49 */
__rmonSetSRegs, /* _KK_REQ_SETSREGSET */
__rmonGetVRegs, /* _KK_REQ_GETVREGSET */
__rmonSetVRegs, /* _KK_REQ_SETVREGSET */
/* A bunch of missing ones we don't handle */
NotImplemented /* _KK_REQ_COUNT */
};
/************************************************************************
Function: rmonExecute
Args: KKHeader * request - address of the standard protocol structure for
all commands from the host
Type: int - returns whatever status the called function returns
Purpose: This function dispatches a method to execute the requested
host command and returns its status. The called function should
only return a negative error code if it wants this function to
respond to dbgif. Normally, it returns 0. A return of 1 causes
the application to run.
************************************************************************/
int __rmonExecute( KKHeader * request )
{
int retval;
KKHeader reply;
if ( request->code > _KK_REQ_SETVREGSET )
return TV_ERROR_ILLEGAL_CALL;
if ( (retval = (*dispatchTable[ request->code ])( request )) < 0 )
{
/* Send the generic "Huh?" command */
reply.code = request->code;
reply.error = retval;
__rmonSendReply( (KKHeader * const) &reply, sizeof( KKHeader ), _KK_REPLY );
}
return retval;
}
#endif /* #ifndef _FINALROM */