📄 mini2udi.c
字号:
static char _[] = "@(#)mini2udi.c 5.23 93/08/18 13:48:08, Srini, AMD. ";/****************************************************************************** * Copyright 1991 Advanced Micro Devices, Inc. * * This software is the property of Advanced Micro Devices, Inc (AMD) which * specifically grants the user the right to modify, use and distribute this * software provided this notice is not removed or altered. All other rights * are reserved by AMD. * * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS * SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR * USE OF THIS SOFTWARE. * * So that all may benefit from your experience, please report any problems * or suggestions about this software to the 29K Technical Support Center at * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or * 0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118. * * Advanced Micro Devices, Inc. * 29K Support Products * Mail Stop 573 * 5900 E. Ben White Blvd. * Austin, TX 78741 * 800-292-9263 ***************************************************************************** * Engineer: Srini Subramanian. ***************************************************************************** * Definitions of the functions that define Minimon's Interface * to the UDI * interface The minimon functions are declared in miniint.h The UDI * functions are declared in udi/udiproc.h ***************************************************************************** */#include <stdio.h>#ifdef MSDOS#include <io.h>#endif#include <string.h>#include "main.h"#include "memspcs.h"#include "macros.h"#include "miniint.h"#include "udiproc.h"#include "udiids.h"#include "udiext.h"#include "versions.h"/* Define BreakIdType here to avoid having to change at many places * every time it changes. */typedef unsigned int BreakIdType;/* ABOUT UDI calls: * There are three types of return values: * < 0: means a TIP failure. * = 0: means success. * > 0: means a "local" failure. */static UDISessionId SessionID;static char MONErrorMsg[MONErrorMsgSize];static int GoForever=0;static char *udi_errmsg[] = {/*#define UDINoError 0*/ "UDIERR: No Error",/*#define UDIErrorNoSuchConfiguration 1*/ "UDIERR: No Such Configuration in Config File.",/*#define UDIErrorCantHappen 2*/ "UDIERR: Cannot Happen With Current Environment Setup.",/*#define UDIErrorCantConnect 3*/ "UDIERR: Cannot Connect to TIP Specified.",/*#define UDIErrorNoSuchConnection 4*/ "UDIERR: No Such Connection Found.",/*#define UDIErrorNoConnection 5*/ "UDIERR: No Connection Occurred.",/*#define UDIErrorCantOpenConfigFile 6*/ "UDIERR: Cannot Open UDI Config File.",/*#define UDIErrorCantStartTIP 7*/ "UDIERR: Cannot Start TIP In Current Environment Setup.",/*#define UDIErrorConnectionUnavailable 8*/ "UDIERR: Requested Connection Unavailable.",/*#define UDIErrorTryAnotherTIP 9*/ "UDIERR: Try Another TIP For Connection.",/*#define UDIErrorExecutableNotTIP 10*/ "UDIERR: TIP Specified in Config File Not An Executable.",/*#define UDIErrorInvalidTIPOption 11*/ "UDIERR: Connection Failed Due To Invalid TIP Options in Config File.",/*#define UDIErrorCantDisconnect 12*/ "UDIERR: Cannot Disconnect TIP",/*#define UDIErrorUnknownError 13*/ "UDIERR: Unknown Error Number Specified.",/*#define UDIErrorCantCreateProcess 14*/ "UDIERR: TIP Cannot Create a New Process.",/*#define UDIErrorNoSuchProcess 15*/ "UDIERR: No Such Process in the Current TIP.",/*#define UDIErrorUnknownResourceSpace 16*/ "UDIERR: Unknown Resource Space Encountered By TIP.",/*#define UDIErrorInvalidResource 17*/ "UDIERR: Invalid Resource Specified To TIP.",/*#define UDIErrorUnsupportedStepType 18*/ "UDIERR: Unsupported Step Type For This TIP Specified.",/*#define UDIErrorCantSetBreakpoint 19*/ "UDIERR: Could Not Set The Breakpoint.",/*#define UDIErrorTooManyBreakpoints 20*/ "UDIERR: Too Many Breakpoints Already In Use.",/*#define UDIErrorInvalidBreakId 21*/ "UDIERR: Breakpoint Does Not Exist For This BreakId.",/*#define UDIErrorNoMoreBreakIds 22*/ "UDIERR: No More Breakpoints. BreakId Too High.",/*#define UDIErrorUnsupportedService 23*/ "UDIERR: TIP Does Not Support The Requested Service.",/*#define UDIErrorTryAgain 24*/ "UDIERR: Error Occurred. Trying Again.",/*#define UDIErrorIPCLimitation 25*/ "UDIERR: IPC Limitation Exceeded.",/*#define UDIErrorIncomplete 26*/ "UDIERR: Service Incomplete.More Data Available.",/*#define UDIErrorAborted 27*/ "UDIERR: Aborted Requested Service.",/*#define UDIErrorTransDone 28*/ "UDIERR: Transaction Completed.",/*#define UDIErrorCantAccept 29*/ "UDIERR: Cannot Accept.",/*#define UDIErrorTransInputNeeded 30*/ "UDIERR: Transaction Input Needed.",/*#define UDIErrorTransModeX 31*/ "UDIERR: Transaction ModeX",/*#define UDIErrorInvalidSize 32*/ "UDIERR: Invalid Object Size Specified.",/*#define UDIErrorBadConfigFileEntry 33*/ "UDIERR: Bad Entry In UDI Config File Found.",/*#define UDIErrorIPCInternal 34*/ "UDIERR: Internal Error Occurred In IPC Layer."};static UDIPId CurrentPID=(UDIPId) UDIProcessProcessor;static void PrintErrorMessage PARAMS((UDIError num));static void udi_warning PARAMS((int num));static CPUSpace xlate_mspace_mon2udi PARAMS((INT32 mspace));static INT32 xlate_mspace_udi2mon PARAMS((CPUSpace mspace));static UDIError FillString PARAMS(( UDIResource from, UDIHostMemPtr pattern, UDISizeT pattern_count, UDICount fill_count));static UDIError FillWords PARAMS(( UDIResource from, UDIHostMemPtr pattern, UDISizeT pattern_count, UDICount fill_count));INT32/*********************************************Mini_TIP_init */Mini_TIP_init(connect_string, mon_session_id) char *connect_string; int *mon_session_id;{ UDIError UDIretval; UDISessionId session; /* First connect the target */ if ((UDIretval = UDIConnect(connect_string, &session)) <= TIPFAILURE) { SessionID = session; *mon_session_id = (int) session; PrintErrorMessage (UDIretval); return ((INT32) UDIretval); } else if (UDIretval == SUCCESS) { SessionID = session; *mon_session_id = (int) session; return (SUCCESS); } else { SessionID = session; *mon_session_id = (int) session; udi_warning(UDIretval); return((INT32) UDIretval); };}INT32Mini_TIP_Capabilities(){ UDIError UDIretval; UDIUInt32 TIPId; /* Out */ UDIUInt32 TargetId; /* Out */ UDIUInt32 DFEId; /* In */ UDIUInt32 DFE; /* In */ UDIUInt32 TIP; /* Out */ UDIUInt32 DFEIPCId; /* Out */ UDIUInt32 TIPIPCId; /* Out */ char TIPString[80]; /* Out */ (void) strcpy (TIPString,""); DFEId = (UDIUInt32) UDIID (UDIProductCode_Mondfe, MONDFERev, MONDFESubRev, MONDFESubSubRev); DFE = (UDIUInt32) MONDFEUDIVers; if ((UDIretval = UDICapabilities ( &TIPId, &TargetId, DFEId, DFE, &TIP, &DFEIPCId, &TIPIPCId, &TIPString[0])) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { if (!QuietMode) { if (io_config.echo_mode == (INT32) TRUE) { fprintf(io_config.echo_file, "MiniMON29K Release 3.0\n"); fprintf(io_config.echo_file, ">AMD MONDFE Version: %d.%d.%d", (int) ((DFEId & 0x00000F00) >> 8), (int) ((DFEId & 0x000000F0) >> 4), (int) ((DFEId & 0x0000000F) >> 0)); fprintf(io_config.echo_file, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d <\n", (int) ((DFEIPCId & 0x00000F00) >> 8), (int) ((DFEIPCId & 0x000000F0) >> 4), (int) ((DFEIPCId & 0x0000000F) >> 0), (int) ((DFE & 0x00000F00) >> 8), (int) ((DFE & 0x000000F0) >> 4), (int) ((DFE & 0x0000000F) >> 0)); fprintf(io_config.echo_file, "%s\n", TIPString); fprintf(io_config.echo_file, ">TIP Version: %d.%d.%d", (int) ((TIPId & 0x00000F00) >> 8), (int) ((TIPId & 0x000000F0) >> 4), (int) ((TIPId & 0x0000000F) >> 0)); fprintf(io_config.echo_file, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d<\n", (int) ((TIPIPCId & 0x00000F00) >> 8), (int) ((TIPIPCId & 0x000000F0) >> 4), (int) ((TIPIPCId & 0x0000000F) >> 0), (int) ((TIP & 0x00000F00) >> 8), (int) ((TIP & 0x000000F0) >> 4), (int) ((TIP & 0x0000000F) >> 0)); } fprintf(stderr, "MiniMON29K Release 3.0\n"); fprintf(stderr, ">AMD MONDFE Version: %d.%d.%d", (int) ((DFEId & 0x00000F00) >> 8), (int) ((DFEId & 0x000000F0) >> 4), (int) ((DFEId & 0x0000000F) >> 0)); fprintf(stderr, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d <\n", (int) ((DFEIPCId & 0x00000F00) >> 8), (int) ((DFEIPCId & 0x000000F0) >> 4), (int) ((DFEIPCId & 0x0000000F) >> 0), (int) ((DFE & 0x00000F00) >> 8), (int) ((DFE & 0x000000F0) >> 4), (int) ((DFE & 0x0000000F) >> 0)); fprintf(stderr, "%s\n", TIPString); fprintf(stderr, ">TIP Version: %d.%d.%d", (int) ((TIPId & 0x00000F00) >> 8), (int) ((TIPId & 0x000000F0) >> 4), (int) ((TIPId & 0x0000000F) >> 0)); fprintf(stderr, "\tIPC Version: %d.%d.%d UDI Rev. %d.%d.%d<\n", (int) ((TIPIPCId & 0x00000F00) >> 8), (int) ((TIPIPCId & 0x000000F0) >> 4), (int) ((TIPIPCId & 0x0000000F) >> 0), (int) ((TIP & 0x00000F00) >> 8), (int) ((TIP & 0x000000F0) >> 4), (int) ((TIP & 0x0000000F) >> 0)); } if ( (int) ((TIPId & 0x00000F00) >> 8) < (int) ((DFEId & 0x00000F00) >> 8) ) { fprintf(stderr, "!!!!! WARNING: MONTIP's major version number is older than that of MONDFE's !!!!!\n"); fprintf(stderr, "!!!!! Please verify the versions and call AMD 29K Technical Support for assistance. !!!!!\n"); } if ((TIP == (UDIUInt32) 0) || ((TIP & 0xFFF) > (DFE & 0xFFF))) { fprintf(stderr, "UDI WARNING: UDI Versions NOT Compatible.\n"); } if (TIP == (UDIUInt32) 0) return (FAILURE); return (SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); }}INT32Mini_TIP_CreateProc(){ UDIError UDIretval; UDIPId pid; if ((UDIretval = UDICreateProcess(&pid)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { CurrentPID = pid; return (SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); }}INT32Mini_TIP_disc(){ UDIError UDIretval; if ((UDIretval = UDIDisconnect(SessionID, UDIContinueSession)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { return(SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); };}INT32Mini_TIP_SetCurrSession(sid)int sid;{ UDIError UDIretval; if ((UDIretval = UDISetCurrentConnection((UDISessionId) sid)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { SessionID = (UDISessionId) sid; return (SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); }}INT32Mini_TIP_SetPID(pid)int pid;{ UDIError UDIretval; if ((UDIretval = UDISetCurrentProcess((UDIPId) pid)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { return (SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); }}INT32Mini_TIP_DestroyProc(){ UDIError UDIretval; if ((UDIretval = UDIDestroyProcess(CurrentPID)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { return (SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); }}INT32Mini_TIP_exit(){ UDIError UDIretval; if ((UDIretval = UDIDisconnect(SessionID, UDITerminateSession)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { return(SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); };}/* Breakpoint routines *//* Remove breakpoint */INT32/*******************************************Mini_bkpt_rm */Mini_bkpt_rm(break_id)int break_id;{ UDIError UDIretval; if ((UDIretval = UDIClearBreakpoint ((BreakIdType) break_id)) <= TIPFAILURE) { PrintErrorMessage (UDIretval); return (FAILURE); } else if (UDIretval == SUCCESS) { return(SUCCESS); } else { udi_warning(UDIretval); return(FAILURE); };}/* Set Breakpoints */INT32/**********************************************Mini_bkpt_set */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -