Browse Source
NLMCONV_FOR_TARGET. (SUBDIRS): Add nlm target.
* configure.in (powerpc-*-netware*): Automatically configure nlm
subdir.
* nlm/Makefile.in: Add {CC NLMCONV LD}_FOR_TARGET. Remove alpha
specific stuff. Make things more configurable.
* nlm/configure.in: Add powerpc-*-netware* target. Use
gdbserve.mt/cpu.c/cpu.h for target stuff. Get rid of tm/xm/nm.h
files.
* nlm/gdbserve.c: Move Alpha specific stuff into other files.
Remove lots of architecture-specific stuff.
* nlm/gdbserve.def: Add new imports.
* nlm/ppc.c, nlm/ppc.h: New files that contain PowerPC specific code.
* nlm/prelude.c: Don't include libhooks.h, get rid of call to
register library.
* nlm/prelude.o: What was this doing here?
gdb-4_18-branch
15 changed files with 1572 additions and 298 deletions
@ -0,0 +1,636 @@ |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* NetWare 386 Developer's Asynchronous I/O (AIO) Runtime library * |
|||
* * |
|||
* This include file defines the constants and prototypes required * |
|||
* to use the AIO application interface. * |
|||
* * |
|||
* (c) Copyright. 1991 Novell, Inc. All rights reserved. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef unsigned long DWORD; |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Predefined hardware types for use with the AIOAcquirePort function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_COMX_TYPE (1) |
|||
#define AIO_ARTIC_TYPE (2) |
|||
#define AIO_WNIM_TYPE (3) |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Function completion code status values. * |
|||
* * |
|||
* Note that all error statuses are negative values. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_SUCCESS (0) |
|||
#define AIO_BAD_HANDLE (-1) |
|||
#define AIO_FAILURE (-2) |
|||
#define AIO_FUNC_NOT_SUPPORTED (-3) |
|||
#define AIO_INVALID_PARAMETER (-5) |
|||
#define AIO_PORT_NOT_AVAILABLE (-6) |
|||
#define AIO_QUALIFIED_SUCCESS (-7) |
|||
#define AIO_NO_MORE_PORTS (-8) |
|||
#define AIO_TYPE_NUMBER_INVALID (-10) |
|||
#define AIO_BOARD_NUMBER_INVALID (-11) |
|||
#define AIO_PORT_NUMBER_INVALID (-12) |
|||
#define AIO_RESOURCE_TAG_INVALID (-13) |
|||
#define AIO_DATA_PRESENT (-14) |
|||
#define AIO_BAD_REQUEST_TYPE (-15) |
|||
#define AIO_PORT_GONE (-20) |
|||
#define AIO_RTAG_INVALID (-21) |
|||
|
|||
|
|||
/* This is only for non-CLIB application */ |
|||
|
|||
#define ASYNCIOSignature 0x4E595341 /* 'NYSA' */ |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOSetExternalControl function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_EXTERNAL_CONTROL (1) |
|||
#define AIO_EXTCTRL_DTR (1) |
|||
#define AIO_EXTCTRL_RTS (2) |
|||
|
|||
|
|||
#define AIO_BREAK_CONTROL (2) |
|||
#define AIO_SET_BREAK_OFF (0) |
|||
#define AIO_SET_BREAK_ON (1) |
|||
|
|||
|
|||
#define AIO_FLOW_CONTROL (3) |
|||
#define AIO_SOFTWARE_FLOW_CONTROL_OFF (0) |
|||
#define AIO_SOFTWARE_FLOW_CONTROL_ON (1) |
|||
#define AIO_HARDWARE_FLOW_CONTROL_OFF (0) |
|||
#define AIO_HARDWARE_FLOW_CONTROL_ON (2) |
|||
|
|||
|
|||
#define AIO_FLOW_CONTROL_CHARACTERS (4) |
|||
|
|||
#define AIO_SET_DEADMAN_TIMER (5) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOGetExternalStatus function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_EXTSTA_RI (0x00000001) |
|||
#define AIO_EXTSTA_DCD (0x00000008) |
|||
#define AIO_EXTSTA_DSR (0x00000010) |
|||
#define AIO_EXTSTA_CTS (0x00000020) |
|||
#define AIO_EXTSTA_BREAK (0x00000080) |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOFlushBuffers function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_FLUSH_WRITE_BUFFER (0x0001) |
|||
#define AIO_FLUSH_READ_BUFFER (0x0002) |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOReadStatus function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_RECEIVE_ACTIVE (0) |
|||
#define AIO_RECEIVE_FULL (1) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOWriteStatus function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_TRANSMIT_IDLE (0) |
|||
#define AIO_TRANSMIT_ACTIVE (1) |
|||
#define AIO_TRANSMIT_XOFFED (2) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOAcquirePort function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
#define AIO_HARDWARE_TYPE_WILDCARD (-1) |
|||
#define AIO_BOARD_NUMBER_WILDCARD (-1) |
|||
#define AIO_PORT_NUMBER_WILDCARD (-1) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOConfigurePort function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
/* BitRate */ |
|||
|
|||
#define AIO_BAUD_50 (0) |
|||
#define AIO_BAUD_75 (1) |
|||
#define AIO_BAUD_110 (2) |
|||
#define AIO_BAUD_134p5 (3) |
|||
#define AIO_BAUD_150 (4) |
|||
#define AIO_BAUD_300 (5) |
|||
#define AIO_BAUD_600 (6) |
|||
#define AIO_BAUD_1200 (7) |
|||
#define AIO_BAUD_1800 (8) |
|||
#define AIO_BAUD_2000 (9) |
|||
#define AIO_BAUD_2400 (10) |
|||
#define AIO_BAUD_3600 (11) |
|||
#define AIO_BAUD_4800 (12) |
|||
#define AIO_BAUD_7200 (13) |
|||
#define AIO_BAUD_9600 (14) |
|||
#define AIO_BAUD_19200 (15) |
|||
#define AIO_BAUD_38400 (16) |
|||
#define AIO_BAUD_57600 (17) |
|||
#define AIO_BAUD_115200 (18) |
|||
|
|||
/* DataBits */ |
|||
|
|||
#define AIO_DATA_BITS_5 (0) |
|||
#define AIO_DATA_BITS_6 (1) |
|||
#define AIO_DATA_BITS_7 (2) |
|||
#define AIO_DATA_BITS_8 (3) |
|||
|
|||
/* StopBits */ |
|||
|
|||
#define AIO_STOP_BITS_1 (0) |
|||
#define AIO_STOP_BITS_1p5 (1) |
|||
#define AIO_STOP_BITS_2 (2) |
|||
|
|||
/* Parity */ |
|||
|
|||
#define AIO_PARITY_NONE (0) |
|||
#define AIO_PARITY_ODD (1) |
|||
#define AIO_PARITY_EVEN (2) |
|||
#define AIO_PARITY_MARK (3) |
|||
#define AIO_PARITY_SPACE (4) |
|||
|
|||
/* FlowControl */ |
|||
|
|||
#define AIO_SOFTWARE_FLOWCONTROL_OFF (0) |
|||
#define AIO_SOFTWARE_FLOWCONTROL_ON (1) |
|||
#define AIO_HARDWARE_FLOWCONTROL_OFF (0) |
|||
#define AIO_HARDWARE_FLOWCONTROL_ON (2) |
|||
|
|||
#define AIO_DROPOUT_VALUE (0xFF) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with AIOPORTCAPABILITIES structure. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of capabilities data */ |
|||
BYTE majorVersion; |
|||
BYTE minorVersion; |
|||
LONG notSupportedMask; |
|||
BYTE minBitRate; /* minimum bit rate index supported */ |
|||
BYTE maxBitRate; /* maximum bit rate index supported */ |
|||
BYTE minDataBits; /* minimum data bits per char index supported */ |
|||
BYTE maxDataBits; /* maximum data bits per char index supported */ |
|||
BYTE minStopBits; /* minimum stop bits per char index supported */ |
|||
BYTE maxStopBits; /* maximum stop bits per char index supported */ |
|||
BYTE minParityMode; /* minimum parity mode index supported */ |
|||
BYTE maxParityMode; /* maximum parity mode index supported */ |
|||
BYTE minFlowCtrlMode; /* minimum flow control mode index supported */ |
|||
BYTE maxFlowCtrlMode; /* maximum flow control mode index supported */ |
|||
LONG miscCapabilities; /* miscellaneous capability flags */ |
|||
LONG minReadBufferSize; /* minimum length of receive buffer */ |
|||
LONG maxReadBufferSize; /* maximum length of receive buffer */ |
|||
LONG minWriteBufferSize; /* minimum length of transmit buffer */ |
|||
LONG maxWriteBufferSize; /* maximum length of transmit buffer */ |
|||
WORD minDeadmanTime; /* minimum deadman time (seconds) */ |
|||
WORD maxDeadmanTime; /* maximum deadman time (seconds) */ |
|||
} AIOPORTCAPABILITIES; |
|||
|
|||
#define AIO_PORT_NS_MINBITRATE (0x80000000) |
|||
#define AIO_PORT_NS_MAXBITRATE (0x40000000) |
|||
#define AIO_PORT_NS_MINDATABITS (0x20000000) |
|||
#define AIO_PORT_NS_MAXDATABITS (0x10000000) |
|||
#define AIO_PORT_NS_MINSTOPBITS (0x08000000) |
|||
#define AIO_PORT_NS_MAXSTOPBITS (0x04000000) |
|||
#define AIO_PORT_NS_MINPARITYMODE (0x02000000) |
|||
#define AIO_PORT_NS_MAXPARITYMODE (0x01000000) |
|||
#define AIO_PORT_NS_MINFLOWCTRLMODE (0x00800000) |
|||
#define AIO_PORT_NS_MAXFLOWCTRLMODE (0x00400000) |
|||
#define AIO_PORT_NS_MISCCAPABILITIES (0x00200000) |
|||
#define AIO_PORT_NS_MINREADBUFFERSIZE (0x00100000) |
|||
#define AIO_PORT_NS_MAXREADBUFFERSIZE (0x00080000) |
|||
#define AIO_PORT_NS_MINWRITEBUFFERSIZE (0x00040000) |
|||
#define AIO_PORT_NS_MAXWRITEBUFFERSIZE (0x00020000) |
|||
#define AIO_PORT_NS_MINDEADMANTIME (0x00010000) |
|||
#define AIO_PORT_NS_MAXDEADMANTIME (0x00008000) |
|||
|
|||
#define AIO_PORT_CAPS_NOT_SUPPORTED (0x00007FFF) |
|||
#define AIO_PORT_CAPS_MAJOR_VERSION (1) |
|||
#define AIO_PORT_CAPS_MINOR_VERSION (0) |
|||
|
|||
#define AIO_CAP_OUTPUT_BREAK (0x00000002) |
|||
#define AIO_CAP_FLOWCTRLCHARS (0x00000004) |
|||
#define AIO_CAP_PROGRAMMABLE (0x00000008) |
|||
#define AIO_CAP_INPUT (0x00000010) |
|||
#define AIO_CAP_OUTPUT (0x00000020) |
|||
|
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of driver capabilities structure */ |
|||
BYTE byteData[2]; |
|||
} AIODVRCAPABILITIES; |
|||
|
|||
#define AIO_NO_STRUCT_DATA_RETURNED (2) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOGetPortsRollCall function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of port info data */ |
|||
BYTE majorVersion; |
|||
BYTE minorVersion; |
|||
LONG notSupportedMask; |
|||
int hardwareType; /* value used with AIOAcquirePort */ |
|||
int boardNumber; /* " */ |
|||
int portNumber; /* " */ |
|||
WORD availability; /* availability of port for acquire */ |
|||
LONG externalStatus; /* current external status value for port */ |
|||
LONG chgdExternalStatus; /* changed external status value for port */ |
|||
} AIOPORTINFO; |
|||
|
|||
#define AIO_INFO_NS_HARDWARETYPE (0x80000000) |
|||
#define AIO_INFO_NS_BOARDNUMBER (0x40000000) |
|||
#define AIO_INFO_NS_PORTNUMBER (0x20000000) |
|||
#define AIO_INFO_NS_AVAILABILITY (0x10000000) |
|||
#define AIO_INFO_NS_EXTERNALSTATUS (0x08000000) |
|||
#define AIO_INFO_NS_CHGDEXTERNALSTATUS (0x04000000) |
|||
|
|||
#define AIO_PORT_INFO_NOT_SUPPORTED (0x03FFFFFF) |
|||
#define AIO_PORT_INFO_MAJOR_VERSION (1) |
|||
#define AIO_PORT_INFO_MINOR_VERSION (0) |
|||
|
|||
#define AIO_AVAILABLE_FOR_ACQUIRE (0) |
|||
#define AIO_ALREADY_ACQUIRED (1) |
|||
#define AIO_UNAVAILABLE (0xFF) |
|||
|
|||
#define AIO_INITIAL (0) |
|||
#define AIO_SUCCESSOR (1) |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOGetPortConfiguration function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of port configuration data */ |
|||
BYTE majorVersion; |
|||
BYTE minorVersion; |
|||
LONG notSupportedMask; |
|||
int hardwareType; /* value used with AIOAcquirePort */ |
|||
int boardNumber; /* " */ |
|||
int portNumber; /* " */ |
|||
BYTE bitRate; /* Bits per second index */ |
|||
BYTE dataBits; /* Bits per character index */ |
|||
BYTE stopBits; /* Stop bits per char index */ |
|||
BYTE parityMode; /* Generated parity index */ |
|||
BYTE flowCtrlMode; /* Flow control mode */ |
|||
BYTE breakMode; /* Break control mode */ |
|||
LONG readSize; /* Receive buffer size */ |
|||
LONG writeSize; /* Transmit buffer size */ |
|||
BYTE transmitXon; |
|||
BYTE transmitXoff; |
|||
BYTE receiveXon; |
|||
BYTE receiveXoff; |
|||
WORD externalControl; /* set with AIO_EXTERNAL_CONTROL */ |
|||
|
|||
} AIOPORTCONFIG; |
|||
|
|||
#define AIO_CONFIG_NS_HARDWARETYPE (0x80000000) |
|||
#define AIO_CONFIG_NS_BOARDNUMBER (0x40000000) |
|||
#define AIO_CONFIG_NS_PORTNUMBER (0x20000000) |
|||
#define AIO_CONFIG_NS_BITRATE (0x10000000) |
|||
#define AIO_CONFIG_NS_DATABITS (0x08000000) |
|||
#define AIO_CONFIG_NS_STOPBITS (0x04000000) |
|||
#define AIO_CONFIG_NS_PARITYMODE (0x02000000) |
|||
#define AIO_CONFIG_NS_FLOWCTRLMODE (0x01000000) |
|||
#define AIO_CONFIG_NS_BREAKMODE (0x00800000) |
|||
#define AIO_CONFIG_NS_READSIZE (0x00400000) |
|||
#define AIO_CONFIG_NS_WRITESIZE (0x00200000) |
|||
#define AIO_CONFIG_NS_TRANSMITXON (0x00100000) |
|||
#define AIO_CONFIG_NS_TRANSMITXOFF (0x00080000) |
|||
#define AIO_CONFIG_NS_RECEIVEXON (0x00040000) |
|||
#define AIO_CONFIG_NS_RECEIVEXOFF (0x00020000) |
|||
#define AIO_CONFIG_NS_EXTERNALCONTROL (0x00010000) |
|||
|
|||
#define AIO_PORT_CONFIG_NOT_SUPPORTED (0x0007FFFF) |
|||
#define AIO_PORT_CONFIG_MAJOR_VERSION (1) |
|||
#define AIO_PORT_CONFIG_MINOR_VERSION (0) |
|||
|
|||
#define AIO_EXTCTRL_DTR_ENABLE (1) |
|||
#define AIO_EXTCTRL_DTR_DISABLE (0) |
|||
#define AIO_EXTCTRL_RTS_ENABLE (2) |
|||
#define AIO_EXTCTRL_RTS_DISABLE (0) |
|||
|
|||
#define AIO_BREAK_MODE_OFF (0) |
|||
#define AIO_BREAK_MODE_ON (1) |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of driver config structure */ |
|||
BYTE byteData[2]; |
|||
} AIODVRCONFIG; |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with the AIOGetStatistics function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of port statistics structure */ |
|||
BYTE majorVersion; |
|||
BYTE minorVersion; |
|||
LONG notSupportedMask; |
|||
LONG receiveBytes; /* total number of bytes received on port */ |
|||
LONG transmitBytes; /* total number of bytes transmitted from port */ |
|||
LONG parityErrors; /* number of receive parity errors */ |
|||
LONG framingErrors; /* number of receive framing errors */ |
|||
LONG overrunSoftware; /* number of software overruns (occurrences) */ |
|||
LONG overrunHardware; /* number of hardware overruns (occurrences) */ |
|||
} AIOPORTSTATISTICS; |
|||
|
|||
#define AIO_STATS_NS_RECEIVEBYTES (0x80000000) |
|||
#define AIO_STATS_NS_TRANSMITBYTES (0x40000000) |
|||
#define AIO_STATS_NS_PARITYERRORS (0x20000000) |
|||
#define AIO_STATS_NS_FRAMINGERRORS (0x10000000) |
|||
#define AIO_STATS_NS_OVERRUNSOFTWARE (0x08000000) |
|||
#define AIO_STATS_NS_OVERRUNHARDWARE (0x04000000) |
|||
|
|||
#define AIO_PORT_STATS_NOT_SUPPORTED (0x03FFFFFF) |
|||
#define AIO_PORT_STATS_MAJOR_VERSION (1) |
|||
#define AIO_PORT_STATS_MINOR_VERSION (0) |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of driver statistics structure */ |
|||
BYTE byteData[2]; |
|||
} AIODVRSTATISTICS; |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with AIOGetDriverList function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
int hardwareType; |
|||
int ports; |
|||
char name[128]; |
|||
} AIODRIVERLISTENTRY; |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; |
|||
AIODRIVERLISTENTRY driver[1]; |
|||
} AIODRIVERLIST; |
|||
|
|||
#define AIO_DRIVER_LIST_GET_FIRST (-1) |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with AIOGetBoardList function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
int boardNumber; |
|||
int ports; |
|||
char name[128]; |
|||
} AIOBOARDLISTENTRY; |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; |
|||
AIOBOARDLISTENTRY board[1]; |
|||
} AIOBOARDLIST; |
|||
|
|||
#define AIO_BOARD_LIST_GET_FIRST (-1) |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with AIOSetControlData function. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
WORD returnLength; /* byte length of control data structure */ |
|||
BYTE byteData[2]; |
|||
} AIOCONTROLDATA; |
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definitions for use with AIOGetFirstPortInfo and AIOGetNextPortInfo * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
typedef struct |
|||
{ |
|||
int typeMask; |
|||
int boardMask; |
|||
int portMask; |
|||
int reserved[6]; |
|||
} AIOPORTSEARCH; |
|||
|
|||
/* reserved index values */ |
|||
|
|||
#define SEARCH_TYPE_INDEX 0 |
|||
#define SEARCH_BOARD_INDEX 1 |
|||
#define SEARCH_PORT_INDEX 2 |
|||
|
|||
|
|||
/*----------------------------------------------------------------------------*
|
|||
* * |
|||
* Definition of AIO functions. * |
|||
* * |
|||
*----------------------------------------------------------------------------*/ |
|||
|
|||
extern int AIOAcquirePort ( int *hardwareType, |
|||
int *boardNumber, |
|||
int *portNumber, |
|||
int *portHandle |
|||
); |
|||
|
|||
extern int AIOAcquirePortWithRTag ( int *hardwareType, |
|||
int *boardNumber, |
|||
int *portNumber, |
|||
int *portHandle, |
|||
LONG RTag |
|||
); |
|||
|
|||
extern int AIOConfigurePort ( int portHandle, |
|||
BYTE bitRate, |
|||
BYTE dataBits, |
|||
BYTE stopBits, |
|||
BYTE parityMode, |
|||
BYTE flowCtrlMode |
|||
); |
|||
|
|||
extern int AIOFlushBuffers ( int portHandle, |
|||
WORD flushFlag |
|||
); |
|||
|
|||
extern int AIOGetBoardList( int hardwareType, |
|||
int boardIndex, |
|||
AIOBOARDLIST *pBoardList ); |
|||
|
|||
extern int AIOGetDriverList ( int lastHardwareType, |
|||
AIODRIVERLIST *pDriverList |
|||
); |
|||
|
|||
extern int AIOGetExternalStatus ( int portHandle, |
|||
LONG *extStatus, |
|||
LONG *chgdExtStatus |
|||
); |
|||
|
|||
extern int AIOGetFirstPortInfo ( int hardwareType, |
|||
int boardNumber, |
|||
int portNumber, |
|||
AIOPORTSEARCH *portSearchP, |
|||
AIOPORTINFO *portInfoP, |
|||
AIOPORTCAPABILITIES *capabilitiesP, |
|||
AIODVRCAPABILITIES *dvrCapabilitiesP, |
|||
char *NLMModuleNameP ); |
|||
|
|||
extern int AIOGetNextPortInfo ( AIOPORTSEARCH *portSearchP, |
|||
AIOPORTINFO *portInfoP, |
|||
AIOPORTCAPABILITIES *capabilitiesP, |
|||
AIODVRCAPABILITIES *dvrCapabilitiesP, |
|||
char *NLMModuleNameP ); |
|||
|
|||
extern int AIOGetPortCapability ( int portHandle, |
|||
AIOPORTCAPABILITIES *pCapabilities, |
|||
AIODVRCAPABILITIES *pDvrCapabilities |
|||
); |
|||
|
|||
extern int AIOGetPortConfiguration ( int portHandle, |
|||
AIOPORTCONFIG *pPortConfig, |
|||
AIODVRCONFIG *pDvrConfig |
|||
); |
|||
|
|||
extern int AIOGetPortStatus ( int portHandle, |
|||
LONG *writeCount, |
|||
WORD *writeState, |
|||
LONG *readCount, |
|||
WORD *readState, |
|||
LONG *extStatus, |
|||
LONG *chgdExtStatus |
|||
); |
|||
|
|||
extern int AIOGetReadBufferSize ( int portHandle, |
|||
LONG *readSize |
|||
); |
|||
|
|||
extern int AIOGetPortStatistics ( int portHandle, |
|||
AIOPORTSTATISTICS *pPortStatistics, |
|||
AIODVRSTATISTICS *pDvrStatistics |
|||
); |
|||
|
|||
extern int AIOGetFirstPortStatistics( int hardwareType, |
|||
int boardNumber, |
|||
int portNumber, |
|||
AIOPORTSEARCH *portSearchP, |
|||
AIOPORTSTATISTICS *pPortStatistics, |
|||
AIODVRSTATISTICS *pDvrStatistics |
|||
); |
|||
|
|||
extern int AIOGetNextPortStatistics ( AIOPORTSEARCH *portSearchP, |
|||
AIOPORTSTATISTICS *pPortStatistics, |
|||
AIODVRSTATISTICS *pDvrStatistics |
|||
); |
|||
|
|||
extern int AIOGetWriteBufferSize ( int portHandle, |
|||
LONG *writeSize |
|||
); |
|||
|
|||
extern int AIOReadData ( int portHandle, |
|||
char *buffer, |
|||
LONG length, |
|||
LONG *numberBytesRead |
|||
); |
|||
|
|||
extern int AIOReadStatus ( int portHandle, |
|||
LONG *count, |
|||
WORD *state |
|||
); |
|||
|
|||
extern int AIOReleasePort ( int portHandle ); |
|||
|
|||
extern int AIOSetControlData ( int portHandle, |
|||
int requestType, |
|||
AIOCONTROLDATA *requestStructValue |
|||
); |
|||
|
|||
extern int AIOSetExternalControl ( int portHandle, |
|||
int requestType, |
|||
int requestValue |
|||
); |
|||
|
|||
extern int AIOSetFlowControl ( int portHandle, |
|||
int flowCtrlMode |
|||
); |
|||
|
|||
extern int AIOSetFlowControlCharacters( int portHandle, |
|||
BYTE transmitXon, |
|||
BYTE transmitXoff, |
|||
BYTE receiveXon, |
|||
BYTE receiveXoff |
|||
); |
|||
|
|||
extern int AIOSetReadBufferSize ( int portHandle, |
|||
LONG bufferSize |
|||
); |
|||
|
|||
extern int AIOSetWriteBufferSize ( int portHandle, |
|||
LONG bufferSize |
|||
); |
|||
|
|||
extern int AIOWriteData ( int portHandle, |
|||
char *buffer, |
|||
LONG length, |
|||
LONG *numberBytesWritten |
|||
); |
|||
|
|||
extern int AIOWriteStatus ( int portHandle, |
|||
LONG *count, |
|||
WORD *state |
|||
); |
|||
|
|||
@ -0,0 +1,152 @@ |
|||
#include "alpha.h" |
|||
|
|||
/* Get the registers out of the frame information. */ |
|||
|
|||
void |
|||
frame_to_registers (frame, regs) |
|||
struct StackFrame *frame; |
|||
char *regs; |
|||
{ |
|||
mem2hex (&frame->ExceptionPC, ®s[PC_REGNUM * 8 * 2], 8 * 1, 0); |
|||
|
|||
mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET], ®s[V0_REGNUM * 8 * 2], 8 * 64, 0); |
|||
} |
|||
|
|||
/* Put the registers back into the frame information. */ |
|||
|
|||
void |
|||
registers_to_frame (regs, frame) |
|||
char *regs; |
|||
struct StackFrame *frame; |
|||
{ |
|||
hex2mem (®s[PC_REGNUM * 8 * 2], &frame->ExceptionPC, 8 * 1, 0); |
|||
|
|||
hex2mem (®s[V0_REGNUM * 8 * 2], &frame->ExceptionRegs[SF_IREG_OFFSET], 8 * 64, 0); |
|||
} |
|||
|
|||
union inst |
|||
{ |
|||
LONG l; |
|||
|
|||
struct |
|||
{ |
|||
union |
|||
{ |
|||
struct |
|||
{ |
|||
unsigned hint : 16; |
|||
unsigned rb : 5; |
|||
unsigned ra : 5; |
|||
unsigned opcode : 6; |
|||
} jump; |
|||
struct |
|||
{ |
|||
signed disp : 21; |
|||
unsigned ra : 5; |
|||
unsigned opcode : 6; |
|||
} branch; |
|||
} variant; |
|||
} inst; |
|||
}; |
|||
|
|||
static LONG saved_inst; |
|||
static LONG *saved_inst_pc = 0; |
|||
static LONG saved_target_inst; |
|||
static LONG *saved_target_inst_pc = 0; |
|||
|
|||
void |
|||
set_step_traps (frame) |
|||
struct StackFrame *frame; |
|||
{ |
|||
union inst inst; |
|||
LONG *target; |
|||
int opcode; |
|||
int ra, rb; |
|||
LONG *pc = (LONG *)frame->ExceptionPC; |
|||
|
|||
inst.l = *pc++; |
|||
|
|||
opcode = inst.inst.variant.branch.opcode; |
|||
|
|||
if ((opcode & 0x30) == 0x30) /* A branch of some sort */ |
|||
target = inst.inst.variant.branch.disp + pc; |
|||
else if (opcode == 0x1a) /* jmp, ret, etc... */ |
|||
target = (LONG *)(frame->ExceptionRegs[SF_IREG_OFFSET |
|||
+ inst.inst.variant.jump.rb].lo |
|||
& ~3); |
|||
else |
|||
target = pc; |
|||
|
|||
saved_inst = *pc; |
|||
*pc = 0x80; /* call_pal bpt */ |
|||
saved_inst_pc = pc; |
|||
|
|||
if (target != pc) |
|||
{ |
|||
saved_target_inst = *target; |
|||
*target = 0x80; /* call_pal bpt */ |
|||
saved_target_inst_pc = target; |
|||
} |
|||
} |
|||
|
|||
/* Remove step breakpoints. Returns non-zero if pc was at a step breakpoint,
|
|||
zero otherwise. This routine works even if there were no step breakpoints |
|||
set. */ |
|||
|
|||
int |
|||
clear_step_traps (frame) |
|||
struct StackFrame *frame; |
|||
{ |
|||
int retcode; |
|||
LONG *pc = (LONG *)frame->ExceptionPC; |
|||
|
|||
if (saved_inst_pc == pc || saved_target_inst_pc == pc) |
|||
retcode = 1; |
|||
else |
|||
retcode = 0; |
|||
|
|||
if (saved_inst_pc) |
|||
{ |
|||
*saved_inst_pc = saved_inst; |
|||
saved_inst_pc = 0; |
|||
} |
|||
|
|||
if (saved_target_inst_pc) |
|||
{ |
|||
*saved_target_inst_pc = saved_target_inst; |
|||
saved_target_inst_pc = 0; |
|||
} |
|||
|
|||
return retcode; |
|||
} |
|||
|
|||
void |
|||
do_status (ptr, frame) |
|||
char *ptr; |
|||
struct StackFrame *frame; |
|||
{ |
|||
int sigval; |
|||
|
|||
sigval = computeSignal (frame->ExceptionNumber); |
|||
|
|||
sprintf (ptr, "T%02x", sigval); |
|||
ptr += 3; |
|||
|
|||
sprintf (ptr, "%02x:", PC_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 8, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
sprintf (ptr, "%02x:", SP_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + SP_REGNUM], ptr + 3, 8, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
sprintf (ptr, "%02x:", RA_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + RA_REGNUM], ptr + 3, 8, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
sprintf (ptr, "%02x:", FP_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionRegs[SF_IREG_OFFSET + FP_REGNUM], ptr + 3, 8, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
*ptr = '\000'; |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
#include "alpha-patch.h" |
|||
|
|||
/* Register values. All of these values *MUST* agree with tm.h */ |
|||
#define RA_REGNUM 26 /* Contains return address value */ |
|||
#define SP_REGNUM 30 /* Contains address of top of stack */ |
|||
#define PC_REGNUM 64 /* Contains program counter */ |
|||
#define FP_REGNUM 65 /* Virtual frame pointer */ |
|||
#define V0_REGNUM 0 /* Function integer return value */ |
|||
#define NUM_REGS 66 /* Number of machine registers */ |
|||
#define REGISTER_BYTES (NUM_REGS * 8) /* Total size of registers array */ |
|||
|
|||
#define ExceptionPC ExceptionRegs[SF_REG_PC].lo |
|||
#define DECR_PC_AFTER_BREAK 0 /* NT's Palcode gets this right! */ |
|||
#define BREAKPOINT {0x80, 0, 0, 0} /* call_pal bpt */ |
|||
unsigned char breakpoint_insn; |
|||
#define BREAKPOINT_SIZE 4 |
|||
|
|||
/*#define flush_i_cache() asm("call_pal 0x86")*/ |
|||
|
|||
@ -0,0 +1,76 @@ |
|||
#include <nwtypes.h> |
|||
#include <errno.h> |
|||
#include <stdio.h> |
|||
#include <aio.h> |
|||
|
|||
#define CONST const |
|||
|
|||
/* This file provides stubs and equivalent interfaces for all functions that
|
|||
the debugger stub needs, but aren't yet implemented. */ |
|||
|
|||
int |
|||
AIOReadData (int portHandle, char *buffer, LONG length, LONG *numberBytesRead) |
|||
{ |
|||
return AIO_SUCCESS; |
|||
} |
|||
|
|||
int |
|||
AIOWriteData (int portHandle, char *buffer, LONG length, |
|||
LONG *numberBytesWritten) |
|||
|
|||
{ |
|||
return AIO_SUCCESS; |
|||
} |
|||
|
|||
int |
|||
AIOAcquirePort (int *hardwareType, int *boardNumber, int *portNumber, |
|||
int *portHandle) |
|||
{ |
|||
return AIO_SUCCESS; |
|||
} |
|||
|
|||
int |
|||
AIOConfigurePort (int portHandle, BYTE bitRate, BYTE dataBits, BYTE stopBits, |
|||
BYTE parityMode, BYTE flowCtrlMode) |
|||
{ |
|||
return AIO_SUCCESS; |
|||
} |
|||
|
|||
int |
|||
AIOGetPortConfiguration (int portHandle, AIOPORTCONFIG *pPortConfig, |
|||
AIODVRCONFIG *pDvrConfig) |
|||
{ |
|||
fprintf (stderr, "AIOGetPortConfiguration stubbed out\n"); |
|||
exit (1); |
|||
} |
|||
|
|||
int |
|||
AIOReleasePort (int portHandle) |
|||
{ |
|||
return AIO_SUCCESS; |
|||
} |
|||
|
|||
int |
|||
AIOSetExternalControl (int portHandle, int requestType, int requestValue) |
|||
{ |
|||
return AIO_SUCCESS; |
|||
} |
|||
|
|||
int |
|||
AIOGetExternalStatus (int portHandle, LONG *extStatus, LONG *chgdExtStatus) |
|||
{ |
|||
fprintf (stderr, "AIOGetExternalStatus stubbed out\n"); |
|||
exit (1); |
|||
} |
|||
|
|||
void |
|||
StopBell () |
|||
{ |
|||
} |
|||
|
|||
int |
|||
Breakpoint (int __arg) |
|||
{ |
|||
fprintf (stderr, "Breakpoint() stubbed out\n"); |
|||
exit (1); |
|||
} |
|||
@ -0,0 +1,414 @@ |
|||
#include <nwdfs.h> |
|||
#include <stdio.h> |
|||
#include <string.h> |
|||
#include <stdlib.h> |
|||
#include <time.h> |
|||
#include <nwconio.h> |
|||
#include <nwadv.h> |
|||
#include <nwdbgapi.h> |
|||
#include <errno.h> |
|||
#include <nwthread.h> |
|||
#include "ppc.h" |
|||
|
|||
extern char *mem2hex (void *mem, char *buf, int count, int may_fault); |
|||
extern char *hex2mem (char *buf, void *mem, int count, int may_fault); |
|||
extern int computeSignal (int exceptionVector); |
|||
|
|||
void |
|||
flush_i_cache (void) |
|||
{ |
|||
} |
|||
|
|||
/* Get the registers out of the frame information. */ |
|||
|
|||
void |
|||
frame_to_registers (frame, regs) |
|||
struct StackFrame *frame; |
|||
char *regs; |
|||
{ |
|||
mem2hex (&frame->ExceptionState.CsavedRegs, ®s[GP0_REGNUM * 4 * 2], 4 * 32, 0); |
|||
|
|||
mem2hex (&frame->ExceptionState.CSavedFPRegs, ®s[FP0_REGNUM * 4 * 2], 4 * 32, 0); |
|||
|
|||
mem2hex (&frame->ExceptionPC, ®s[PC_REGNUM * 4 * 2], 4 * 1, 0); |
|||
|
|||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR1, ®s[CR_REGNUM * 4 * 2], 4 * 1, 0); |
|||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR, ®s[LR_REGNUM * 4 * 2], 4 * 1, 0); |
|||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR, ®s[CTR_REGNUM * 4 * 2], 4 * 1, 0); |
|||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedXER, ®s[XER_REGNUM * 4 * 2], 4 * 1, 0); |
|||
mem2hex (&frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedMQ, ®s[MQ_REGNUM * 4 * 2], 4 * 1, 0); |
|||
} |
|||
|
|||
/* Put the registers back into the frame information. */ |
|||
|
|||
void |
|||
registers_to_frame (regs, frame) |
|||
char *regs; |
|||
struct StackFrame *frame; |
|||
{ |
|||
hex2mem (®s[GP0_REGNUM * 4 * 2], &frame->ExceptionState.CsavedRegs, 4 * 32, 0); |
|||
|
|||
hex2mem (®s[FP0_REGNUM * 4 * 2], &frame->ExceptionState.CSavedFPRegs, 4 * 32, 0); |
|||
|
|||
hex2mem (®s[PC_REGNUM * 4 * 2], &frame->ExceptionPC, 4 * 1, 0); |
|||
|
|||
hex2mem (®s[CR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR1, 4 * 1, 0); |
|||
hex2mem (®s[LR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR, 4 * 1, 0); |
|||
hex2mem (®s[CTR_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR, 4 * 1, 0); |
|||
hex2mem (®s[XER_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedXER, 4 * 1, 0); |
|||
hex2mem (®s[MQ_REGNUM * 4 * 2], &frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedMQ, 4 * 1, 0); |
|||
} |
|||
|
|||
extern int ReadByteAltDebugger (char* addr, char *theByte); |
|||
|
|||
extern int WriteByteAltDebugger (char* addr, char theByte); |
|||
|
|||
extern volatile int mem_err; |
|||
|
|||
int |
|||
get_char (addr) |
|||
char *addr; |
|||
{ |
|||
char c; |
|||
|
|||
if (!ReadByteAltDebugger (addr, &c)) |
|||
mem_err = 1; |
|||
|
|||
return c; |
|||
} |
|||
|
|||
void |
|||
set_char (addr, val) |
|||
char *addr; |
|||
int val; |
|||
{ |
|||
if (!WriteByteAltDebugger (addr, val)) |
|||
mem_err = 1; |
|||
} |
|||
|
|||
int |
|||
mem_write (dst, src, len) |
|||
char *dst, *src; |
|||
int len; |
|||
{ |
|||
while (len-- && !mem_err) |
|||
set_char (dst++, *src++); |
|||
|
|||
return mem_err; |
|||
} |
|||
|
|||
union inst |
|||
{ |
|||
LONG l; |
|||
|
|||
struct |
|||
{ |
|||
union |
|||
{ |
|||
struct /* Unconditional branch */ |
|||
{ |
|||
unsigned opcode : 6; /* 18 */ |
|||
signed li : 24; |
|||
unsigned aa : 1; |
|||
unsigned lk : 1; |
|||
} b; |
|||
struct /* Conditional branch */ |
|||
{ |
|||
unsigned opcode : 6; /* 16 */ |
|||
unsigned bo : 5; |
|||
unsigned bi : 5; |
|||
signed bd : 14; |
|||
unsigned aa : 1; |
|||
unsigned lk : 1; |
|||
} bc; |
|||
struct /* Conditional branch to ctr or lr reg */ |
|||
{ |
|||
unsigned opcode : 6; /* 19 */ |
|||
unsigned bo : 5; |
|||
unsigned bi : 5; |
|||
unsigned type : 15; /* 528 = ctr, 16 = lr */ |
|||
unsigned lk : 1; |
|||
} bclr; |
|||
} variant; |
|||
} inst; |
|||
}; |
|||
|
|||
static LONG saved_inst; |
|||
static char *saved_inst_pc = 0; |
|||
static LONG saved_target_inst; |
|||
static char *saved_target_inst_pc = 0; |
|||
|
|||
void |
|||
set_step_traps (frame) |
|||
struct StackFrame *frame; |
|||
{ |
|||
union inst inst; |
|||
char *target; |
|||
int opcode; |
|||
int ra, rb; |
|||
char *pc = (char *)frame->ExceptionPC; |
|||
|
|||
inst.l = *(LONG *)pc; |
|||
|
|||
opcode = inst.inst.variant.b.opcode; |
|||
|
|||
switch (opcode) |
|||
{ |
|||
case 18: /* Unconditional branch */ |
|||
target = (char *)(inst.inst.variant.b.li << 2); |
|||
|
|||
if (!inst.inst.variant.b.aa) /* Relative? */ |
|||
target += (long)pc; |
|||
|
|||
break; |
|||
case 16: /* Conditional branch */ |
|||
target = (char *)(inst.inst.variant.bc.bd << 2); |
|||
|
|||
if (!inst.inst.variant.bc.aa) /* Relative? */ |
|||
target += (long)pc; |
|||
|
|||
break; |
|||
case 19: /* Cond. branch via ctr or lr reg */ |
|||
switch (inst.inst.variant.bclr.type) |
|||
{ |
|||
case 528: /* ctr */ |
|||
target = (char *)frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedCTR; |
|||
break; |
|||
case 16: /* lr */ |
|||
target = (char *)frame->ExceptionState.u.SpecialRegistersEnumerated.CsavedLR; |
|||
break; |
|||
default: |
|||
target = pc; |
|||
} |
|||
break; |
|||
default: |
|||
target = pc; |
|||
} |
|||
|
|||
saved_inst = *(LONG *)pc; |
|||
mem_write (pc, breakpoint_insn, BREAKPOINT_SIZE); |
|||
saved_inst_pc = pc; |
|||
|
|||
if (target != pc) |
|||
{ |
|||
saved_target_inst = *(LONG *)target; |
|||
mem_write (target, breakpoint_insn, BREAKPOINT_SIZE); |
|||
saved_target_inst_pc = target; |
|||
} |
|||
} |
|||
|
|||
/* Remove step breakpoints. Returns non-zero if pc was at a step breakpoint,
|
|||
zero otherwise. This routine works even if there were no step breakpoints |
|||
set. */ |
|||
|
|||
int |
|||
clear_step_traps (frame) |
|||
struct StackFrame *frame; |
|||
{ |
|||
int retcode; |
|||
char *pc = (char *)frame->ExceptionPC; |
|||
|
|||
if (saved_inst_pc == pc || saved_target_inst_pc == pc) |
|||
retcode = 1; |
|||
else |
|||
retcode = 0; |
|||
|
|||
if (saved_inst_pc) |
|||
{ |
|||
mem_write (saved_inst_pc, saved_inst, BREAKPOINT_SIZE); |
|||
saved_inst_pc = 0; |
|||
} |
|||
|
|||
if (saved_target_inst_pc) |
|||
{ |
|||
mem_write (saved_target_inst_pc, saved_target_inst, BREAKPOINT_SIZE); |
|||
saved_target_inst_pc = 0; |
|||
} |
|||
|
|||
return retcode; |
|||
} |
|||
|
|||
void |
|||
do_status (ptr, frame) |
|||
char *ptr; |
|||
struct StackFrame *frame; |
|||
{ |
|||
int sigval; |
|||
|
|||
sigval = computeSignal (frame->ExceptionNumber); |
|||
|
|||
sprintf (ptr, "T%02x", sigval); |
|||
ptr += 3; |
|||
|
|||
sprintf (ptr, "%02x:", PC_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
sprintf (ptr, "%02x:", SP_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionState.CsavedRegs[SP_REGNUM], ptr + 3, 4, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
sprintf (ptr, "%02x:", LR_REGNUM); |
|||
ptr = mem2hex (&frame->ExceptionState.CsavedRegs[LR_REGNUM], ptr + 3, 4, 0); |
|||
*ptr++ = ';'; |
|||
|
|||
*ptr = '\000'; |
|||
} |
|||
|
|||
/*
|
|||
* strtol : convert a string to long. |
|||
* |
|||
* Andy Wilson, 2-Oct-89. |
|||
*/ |
|||
|
|||
/* FIXME: It'd be nice to configure around these, but the include files are too
|
|||
painful. These macros should at least be more portable than hardwired hex |
|||
constants. */ |
|||
|
|||
#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */ |
|||
#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF */ |
|||
#define LONG_MIN ((long)(~LONG_MAX)) /* 0x80000000 */ |
|||
|
|||
extern int errno; |
|||
|
|||
unsigned long strtoul(const char *s, char **ptr, int base); |
|||
|
|||
long |
|||
strtol(s, ptr, base) |
|||
const char *s; char **ptr; int base; |
|||
{ |
|||
int minus=0; |
|||
unsigned long tmp; |
|||
const char *start=s; |
|||
char *eptr; |
|||
|
|||
if (s==NULL) |
|||
{ |
|||
errno = ERANGE; |
|||
if (!ptr) |
|||
*ptr = (char *)start; |
|||
return 0L; |
|||
} |
|||
while (isspace(*s)) |
|||
s++; |
|||
if (*s == '-') { |
|||
s++; |
|||
minus = 1; |
|||
} |
|||
else if (*s == '+') |
|||
s++; |
|||
|
|||
/*
|
|||
* let strtoul do the hard work. |
|||
*/ |
|||
tmp = strtoul(s, &eptr, base); |
|||
if (ptr != NULL) |
|||
*ptr = (char *)((eptr==s) ? (char *)start : eptr); |
|||
if (tmp > (minus ? - (unsigned long) LONG_MIN : (unsigned long) LONG_MAX)) |
|||
{ |
|||
errno = ERANGE; |
|||
return (minus ? LONG_MIN : LONG_MAX); |
|||
} |
|||
return (minus ? (long) -tmp : (long) tmp); |
|||
} |
|||
|
|||
/*
|
|||
* strtol : convert a string to long. |
|||
* |
|||
* Andy Wilson, 2-Oct-89. |
|||
*/ |
|||
|
|||
#ifndef ULONG_MAX |
|||
#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */ |
|||
#endif |
|||
|
|||
extern int errno; |
|||
|
|||
unsigned long |
|||
strtoul(s, ptr, base) |
|||
const char *s; char **ptr; int base; |
|||
{ |
|||
unsigned long total = 0; |
|||
unsigned digit; |
|||
const char *start=s; |
|||
int did_conversion=0; |
|||
int overflow = 0; |
|||
int negate = 0; |
|||
unsigned long maxdiv, maxrem; |
|||
|
|||
if (s==NULL) |
|||
{ |
|||
errno = ERANGE; |
|||
if (!ptr) |
|||
*ptr = (char *)start; |
|||
return 0L; |
|||
} |
|||
|
|||
while (isspace(*s)) |
|||
s++; |
|||
if (*s == '+') |
|||
s++; |
|||
else if (*s == '-') |
|||
s++, negate = 1; |
|||
if (base==0 || base==16) /* the 'base==16' is for handling 0x */ |
|||
{ |
|||
int tmp; |
|||
|
|||
/*
|
|||
* try to infer base from the string |
|||
*/ |
|||
if (*s != '0') |
|||
tmp = 10; /* doesn't start with 0 - assume decimal */ |
|||
else if (s[1] == 'X' || s[1] == 'x') |
|||
tmp = 16, s += 2; /* starts with 0x or 0X - hence hex */ |
|||
else |
|||
tmp = 8; /* starts with 0 - hence octal */ |
|||
if (base==0) |
|||
base = (int)tmp; |
|||
} |
|||
|
|||
maxdiv = ULONG_MAX / base; |
|||
maxrem = ULONG_MAX % base; |
|||
|
|||
while ((digit = *s) != '\0') |
|||
{ |
|||
if (digit >= '0' && digit < ('0'+base)) |
|||
digit -= '0'; |
|||
else |
|||
if (base > 10) |
|||
{ |
|||
if (digit >= 'a' && digit < ('a'+(base-10))) |
|||
digit = digit - 'a' + 10; |
|||
else if (digit >= 'A' && digit < ('A'+(base-10))) |
|||
digit = digit - 'A' + 10; |
|||
else |
|||
break; |
|||
} |
|||
else |
|||
break; |
|||
did_conversion = 1; |
|||
if (total > maxdiv |
|||
|| (total == maxdiv && digit > maxrem)) |
|||
overflow = 1; |
|||
total = (total * base) + digit; |
|||
s++; |
|||
} |
|||
if (overflow) |
|||
{ |
|||
errno = ERANGE; |
|||
if (ptr != NULL) |
|||
*ptr = (char *)s; |
|||
return (ULONG_MAX); |
|||
} |
|||
if (ptr != NULL) |
|||
*ptr = (char *) ((did_conversion) ? (char *)s : (char *)start); |
|||
return negate ? -total : total; |
|||
} |
|||
|
|||
void _exit (int foo) __attribute__ ((noreturn)); |
|||
|
|||
void |
|||
exit (int foo) |
|||
{ |
|||
_exit (foo); |
|||
} |
|||
@ -0,0 +1,163 @@ |
|||
typedef long Long; |
|||
|
|||
/* The following enum is used to access the special registers in
|
|||
the saved machine state. */ |
|||
|
|||
typedef enum |
|||
{ |
|||
kDc_SavedPC = 0, /* really SRR0 */ |
|||
kDc_SavedMSR = 1, /* really SRR1 */ |
|||
kDc_SavedCR = 2, |
|||
kDc_SavedLR = 3, |
|||
kDc_SavedDSISR = 4, |
|||
kDc_SavedDAR = 5, |
|||
kDc_SavedXER = 6, |
|||
kDc_SavedCTR = 7, |
|||
kDc_SavedSDR1 = 8, |
|||
kDc_SavedRTCU = 9, |
|||
kDc_SavedRTCL = 10, |
|||
kDc_SavedDEC = 11, |
|||
kDc_SavedSR00 = 12, /* The Segement Registers are consecutive */ |
|||
kDc_SavedSR01 = 13, /* kDc_SavedSR00 + n is supported */ |
|||
kDc_SavedSR02 = 14, |
|||
kDc_SavedSR03 = 15, |
|||
kDc_SavedSR04 = 16, |
|||
kDc_SavedSR05 = 17, |
|||
kDc_SavedSR06 = 18, |
|||
kDc_SavedSR07 = 19, |
|||
kDc_SavedSR08 = 20, |
|||
kDc_SavedSR09 = 21, |
|||
kDc_SavedSR10 = 22, |
|||
kDc_SavedSR11 = 23, |
|||
kDc_SavedSR12 = 24, |
|||
kDc_SavedSR13 = 25, |
|||
kDc_SavedSR14 = 26, |
|||
kDc_SavedSR15 = 27, |
|||
kDc_SavedFPSCR = 29, |
|||
kDc_SavedMQ = 30, |
|||
kDc_SavedBAT0U = 31, |
|||
kDc_SavedBAT0L = 32, |
|||
kDc_SavedBAT1U = 33, |
|||
kDc_SavedBAT1L = 34, |
|||
kDc_SavedBAT2U = 35, |
|||
kDc_SavedBAT2L = 36, |
|||
kDc_SavedBAT3U = 37, |
|||
kDc_SavedBAT3L = 38, |
|||
|
|||
kNumberSpecialRegisters = 39 |
|||
} Dc_SavedRegisterName; |
|||
|
|||
/* Access to floating points is not very easy. This allows the number to be
|
|||
accessed both as a floating number and as a pair of Longs. */ |
|||
|
|||
typedef union |
|||
{ |
|||
double asfloat; /* access the variable as a floating number */ |
|||
struct |
|||
{ |
|||
Long high; |
|||
Long low; |
|||
} |
|||
asLONG; /* access the variable as two Longs */ |
|||
} FloatingPoints; |
|||
|
|||
/* The following is the standard record for Saving a machine state */ |
|||
|
|||
struct SavedMachineState |
|||
{ |
|||
FloatingPoints CSavedFPRegs[32]; /* The floating point registers [0->31] */ |
|||
/* ***32bit assumption*** */ |
|||
Long CsavedRegs[32]; /* space to save the General Registers */ |
|||
/* These are saved 0->31 */ |
|||
Long CexReason; |
|||
Long SavedDomainID; |
|||
union |
|||
{ /* must be 8-byte aligned, so doubleFPSCR is 8-byte aligned */ |
|||
struct |
|||
{ |
|||
Long CsavedSRR0; /* Index 0 - The saved PC */ |
|||
Long CsavedSRR1; /* 1 saved MSR */ |
|||
Long CsavedCR; /* 2 */ |
|||
Long CsavedLR; /* 3 */ |
|||
Long CsavedDSISR; /* 4 */ |
|||
Long CsavedDAR; /* 5 */ |
|||
|
|||
Long CsavedXER; /* 6 */ |
|||
Long CsavedCTR; /* 7 */ |
|||
Long CsavedSDR1; /* 8 */ |
|||
Long CsavedRTCU; /* 9 */ |
|||
Long CsavedRTCL; /* 10 */ |
|||
Long CsavedDEC; /* 11 */ |
|||
Long CsavedSR0; /* 12 */ |
|||
Long CsavedSR1; /* 13 */ |
|||
Long CsavedSR2; /* 14 */ |
|||
Long CsavedSR3; /* 15 */ |
|||
Long CsavedSR4; /* 16 */ |
|||
Long CsavedSR5; /* 17 */ |
|||
Long CsavedSR6; /* 18 */ |
|||
Long CsavedSR7; /* 19 */ |
|||
Long CsavedSR8; /* 20 */ |
|||
Long CsavedSR9; /* 21 */ |
|||
Long CsavedSR10; /* 22 */ |
|||
Long CsavedSR11; /* 23 */ |
|||
Long CsavedSR12; /* 24 */ |
|||
Long CsavedSR13; /* 25 */ |
|||
Long CsavedSR14; /* 26 */ |
|||
Long CsavedSR15; /* 27 */ |
|||
/* CdoubleFPSCR must be double word aligned */ |
|||
Long CdoubleFPSCR; /* 28 this is the upper part of the store and has
|
|||
no meaning */ |
|||
Long CsavedFPSCR; /* 29 */ |
|||
Long CsavedMQ; /* 30 */ |
|||
Long CsavedBAT0U; /* 31 */ |
|||
Long CsavedBAT0L; /* 32 */ |
|||
Long CsavedBAT1U; /* 33 */ |
|||
Long CsavedBAT1L; /* 34 */ |
|||
Long CsavedBAT2U; /* 35 */ |
|||
Long CsavedBAT2L; /* 36 */ |
|||
Long CsavedBAT3U; /* 37 */ |
|||
Long CsavedBAT3L; /* 38 */ |
|||
} |
|||
SpecialRegistersEnumerated; |
|||
|
|||
Long SpecialRegistersIndexed[kNumberSpecialRegisters]; |
|||
} u; |
|||
|
|||
Long Padding[3]; /* Needed for quad-word alignment */ |
|||
}; |
|||
|
|||
struct StackFrame |
|||
{ |
|||
LONG *ExceptionDomainID; |
|||
/*ProcessorStructure*/ int *ExceptionProcessorID; |
|||
BYTE *ExceptionDescription; |
|||
LONG ExceptionFlags; |
|||
LONG ExceptionErrorCode; |
|||
LONG ExceptionNumber; |
|||
struct SavedMachineState ExceptionState; |
|||
}; |
|||
|
|||
/* Register values. All of these values *MUST* agree with tm.h */ |
|||
#define GP0_REGNUM 0 /* GPR register 0 */ |
|||
#define SP_REGNUM 1 /* Contains address of top of stack */ |
|||
#define FP0_REGNUM 32 /* FPR (Floating point) register 0 */ |
|||
#define PC_REGNUM 64 /* Contains program counter */ |
|||
#define PS_REGNUM 65 /* Processor (or machine) status (%msr) */ |
|||
#define CR_REGNUM 66 /* Condition register */ |
|||
#define LR_REGNUM 67 /* Link register */ |
|||
#define CTR_REGNUM 68 /* Count register */ |
|||
#define XER_REGNUM 69 /* Fixed point exception registers */ |
|||
#define MQ_REGNUM 70 /* Multiply/quotient register */ |
|||
#define NUM_REGS 71 /* Number of machine registers */ |
|||
#define REGISTER_BYTES (420) /* Total size of registers array */ |
|||
|
|||
#define ExceptionPC ExceptionState.u.SpecialRegistersEnumerated.CsavedSRR0 |
|||
#define DECR_PC_AFTER_BREAK 0 /* PPCs get this right! */ |
|||
#define BREAKPOINT {0x7d, 0x82, 0x10, 0x08} |
|||
extern unsigned char breakpoint_insn[]; |
|||
#define BREAKPOINT_SIZE 4 |
|||
|
|||
#define ALTERNATE_MEM_FUNCS /* We need our own get_char/set_char */ |
|||
|
|||
extern int get_char (char *addr); |
|||
extern void set_char (char *addr, int val); |
|||
Binary file not shown.
Loading…
Reference in new issue