📄 udip2iss.c
字号:
/******************************************************************************* * The process and all routines contained herein are the* property and trade secrets of AMD Inc. * * Except as provided for by licence agreement, this code * shall not be duplicated, used or disclosed for any * purpose or reason, in whole or part, without the express * written consent of AMD.* * Copyright AMD Inc. 1991************************************************************************ MODULE* * $NAME @(#)udip2iss.c 1.2 91/06/14* AUTHORS UDI Team Members* * This module implements the UDI Procedural interface* for the ISS simulator.********************************************************************** HISTORY****************************************************************** INCLUDE FILES*/#include "stdio.h"#include "udiproc.h"/*********************************************************** UDI_GET_ERROR_MSG Errors above the value ERRUDI_TIP indicate that the TIP was not able to complete the request for some target specific reason. The DFE uses UDIGetErrorMsg() to get the descriptive text for the error message which can then be displayed to the user.*/UDIError UDIGetErrorMsg(error_code, msg)UINT32 error_code; /* in */UDIHostMemPtr msg; /* out -- text of msg */{}/*************************************************************** UDI_TERMINATE UDITerminate() is used to tell the TIP that the DFE is finished.*/UDITerminate(){}/******************************************************* UDI_GET_TARGET_CONFIG UDIGetTargetConfig() gets information about the target. I_mem_start/size defines the start address and length of instruction RAM memory. D_mem_start/size defines the start address and length of instruction Data memory. IR_mem_start/size defines the start address and length of instruction ROM memory. coprocessor de- fines the type of coprocessor present in the target if any. max_breakpoints defines the maximum number of breakpoints which the target can handle. max_steps defines the maximum number of stepcount that can be used in the UDIStep command.*/UDIError UDIGetTargetConfig(I_mem_start, I_mem_size, D_mem_start, D_mem_size, R_mem_start, R_mem_size, cpu_prl, copro_prl)UDIOffset *I_mem_start;/* out */UDIOffset *I_mem_size; /* out */UDIOffset *D_mem_start;/* out */UDIOffset *D_mem_size; /* out */UDIOffset *R_mem_start;/* out */UDIOffset *R_mem_size; /* out */UINT32 *cpu_prl; /* out */UINT32 *copro_prl; /* out */{}/********************************************************** UDI_CREATE_PRCOESS UDICreateProcess() tells the target OS that a process is to be created and gets a pID back unless there is some error.*/UDIError UDICreateProcess(pid)UDIPID *pid; /* out */{}/********************************************************** UDI_SET_DEFALUT_PID UDISetDefaultPid uses a pid supplied by UDICreateProcess and sets it as the default for all udi calls until a new default is set. A user of a single-process OS would only have to use this once.*/UDIError UDISetDefaultPid(pid)UDIPID pid; /* in */{}/********************************************************* UDI_DESTROY_PROCESS UDIDestroyProcess() frees a process resource pre- viously created by UDICreateProcess().*/UDIError UDIDestroyProcess(pid)UDIPID pid; /* in */{}/****************************************************** UDI_INITIALIZE_PROCESS UDIInitializeProcess() is called after the code for a process has been loaded. The pid used is the one set by UDISetDfaultPid. The parameter text_addr defines the lowest and highest text ad- dresses used by the process. The parameter data_addr defines the lowest and highest data ad- dresses used by the process. The paramter entry_point defines the entry point of the process. The parameters mem_stack_size and reg_stack size define the sizes of the memory and register stacks required by the process. The special value UDI_DEFAULT implies that the default stack sizes for the target OS should be used. The parameter argstring defines a character string that will get parsed into the argv array for the process. The target OS will use the supplied information to set up the heaps and stacks and the program arguments if any. On return; the PC will be set to the entry point of the process.*/UDIError UDIInitializeProcess( text_addr, data_addr, entry_point, mem_stack_size, reg_stack_size, argstring)UDIRange text_addr; /* in--lowest and highest text addrs */UDIRange data_addr; /* in--lowest and highest data addrs */UDIResource entry_point; /* in--process entry point */CPUSizeT mem_stack_size; /* in--memory stack size */CPUSizeT reg_stack_size; /* in--register stack size */char* argstring; /* in--argument string used to */{}/****************************************************************** UDI_READ UDIRead() reads a block of objects from a target address+space to host space. The parameter struc- ture "from" specifies the address space and offset of the source. The parameter "to" specifies the destination address in the DFE on the host. The parameter count specifies the number of objects to be transferred and "size" specifies the size of each object. The size parameter is used by the TIP to perform byte-swapping if the target is not the same endian as the host. On completion; the output parameter count_done is set to the number of ob- jects successfully transferred.*/UDIError UDIRead (from, to, count, size, count_done, host_endian)UDIResource from; /* in - source address on target */UDIVoidPtr to; /* out - destination address on host */UDICount count; /* in -- count of objects to be transferred */UDISize size; /* in -- size of each object */UDICount *count_done; /* out - count actually transferred */UDIBool host_endian; /* in -- flag for endian information */{}/****************************************************************** UDI_WRITE UDIWrite() writes a block of objects from host space to a target address+space The parameter "from" specifies the source address in the DFE on the host. The parameter structure "to" specifies the address space and offset of the destination on the target. The parameter count specifies the number of objects to be transferred and "size" specifies the size of each object. The size parameter is used by the TIP to perform byte-swapping if the target is not the same endian as the host. On completion; the output parameter count_done is set to the number of objects successfully transferred.*/UDIError UDIWrite( from, to, count, size, count_done, HostEndian )UDIResource from; /* in -- destination address on host */UDIResource to; /* in -- source address on target */UDICount count; /* in -- count of objects to be transferred */UDISize size; /* in -- size of each object */UDICount *count_done; /* out - count actually transferred */UDIBool HostEndian; /* in -- flag for endian information */{}/******************************************************************** UDI_COPY UDICopy() copies a block of objects from one tar- get address/space to another target address/space. If the source and destination overlap; the copy is implemented as if a temporary buffer was used. The parameter structure "from" specifies the address space and offset of the destination on the target. The parameter structure "to" specifies the address space and offset of the destination on the target. The parameter count specifies the number of objects to be transferred and "size" specifies the size of each object. On completion; the output parameter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -