address GetRegBP( void ) { address addr; MADRegSpecialGet( MSR_FP, &DbgRegs->mr, &addr.mach ); AddrSection( &addr, OVL_MAP_CURR ); return( addr ); }
static address AddrRegIP( machine_state *regs ) { address addr; MADRegSpecialGet( MSR_IP, ®s->mr, &addr.mach ); AddrSection( &addr, OVL_MAP_CURR ); return( addr ); }
static void logStack( ExceptDlgInfo *info ) { unsigned_16 *data; int i; int j; address sp; DWORD linecnt; DWORD bytesread; mad_type_info host; mad_type_info mti; void *item; char buff[BUF_SIZE]; unsigned buff_len; unsigned word_size; #define MIN_SIZE sizeof( unsigned_16 ) MADRegSpecialGet( MSR_SP, info->regs, &( sp.mach ) ); MADTypeInfoForHost( MTK_ADDRESS, sizeof( address ), &host ); MADTypeInfo( MADTypeDefault( MTK_ADDRESS, MAF_FULL, NULL, &sp ), &mti ); item = alloca( BITS2BYTES( mti.b.bits ) + 1 ); #ifdef __AXP__ word_size = 8; #else word_size = 4; #endif data = alloca( word_size * 4 ); logPrintf( STR_STACK_DATA ); for( linecnt=0; linecnt < 20; linecnt ++ ) { bytesread = MADCliReadMem( sp, word_size * 4, data ); MADTypeConvert( &host, &sp, &mti, item, 0 ); buff_len = sizeof( buff ); MADTypeToString( 16, &mti, item, buff, &buff_len ); logStrPrintf( "%s - ", buff ); for( i = 0; i < bytesread / MIN_SIZE; i += word_size / MIN_SIZE ) { for( j = word_size / MIN_SIZE - 1; j >= 0; j-- ) { logStrPrintf( "%04hX", data[i+j]); } logStrPrintf( " " ); MADAddrAdd( &sp, word_size, MAF_FULL ); } logStrPrintf( "\n" ); } }
void GetCurrAddr(address *curr, mad_registers *regs ) { curr->sect_id=0; curr->indirect=0; MADRegSpecialGet( MSR_IP, regs, &(curr->mach) ); }