1 |
106 |
markom |
/******************************************************************************
|
2 |
|
|
*
|
3 |
|
|
* The process and all routines contained herein are the
|
4 |
|
|
* property and trade secrets of AMD Inc.
|
5 |
|
|
*
|
6 |
|
|
* Except as provided for by licence agreement, this code
|
7 |
|
|
* shall not be duplicated, used or disclosed for any
|
8 |
|
|
* purpose or reason, in whole or part, without the express
|
9 |
|
|
* written consent of AMD.
|
10 |
|
|
*
|
11 |
|
|
* Copyright AMD Inc. 1991
|
12 |
|
|
*
|
13 |
|
|
*********************************************************************** MODULE
|
14 |
|
|
*
|
15 |
|
|
* $NAME @(#)udip2iss.c 1.2 91/06/14
|
16 |
|
|
* AUTHORS UDI Team Members
|
17 |
|
|
*
|
18 |
|
|
* This module implements the UDI Procedural interface
|
19 |
|
|
* for the ISS simulator.
|
20 |
|
|
********************************************************************** HISTORY
|
21 |
|
|
*
|
22 |
|
|
*
|
23 |
|
|
**************************************************************** INCLUDE FILES
|
24 |
|
|
*/
|
25 |
|
|
#include "stdio.h"
|
26 |
|
|
#include "udiproc.h"
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
/*********************************************************** UDI_GET_ERROR_MSG
|
30 |
|
|
Errors above the value ERRUDI_TIP indicate that the
|
31 |
|
|
TIP was not able to complete the request for some
|
32 |
|
|
target specific reason. The DFE uses
|
33 |
|
|
UDIGetErrorMsg() to get the descriptive text for
|
34 |
|
|
the error message which can then be displayed to
|
35 |
|
|
the user.
|
36 |
|
|
*/
|
37 |
|
|
UDIError UDIGetErrorMsg(error_code, msg)
|
38 |
|
|
UINT32 error_code; /* in */
|
39 |
|
|
UDIHostMemPtr msg; /* out -- text of msg */
|
40 |
|
|
{
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
/*************************************************************** UDI_TERMINATE
|
44 |
|
|
UDITerminate() is used to tell the TIP that the
|
45 |
|
|
DFE is finished.
|
46 |
|
|
*/
|
47 |
|
|
UDITerminate()
|
48 |
|
|
{
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
/******************************************************* UDI_GET_TARGET_CONFIG
|
52 |
|
|
UDIGetTargetConfig() gets information about the
|
53 |
|
|
target. I_mem_start/size defines the start address
|
54 |
|
|
and length of instruction RAM memory.
|
55 |
|
|
D_mem_start/size defines the start address and
|
56 |
|
|
length of instruction Data memory.
|
57 |
|
|
IR_mem_start/size defines the start address and
|
58 |
|
|
length of instruction ROM memory. coprocessor de-
|
59 |
|
|
fines the type of coprocessor present in the target
|
60 |
|
|
if any. max_breakpoints defines the maximum number
|
61 |
|
|
of breakpoints which the target can handle.
|
62 |
|
|
max_steps defines the maximum number of stepcount
|
63 |
|
|
that can be used in the UDIStep command.
|
64 |
|
|
*/
|
65 |
|
|
UDIError UDIGetTargetConfig(I_mem_start, I_mem_size, D_mem_start,
|
66 |
|
|
D_mem_size, R_mem_start, R_mem_size, cpu_prl, copro_prl)
|
67 |
|
|
UDIOffset *I_mem_start;/* out */
|
68 |
|
|
UDIOffset *I_mem_size; /* out */
|
69 |
|
|
UDIOffset *D_mem_start;/* out */
|
70 |
|
|
UDIOffset *D_mem_size; /* out */
|
71 |
|
|
UDIOffset *R_mem_start;/* out */
|
72 |
|
|
UDIOffset *R_mem_size; /* out */
|
73 |
|
|
UINT32 *cpu_prl; /* out */
|
74 |
|
|
UINT32 *copro_prl; /* out */
|
75 |
|
|
{
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
/********************************************************** UDI_CREATE_PRCOESS
|
79 |
|
|
UDICreateProcess() tells the target OS that a
|
80 |
|
|
process is to be created and gets a pID back unless
|
81 |
|
|
there is some error.
|
82 |
|
|
*/
|
83 |
|
|
UDIError UDICreateProcess(pid)
|
84 |
|
|
UDIPID *pid; /* out */
|
85 |
|
|
{
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
/********************************************************** UDI_SET_DEFALUT_PID
|
89 |
|
|
UDISetDefaultPid uses a pid supplied by
|
90 |
|
|
UDICreateProcess and sets it as the default for all
|
91 |
|
|
udi calls until a new default is set. A user of a
|
92 |
|
|
single-process OS would only have to use this once.
|
93 |
|
|
*/
|
94 |
|
|
UDIError UDISetDefaultPid(pid)
|
95 |
|
|
UDIPID pid; /* in */
|
96 |
|
|
{
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
/********************************************************* UDI_DESTROY_PROCESS
|
100 |
|
|
UDIDestroyProcess() frees a process resource pre-
|
101 |
|
|
viously created by UDICreateProcess().
|
102 |
|
|
*/
|
103 |
|
|
UDIError UDIDestroyProcess(pid)
|
104 |
|
|
UDIPID pid; /* in */
|
105 |
|
|
{
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
/****************************************************** UDI_INITIALIZE_PROCESS
|
109 |
|
|
UDIInitializeProcess() is called after the code
|
110 |
|
|
for a process has been loaded. The pid used is the
|
111 |
|
|
one set by UDISetDfaultPid. The parameter
|
112 |
|
|
text_addr defines the lowest and highest text ad-
|
113 |
|
|
dresses used by the process. The parameter
|
114 |
|
|
data_addr defines the lowest and highest data ad-
|
115 |
|
|
dresses used by the process. The paramter
|
116 |
|
|
entry_point defines the entry point of the process.
|
117 |
|
|
The parameters mem_stack_size and reg_stack size
|
118 |
|
|
define the sizes of the memory and register stacks
|
119 |
|
|
required by the process. The special value
|
120 |
|
|
UDI_DEFAULT implies that the default stack sizes
|
121 |
|
|
for the target OS should be used. The parameter
|
122 |
|
|
argstring defines a character string that will get
|
123 |
|
|
parsed into the argv array for the process. The
|
124 |
|
|
target OS will use the supplied information to set
|
125 |
|
|
up the heaps and stacks and the program arguments
|
126 |
|
|
if any. On return; the PC will be set to the entry
|
127 |
|
|
point of the process.
|
128 |
|
|
*/
|
129 |
|
|
UDIError UDIInitializeProcess( text_addr, data_addr, entry_point,
|
130 |
|
|
mem_stack_size, reg_stack_size, argstring)
|
131 |
|
|
UDIRange text_addr; /* in--lowest and highest text addrs */
|
132 |
|
|
UDIRange data_addr; /* in--lowest and highest data addrs */
|
133 |
|
|
UDIResource entry_point; /* in--process entry point */
|
134 |
|
|
CPUSizeT mem_stack_size; /* in--memory stack size */
|
135 |
|
|
CPUSizeT reg_stack_size; /* in--register stack size */
|
136 |
|
|
char* argstring; /* in--argument string used to */
|
137 |
|
|
{
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
/****************************************************************** UDI_READ
|
141 |
|
|
UDIRead() reads a block of objects from a target
|
142 |
|
|
address+space to host space. The parameter struc-
|
143 |
|
|
ture "from" specifies the address space and offset
|
144 |
|
|
of the source. The parameter "to" specifies the
|
145 |
|
|
destination address in the DFE on the host. The
|
146 |
|
|
parameter count specifies the number of objects to
|
147 |
|
|
be transferred and "size" specifies the size of
|
148 |
|
|
each object.
|
149 |
|
|
The size parameter is used by the TIP to
|
150 |
|
|
perform byte-swapping if the target is not the same
|
151 |
|
|
endian as the host. On completion; the output
|
152 |
|
|
parameter count_done is set to the number of ob-
|
153 |
|
|
jects successfully transferred.
|
154 |
|
|
*/
|
155 |
|
|
|
156 |
|
|
UDIError UDIRead (from, to, count, size, count_done, host_endian)
|
157 |
|
|
UDIResource from; /* in - source address on target */
|
158 |
|
|
UDIVoidPtr to; /* out - destination address on host */
|
159 |
|
|
UDICount count; /* in -- count of objects to be transferred */
|
160 |
|
|
UDISize size; /* in -- size of each object */
|
161 |
|
|
UDICount *count_done; /* out - count actually transferred */
|
162 |
|
|
UDIBool host_endian; /* in -- flag for endian information */
|
163 |
|
|
{
|
164 |
|
|
}
|
165 |
|
|
|
166 |
|
|
/****************************************************************** UDI_WRITE
|
167 |
|
|
UDIWrite() writes a block of objects from host
|
168 |
|
|
space to a target address+space The parameter
|
169 |
|
|
"from" specifies the source address in the DFE on
|
170 |
|
|
the host. The parameter structure "to" specifies
|
171 |
|
|
the address space and offset of the destination on
|
172 |
|
|
the target. The parameter count specifies the
|
173 |
|
|
number of objects to be transferred and "size"
|
174 |
|
|
specifies the size of each object. The size parameter
|
175 |
|
|
is used by the TIP to perform byte-swapping if
|
176 |
|
|
the target is not the same endian as the host. On
|
177 |
|
|
completion; the output parameter count_done is set
|
178 |
|
|
to the number of objects successfully transferred.
|
179 |
|
|
*/
|
180 |
|
|
UDIError UDIWrite( from, to, count, size, count_done, HostEndian )
|
181 |
|
|
UDIResource from; /* in -- destination address on host */
|
182 |
|
|
UDIResource to; /* in -- source address on target */
|
183 |
|
|
UDICount count; /* in -- count of objects to be transferred */
|
184 |
|
|
UDISize size; /* in -- size of each object */
|
185 |
|
|
UDICount *count_done; /* out - count actually transferred */
|
186 |
|
|
UDIBool HostEndian; /* in -- flag for endian information */
|
187 |
|
|
{
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
/******************************************************************** UDI_COPY
|
191 |
|
|
UDICopy() copies a block of objects from one tar-
|
192 |
|
|
get address/space to another target address/space.
|
193 |
|
|
If the source and destination overlap; the copy is
|
194 |
|
|
implemented as if a temporary buffer was used. The
|
195 |
|
|
parameter structure "from" specifies the address
|
196 |
|
|
space and offset of the destination on the target.
|
197 |
|
|
The parameter structure "to" specifies the address
|
198 |
|
|
space and offset of the destination on the target.
|
199 |
|
|
The parameter count specifies the number of objects
|
200 |
|
|
to be transferred and "size" specifies the size of
|
201 |
|
|
each object. On completion; the output parameter
|
202 |
|
|
count_done is set to the number of objects success-
|
203 |
|
|
fully transferred.
|
204 |
|
|
*/
|
205 |
|
|
UDIError UDICopy(from, to, count, size, count_done, direction )
|
206 |
|
|
UDIResource from; /* in -- destination address on target */
|
207 |
|
|
UDIResource to; /* in -- source address on target */
|
208 |
|
|
UDICount count; /* in -- count of objects to be transferred */
|
209 |
|
|
UDISize size; /* in -- size of each object */
|
210 |
|
|
UDICount *count_done; /* out - count actually transferred */
|
211 |
|
|
UDIBool direction; /* in -- high-to-low or reverse */
|
212 |
|
|
{
|
213 |
|
|
}
|
214 |
|
|
|
215 |
|
|
/***************************************************************** UDI_EXECUTE
|
216 |
|
|
UDIExecute() continues execution of the default
|
217 |
|
|
process from the current PC.
|
218 |
|
|
*/
|
219 |
|
|
UDIError UDIExecute()
|
220 |
|
|
{
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
/******************************************************************** UDI_STEP
|
224 |
|
|
UDIStep() specifies a number of "instruction"
|
225 |
|
|
steps to make. The step can be further qualified
|
226 |
|
|
to state whether CALLs should or should not be
|
227 |
|
|
stepped over; whether TRAPs should or should not be
|
228 |
|
|
stepped over; and whether stepping should halt when
|
229 |
|
|
the PC gets outside a certain range. The semantics
|
230 |
|
|
of UDIStep imply that progress is made; ie; at
|
231 |
|
|
least one instruction is executed before traps or
|
232 |
|
|
interrupts are handled.
|
233 |
|
|
*/
|
234 |
|
|
UDIError UDIStep(steps, steptype, range)
|
235 |
|
|
UINT32 steps; /* in -- number of steps */
|
236 |
|
|
UDIStepType steptype; /* in -- type of stepping to be done */
|
237 |
|
|
UDIRange range; /* in -- range if StepInRange is TRUE */
|
238 |
|
|
{
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
/******************************************************************** UDI_STOP
|
242 |
|
|
UDIStop() stops the default process
|
243 |
|
|
*/
|
244 |
|
|
UDIError UDIStop(stop_pc)
|
245 |
|
|
UDIResource *stop_pc; /* out -- value of PC where we stopped */
|
246 |
|
|
{
|
247 |
|
|
}
|
248 |
|
|
|
249 |
|
|
/******************************************************************** UDI_WAIT
|
250 |
|
|
UDIWait() returns the state of the target proces-
|
251 |
|
|
sor. The TIP is expected to return when the target
|
252 |
|
|
state is no longer RUNNING or when maxtime mil-
|
253 |
|
|
liseconds have elapsed; whichever comes first. The
|
254 |
|
|
special maxtime value UDI_WAIT_FOREVER essentially
|
255 |
|
|
means that the DFE blocks until the target is no
|
256 |
|
|
longer RUNNING. On completion; pid is used to re-
|
257 |
|
|
port which process stopped (necessary for multi-
|
258 |
|
|
process targets). On completion; stop_pc is usual-
|
259 |
|
|
ly set to the PC where execution stopped.
|
260 |
|
|
|
261 |
|
|
The return status STDIN_NEEDED allows the TIP to
|
262 |
|
|
tell the DFE that the target program is requesting
|
263 |
|
|
input and the TIP's own internal buffer of
|
264 |
|
|
charcters is empty. The DFE can inform the user of
|
265 |
|
|
this situation if it desires.
|
266 |
|
|
|
267 |
|
|
Possible states are:
|
268 |
|
|
NOT EXECUTING
|
269 |
|
|
RUNNING
|
270 |
|
|
STOPPED (due to UDIStop)
|
271 |
|
|
BREAK (breakpoint hit)
|
272 |
|
|
STEPPED (completed number of steps requested by UDIStep)
|
273 |
|
|
WAITING (wait mode bit set)
|
274 |
|
|
HALTED (at a halt instruction)
|
275 |
|
|
WARNED (not executing because WARN line asserted)
|
276 |
|
|
TRAPPED (invalid trap taken; indicates trap number)
|
277 |
|
|
STDOUT_READY (stopped waiting for stdout to be output)
|
278 |
|
|
STDERR_READY (stopped waiting for stderr to be output)
|
279 |
|
|
STDIN_NEEDED (stopped waiting for stdin to be supplied)
|
280 |
|
|
*/
|
281 |
|
|
UDIError UDIWait(maxtime, pid, stop_reason)
|
282 |
|
|
INT32 maxtime; /* in -- maximum time to wait for completion */
|
283 |
|
|
UDIPID *pid; /* out -- pid of process which stopped if any */
|
284 |
|
|
UINT32 *stop_reason; /* out -- PC where process stopped */
|
285 |
|
|
{
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
/********************************************************** UDI_SET_BREAKPOINT
|
289 |
|
|
UDISetBreakpoint() sets a breakpoint at an ad-
|
290 |
|
|
dress and uses the passcount to state how many
|
291 |
|
|
times that instruction should be hit before the
|
292 |
|
|
break occurs. The passcount continues to count
|
293 |
|
|
down; even if a different breakpoint is hit and is
|
294 |
|
|
reinitialized only when this breakpoint is hit. A
|
295 |
|
|
passcount value of 0 indicates a non-sticky break-
|
296 |
|
|
point that will be removed whenever execution
|
297 |
|
|
stops.
|
298 |
|
|
*/
|
299 |
|
|
UDIError UDISetBreakpoint (addr, passcount, type)
|
300 |
|
|
UDIResource addr; /* in -- where breakpoint gets set */
|
301 |
|
|
INT32 passcount; /* in -- passcount for breakpoint */
|
302 |
|
|
UDIBreakType type; /* in -- breakpoint type */
|
303 |
|
|
{
|
304 |
|
|
}
|
305 |
|
|
|
306 |
|
|
/******************************************************** UDI_QUERY_BREAKPOINT
|
307 |
|
|
*/
|
308 |
|
|
UDIError UDIQueryBreakpoint (addr, count)
|
309 |
|
|
UDIResource addr; /* in -- where breakpoint gets set */
|
310 |
|
|
UINT32 *count; /* out - passcount for breakpoint */
|
311 |
|
|
{
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
/******************************************************** UDI_CLEAR_BREAKPOINT
|
315 |
|
|
UDIClearBreakpoint() is used to clear a break-
|
316 |
|
|
point.
|
317 |
|
|
*/
|
318 |
|
|
UDIError UDIClearBreakpoint (addr)
|
319 |
|
|
UDIResource addr; /* in -- which breakpoint to clear */
|
320 |
|
|
{
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
/************************************************************** UDI_GET_STDOUT
|
324 |
|
|
UDIGetStdout() is called when a call to
|
325 |
|
|
UDIWait() returns with the status STDOUT_READY.
|
326 |
|
|
The parameter "buf" specifies the DFE's buffer ad-
|
327 |
|
|
dress which is expected to be filled by the TIP.
|
328 |
|
|
The parameter "bufsize" specifies the size of this
|
329 |
|
|
buffer. On return; count_done is set to the number
|
330 |
|
|
of bytes actually written to buf. The DFE should
|
331 |
|
|
keep calling UDIGetStdout() until count_done is
|
332 |
|
|
less than bufsize.
|
333 |
|
|
*/
|
334 |
|
|
UDIError UDIGetStdout(buf, bufsize, count_done)
|
335 |
|
|
UDIHostMemPtr buf; /* out -- buffer to be filled */
|
336 |
|
|
CPUSizeT bufsize; /* in -- buffer size in bytes */
|
337 |
|
|
CPUSizeT *count_done; /* out -- number of bytes written to buf */
|
338 |
|
|
{
|
339 |
|
|
}
|
340 |
|
|
|
341 |
|
|
/************************************************************** UDI_GET_STDERR
|
342 |
|
|
UDIGetStderr() is called when a call to
|
343 |
|
|
UDIWait() returns with the status STDERR_READY.
|
344 |
|
|
In other respects it is similar to
|
345 |
|
|
UDIGetStdout().
|
346 |
|
|
*/
|
347 |
|
|
UDIError UDIGetStderr(buf, bufsize, count)
|
348 |
|
|
UDIHostMemPtr buf; /* out -- buffer to be filled */
|
349 |
|
|
UINT32 bufsize; /* in -- buffer size in bytes */
|
350 |
|
|
INT32 *count; /* out -- number of bytes written to buf */
|
351 |
|
|
{
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
/*************************************************************** UDI_PUT_STDIN
|
355 |
|
|
UDIPutStdin() is called whenever the DFE wants to
|
356 |
|
|
deliver an input character to the TIP. This may be
|
357 |
|
|
in response to a status STDIN_NEEDED but need not
|
358 |
|
|
be. (Some target operating systems will never
|
359 |
|
|
block for input). Any buffering and line editing
|
360 |
|
|
of the stdin characters is done under control of
|
361 |
|
|
the TIP.
|
362 |
|
|
*/
|
363 |
|
|
INT32 UDIPutStdin (buf, bufsize, count)
|
364 |
|
|
UDIHostMemPtr buf; /* out - buffer to be filled */
|
365 |
|
|
UINT32 bufsize; /* in -- buffer size in bytes */
|
366 |
|
|
INT32 *count; /* out - number of bytes written to buf */
|
367 |
|
|
{
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
/*************************************************************** UDI_PUT_TRANS
|
371 |
|
|
UDIPutTrans() is used to feed input to the pass-
|
372 |
|
|
thru mode. The parameter "buf" is points to the
|
373 |
|
|
input data in DFE memory. The parameter "count"
|
374 |
|
|
specifies the number of bytes.
|
375 |
|
|
*/
|
376 |
|
|
INT32 UDIPutTrans (buf, count)
|
377 |
|
|
UDIHostMemPtr buf; /* in -- buffer address containing input data */
|
378 |
|
|
CPUSizeT count; /* in -- number of bytes in buf */
|
379 |
|
|
{
|
380 |
|
|
}
|
381 |
|
|
|
382 |
|
|
/*************************************************************** UDI_GET_TRANS
|
383 |
|
|
UDIGetTrans() is used to get output lines from the
|
384 |
|
|
pass-thru mode The parameter "buf" specifies to the
|
385 |
|
|
buffer to be filled in DFE space. "bufsize" speci-
|
386 |
|
|
fies the size of the buffer and; on return, "count"
|
387 |
|
|
is set to the number of bytes put in the buffer.
|
388 |
|
|
The DFE should continue to call UDIGetTrans() un-
|
389 |
|
|
til count is less than bufsize. Other possible re-
|
390 |
|
|
turn values are:
|
391 |
|
|
EOF -- leave transparent mode
|
392 |
|
|
UDI_GET_INPUT -- host should get some in-
|
393 |
|
|
put; then call
|
394 |
|
|
UDIPutTrans().
|
395 |
|
|
*/
|
396 |
|
|
INT32 UDIGetTrans (buf, bufsize, count)
|
397 |
|
|
UDIHostMemPtr buf; /* out -- buffer to be filled */
|
398 |
|
|
CPUSizeT bufsize; /* in -- size of buf */
|
399 |
|
|
CPUSizeT *count; /* out -- number of bytes in buf */
|
400 |
|
|
{
|
401 |
|
|
}
|