From 3e762ff7342f9d82b7d8df54db9558158332ac02 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 18 Apr 2022 02:20:22 +0200 Subject: [PATCH] cleanup machine specific data processing --- bld/sdk/drwat/nt/digcli.c | 26 ++++++++++-------- bld/sdk/drwat/win/digcli.c | 13 ++++----- bld/trap/lcl/dos/dosx/cw/c/cwacc.c | 12 ++++---- bld/trap/lcl/dos/dosx/pls/c/plsacc.c | 9 ++++-- bld/trap/lcl/dos/dosx/rsi/c/rsiacc.c | 15 ++++++---- bld/trap/lcl/elfcore/c/elfcore.c | 9 ++++-- bld/trap/lcl/jvm/c/jvmacc.c | 4 +-- bld/trap/lcl/linux/c/lnxcore.c | 9 ++++-- bld/trap/lcl/linux/c/lnxmips.c | 4 +-- bld/trap/lcl/linux/c/lnxppc.c | 4 +-- bld/trap/lcl/linux/c/lnxx86.c | 9 ++++-- bld/trap/lcl/msj/c/msjacc.c | 4 +-- bld/trap/lcl/nt/c/accmisc.c | 41 +++++++++++++++++++--------- bld/trap/lcl/nto/c/ntoacc.c | 9 ++++-- bld/trap/lcl/os2v2/c/os2v2acc.c | 9 ++++-- bld/trap/lcl/qnx/c/qnxacc.c | 17 +++++++----- bld/trap/lcl/qnx/c/qnxpmd.c | 9 ++++-- bld/trap/lcl/rdos/c/accmisc.c | 9 ++++-- bld/trap/lcl/win/c/accmisc.c | 9 ++++-- bld/wprof/c/diginter.c | 29 ++++++++++++-------- bld/wv/c/remcore.c | 25 +++++++++-------- bld/wv/h/remcore.h | 3 +- 22 files changed, 167 insertions(+), 111 deletions(-) diff --git a/bld/sdk/drwat/nt/digcli.c b/bld/sdk/drwat/nt/digcli.c index 3a17a53d08..04667d3534 100644 --- a/bld/sdk/drwat/nt/digcli.c +++ b/bld/sdk/drwat/nt/digcli.c @@ -2,6 +2,7 @@ * * Open Watcom Project * +* Copyright (c) 2002-2022 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -182,23 +183,26 @@ unsigned DIGCLIENTRY( MachineData )( address addr, dig_info_type info_type, /* unused parameters */ (void)addr; (void)info_type; (void)in_size; (void)in; (void)out_size; (void)out; #endif -#if defined( _M_IX86 ) - enum x86_addr_characteristics *a_char; - switch( SysConfig.arch ) { +#if defined( _M_IX86 ) case DIG_ARCH_X86: - a_char = out; - *a_char = X86AC_BIG; - return( sizeof( *a_char ) ); - } + if( info_type == X86MD_ADDR_CHARACTERISTICS ) { + *(x86_addrflags *)out = X86AC_BIG; + return( sizeof( x86_addrflags ) ); + } + break; #elif defined( __AXP__ ) #if 0 - switch( SysConfig.arch ) { case DIG_ARCH_AXP: - memcpy( out, in, sizeof( axp_data ) ); - return( sizeof( axp_data ) ); - } + if( info_type == AXPMD_PDATA ) { + memcpy( out, in, sizeof( axp_data ) ); + return( sizeof( axp_data ) ); + } + break; #endif #endif + default: + break; + } return( 0 ); } diff --git a/bld/sdk/drwat/win/digcli.c b/bld/sdk/drwat/win/digcli.c index 268374bae4..5ce8315aaa 100644 --- a/bld/sdk/drwat/win/digcli.c +++ b/bld/sdk/drwat/win/digcli.c @@ -2,7 +2,7 @@ * * Open Watcom Project * -* Copyright (c) 2002-2020 The Open Watcom Contributors. All Rights Reserved. +* Copyright (c) 2002-2022 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -205,7 +205,8 @@ void DIGCLIENTRY( Close )( FILE *fp ) */ void DIGCLIENTRY( Remove )( const char *path, dig_open mode ) { - mode = mode; + /* unused parameters */ (void)mode; + remove( path ); } @@ -217,11 +218,7 @@ unsigned DIGCLIENTRY( MachineData )( address addr, dig_info_type info_type, dig_elen in_size, const void *in, dig_elen out_size, void *out ) { - addr = addr; - info_type = info_type; - in_size = in_size; - in = in; - out_size = out_size; - out = out; + /* unused parameters */ (void)addr; (void)info_type; (void)in_size; (void)in; (void)out_size; (void)out; + return( 0 ); } diff --git a/bld/trap/lcl/dos/dosx/cw/c/cwacc.c b/bld/trap/lcl/dos/dosx/cw/c/cwacc.c index 3794bc0949..3f7f803b22 100644 --- a/bld/trap/lcl/dos/dosx/cw/c/cwacc.c +++ b/bld/trap/lcl/dos/dosx/cw/c/cwacc.c @@ -1022,22 +1022,20 @@ trap_retval TRAP_CORE( Machine_data )( void ) machine_data_req *acc; machine_data_ret *ret; machine_data_spec *data; - trap_elen len; _DBG( "AccMachineData\r\n" ); acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); ret->cache_start = 0; - ret->cache_end = 0; - len = 0; + ret->cache_end = ~(addr_off)0; if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { - ret->cache_end = ~(addr_off)0; data = GetOutPtr( sizeof( *ret ) ); - len = sizeof( data->x86_addr_flags ); data->x86_addr_flags = ( IsSel32bit( acc->addr.segment ) ) ? X86AC_BIG : 0; + _DBG( "address %x:%x is %s\r\n", acc->addr.segment, acc->addr.offset, data->x86_addr_flags ? "32-bit" : "16-bit" ); + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); } - _DBG( "address %x:%x is %s\r\n", acc->addr.segment, acc->addr.offset, data->x86_addr_flags ? "32-bit" : "16-bit" ); - return( sizeof( *ret ) + len ); + _DBG( "address %x:%x\r\n", acc->addr.segment, acc->addr.offset ); + return( sizeof( *ret ) ); } trap_version TRAPENTRY TrapInit( const char *parms, char *err, bool remote ) diff --git a/bld/trap/lcl/dos/dosx/pls/c/plsacc.c b/bld/trap/lcl/dos/dosx/pls/c/plsacc.c index 4df36b943e..bcd7fabee5 100644 --- a/bld/trap/lcl/dos/dosx/pls/c/plsacc.c +++ b/bld/trap/lcl/dos/dosx/pls/c/plsacc.c @@ -249,11 +249,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = ( IsProtSeg( acc->addr.segment ) ) ? X86AC_BIG : 0; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = ( IsProtSeg( acc->addr.segment ) ) ? X86AC_BIG : 0; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } static ULONG RealAddr( PTR386 *addr ) diff --git a/bld/trap/lcl/dos/dosx/rsi/c/rsiacc.c b/bld/trap/lcl/dos/dosx/rsi/c/rsiacc.c index 85c1f65b15..2616a1b39d 100644 --- a/bld/trap/lcl/dos/dosx/rsi/c/rsiacc.c +++ b/bld/trap/lcl/dos/dosx/rsi/c/rsiacc.c @@ -257,16 +257,19 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = 0; - if( rsi_addr32_check( 0, acc->addr.segment, 1, NULL ) == MEMBLK_VALID ) { - if( GetLAR( acc->addr.segment ) & 0x400000 ) { - data->x86_addr_flags = X86AC_BIG; + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = 0; + if( rsi_addr32_check( 0, acc->addr.segment, 1, NULL ) == MEMBLK_VALID ) { + if( GetLAR( acc->addr.segment ) & 0x400000 ) { + data->x86_addr_flags = X86AC_BIG; + } } + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); } - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Checksum_mem )( void ) diff --git a/bld/trap/lcl/elfcore/c/elfcore.c b/bld/trap/lcl/elfcore/c/elfcore.c index c35f073def..2be39b7777 100644 --- a/bld/trap/lcl/elfcore/c/elfcore.c +++ b/bld/trap/lcl/elfcore/c/elfcore.c @@ -698,11 +698,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = X86AC_BIG; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = X86AC_BIG; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Get_lib_name )( void ) diff --git a/bld/trap/lcl/jvm/c/jvmacc.c b/bld/trap/lcl/jvm/c/jvmacc.c index eef6e6f8fc..0ed5a80808 100644 --- a/bld/trap/lcl/jvm/c/jvmacc.c +++ b/bld/trap/lcl/jvm/c/jvmacc.c @@ -334,11 +334,11 @@ trap_retval TRAP_CORE( Machine_data )( void ) { machine_data_req *acc; machine_data_ret *ret; - machine_data_spec *data; +// machine_data_spec *data; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); +// data = GetOutPtr( sizeof( *ret ) ); return( sizeof( *ret ) ); } diff --git a/bld/trap/lcl/linux/c/lnxcore.c b/bld/trap/lcl/linux/c/lnxcore.c index b461f98f63..9ee2efc541 100644 --- a/bld/trap/lcl/linux/c/lnxcore.c +++ b/bld/trap/lcl/linux/c/lnxcore.c @@ -632,11 +632,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = X86AC_BIG; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = X86AC_BIG; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Get_lib_name )( void ) diff --git a/bld/trap/lcl/linux/c/lnxmips.c b/bld/trap/lcl/linux/c/lnxmips.c index 3fab0679fe..201358f876 100644 --- a/bld/trap/lcl/linux/c/lnxmips.c +++ b/bld/trap/lcl/linux/c/lnxmips.c @@ -184,11 +184,11 @@ trap_retval TRAP_CORE( Machine_data )( void ) { machine_data_req *acc; machine_data_ret *ret; - machine_data_spec *data; +// machine_data_spec *data; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); +// data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; return( sizeof( *ret ) ); diff --git a/bld/trap/lcl/linux/c/lnxppc.c b/bld/trap/lcl/linux/c/lnxppc.c index b34874d906..6f462c517e 100644 --- a/bld/trap/lcl/linux/c/lnxppc.c +++ b/bld/trap/lcl/linux/c/lnxppc.c @@ -193,11 +193,11 @@ trap_retval TRAP_CORE( Machine_data )( void ) { machine_data_req *acc; machine_data_ret *ret; - machine_data_spec *data; +// machine_data_spec *data; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); +// data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; return( sizeof( *ret ) ); diff --git a/bld/trap/lcl/linux/c/lnxx86.c b/bld/trap/lcl/linux/c/lnxx86.c index 11d4cfbd6f..b3b894377c 100644 --- a/bld/trap/lcl/linux/c/lnxx86.c +++ b/bld/trap/lcl/linux/c/lnxx86.c @@ -418,11 +418,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = X86AC_BIG; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = X86AC_BIG; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } const char *const ExceptionMsgs[33] = { diff --git a/bld/trap/lcl/msj/c/msjacc.c b/bld/trap/lcl/msj/c/msjacc.c index 9f478ad4ea..c4c156cfc0 100644 --- a/bld/trap/lcl/msj/c/msjacc.c +++ b/bld/trap/lcl/msj/c/msjacc.c @@ -574,11 +574,11 @@ trap_retval TRAP_CORE( Machine_data )( void ) { machine_data_req *acc; machine_data_ret *ret; - machine_data_spec *data; +// machine_data_spec *data; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); +// data = GetOutPtr( sizeof( *ret ) ); return sizeof( *ret ); } diff --git a/bld/trap/lcl/nt/c/accmisc.c b/bld/trap/lcl/nt/c/accmisc.c index db4ea96846..d98b2aaa0f 100644 --- a/bld/trap/lcl/nt/c/accmisc.c +++ b/bld/trap/lcl/nt/c/accmisc.c @@ -121,28 +121,43 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); #if defined( MD_x86 ) ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = ( IsBigSel( acc->addr.segment ) ) ? X86AC_BIG : (( IsDOS ) ? X86AC_REAL : 0); - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = ( IsBigSel( acc->addr.segment ) ) ? X86AC_BIG : (( IsDOS ) ? X86AC_REAL : 0); + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); #elif defined( MD_x64 ) ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x64_addr_flags = ( IsBigSel( acc->addr.segment ) ) ? X6AC_BIG : 0; - return( sizeof( *ret ) + sizeof( data->x64_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x64_addr_flags = ( IsBigSel( acc->addr.segment ) ) ? X6AC_BIG : 0; + return( sizeof( *ret ) + sizeof( data->x64_addr_flags ) ); + } + return( sizeof( *ret ) ); #elif defined( MD_axp ) - memset( &data->axp_pdata, 0, sizeof( data->axp_pdata ) ); - if( FindPData( acc->addr.offset, &data->axp_pdata ) ) { - ret->cache_start = data->axp_pdata.beg_addr.u._32[0]; - ret->cache_end = data->axp_pdata.end_addr.u._32[0]; - } else { - ret->cache_start = 0; - ret->cache_end = 0; + if( acc->info_type == AXPMD_PDATA ) { + data = GetOutPtr( sizeof( *ret ) ); + memset( &data->axp_pdata, 0, sizeof( data->axp_pdata ) ); + if( FindPData( acc->addr.offset, &data->axp_pdata ) ) { + ret->cache_start = data->axp_pdata.beg_addr.u._32[0]; + ret->cache_end = data->axp_pdata.end_addr.u._32[0]; + } else { + ret->cache_start = 0; + ret->cache_end = 0; + } + return( sizeof( *ret ) + sizeof( data->axp_pdata ) ); } - return( sizeof( *ret ) + sizeof( data->axp_pdata ) ); + ret->cache_start = 0; + ret->cache_end = ~(addr_off)0; + return( sizeof( *ret ) ); #elif defined( MD_ppc ) + ret->cache_start = 0; + ret->cache_end = ~(addr_off)0; return( sizeof( *ret ) ); #else #error TRAP_CORE( Machine_data ) not configured diff --git a/bld/trap/lcl/nto/c/ntoacc.c b/bld/trap/lcl/nto/c/ntoacc.c index 0b5f5c0719..4ade671697 100644 --- a/bld/trap/lcl/nto/c/ntoacc.c +++ b/bld/trap/lcl/nto/c/ntoacc.c @@ -1119,11 +1119,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = X86AC_BIG; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = X86AC_BIG; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } diff --git a/bld/trap/lcl/os2v2/c/os2v2acc.c b/bld/trap/lcl/os2v2/c/os2v2acc.c index b456c0f949..ebabeb4930 100644 --- a/bld/trap/lcl/os2v2/c/os2v2acc.c +++ b/bld/trap/lcl/os2v2/c/os2v2acc.c @@ -696,11 +696,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = ( Is32BitSeg( acc->addr.segment ) ) ? X86AC_BIG : 0; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = ( Is32BitSeg( acc->addr.segment ) ) ? X86AC_BIG : 0; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Checksum_mem )( void ) diff --git a/bld/trap/lcl/qnx/c/qnxacc.c b/bld/trap/lcl/qnx/c/qnxacc.c index fadce4ded7..d81791c758 100644 --- a/bld/trap/lcl/qnx/c/qnxacc.c +++ b/bld/trap/lcl/qnx/c/qnxacc.c @@ -1529,17 +1529,20 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = 0; - if( ProcInfo.proc32 ) { - qnx_segment_info( ProcInfo.proc, ProcInfo.pid, acc->addr.segment, &info ); - if( info.flags & _PMF_DBBIT ) { - data->x86_addr_flags = X86AC_BIG; + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = 0; + if( ProcInfo.proc32 ) { + qnx_segment_info( ProcInfo.proc, ProcInfo.pid, acc->addr.segment, &info ); + if( info.flags & _PMF_DBBIT ) { + data->x86_addr_flags = X86AC_BIG; + } } + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); } - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Get_lib_name )( void ) diff --git a/bld/trap/lcl/qnx/c/qnxpmd.c b/bld/trap/lcl/qnx/c/qnxpmd.c index 4806ca9700..299707db02 100644 --- a/bld/trap/lcl/qnx/c/qnxpmd.c +++ b/bld/trap/lcl/qnx/c/qnxpmd.c @@ -731,11 +731,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = ( AddrIs32( acc->addr.segment ) ) ? X86AC_BIG : 0; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = ( AddrIs32( acc->addr.segment ) ) ? X86AC_BIG : 0; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Get_lib_name )( void ) diff --git a/bld/trap/lcl/rdos/c/accmisc.c b/bld/trap/lcl/rdos/c/accmisc.c index 3cc14478ff..282ff87754 100644 --- a/bld/trap/lcl/rdos/c/accmisc.c +++ b/bld/trap/lcl/rdos/c/accmisc.c @@ -51,7 +51,6 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); sel = acc->addr.segment; if( RdosGetSelectorInfo( sel, &size, &bitness ) ) { if( size > 0xFFFF ) { @@ -63,8 +62,12 @@ trap_retval TRAP_CORE( Machine_data )( void ) } ret->cache_start = 0; ret->cache_end = size; - data->x86_addr_flags = ( bitness == 32 ) ? X86AC_BIG : 0; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = ( bitness == 32 ) ? X86AC_BIG : 0; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Get_sys_config )( void ) diff --git a/bld/trap/lcl/win/c/accmisc.c b/bld/trap/lcl/win/c/accmisc.c index 85fd4c1682..51df85426f 100644 --- a/bld/trap/lcl/win/c/accmisc.c +++ b/bld/trap/lcl/win/c/accmisc.c @@ -66,11 +66,14 @@ trap_retval TRAP_CORE( Machine_data )( void ) acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); - data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; - data->x86_addr_flags = ( IsSegSize32( acc->addr.segment ) ) ? X86AC_BIG : 0; - return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + if( acc->info_type == X86MD_ADDR_CHARACTERISTICS ) { + data = GetOutPtr( sizeof( *ret ) ); + data->x86_addr_flags = ( IsSegSize32( acc->addr.segment ) ) ? X86AC_BIG : 0; + return( sizeof( *ret ) + sizeof( data->x86_addr_flags ) ); + } + return( sizeof( *ret ) ); } trap_retval TRAP_CORE( Get_sys_config )( void ) diff --git a/bld/wprof/c/diginter.c b/bld/wprof/c/diginter.c index a59f186491..0eaccc61c3 100644 --- a/bld/wprof/c/diginter.c +++ b/bld/wprof/c/diginter.c @@ -2,7 +2,7 @@ * * Open Watcom Project * -* Copyright (c) 2017-2017 The Open Watcom Contributors. All Rights Reserved. +* Copyright (c) 2017-2022 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -135,21 +135,28 @@ unsigned DIGCLIENTRY( MachineData )( address addr, unsigned info_type, dig_elen out_size, void *out ) /********************************************************************/ { - enum x86_addr_characteristics *d; - - /* unused parameters */ (void)info_type; (void)in_size; (void)in; (void)out_size; + /* unused parameters */ (void)in_size; (void)in; (void)out_size; switch( CurrSIOData->config.arch ) { case DIG_ARCH_X86: - d = out; - *d = 0; - if( IsX86BigAddr( addr ) ) { - *d |= X86AC_BIG; + if( info_type == X86MD_ADDR_CHARACTERISTICS ) { + *(x86_addrflags *)out = 0; + if( IsX86BigAddr( addr ) ) { + *(x86_addrflags *)out = X86AC_BIG; + } else if( IsX86RealAddr( addr ) ) { + *(x86_addrflags *)out = X86AC_REAL; + } + return( sizeof( x86_addrflags ) ); } - if( IsX86RealAddr( addr ) ) { - *d |= X86AC_REAL; + break; +#if 0 + case DIG_ARCH_AXP: + if( acc->info_type == AXPMD_PDATA ) { + memcpy( out, in, sizeof( axp_data ) ); + return( sizeof( axp_data ) ); } - return( sizeof( *d ) ); + break; +#endif /* add other machines here */ } return( 0 ); diff --git a/bld/wv/c/remcore.c b/bld/wv/c/remcore.c index 2ea554675d..b833071f7e 100644 --- a/bld/wv/c/remcore.c +++ b/bld/wv/c/remcore.c @@ -2,6 +2,7 @@ * * Open Watcom Project * +* Copyright (c) 2002-2022 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -58,17 +59,17 @@ extern trap_elen CurrRegSize; #define MAX_ERR_MSG_SIZE 80 typedef struct{ - address addr; - size_t len; - char *data; + address addr; + size_t len; + char *data; } cache_block; typedef struct { - address addr; - addr48_off end; - unsigned info; - size_t len; - unsigned_8 data[1]; /* variable sized */ + address addr; + addr48_off end; + dig_info_type info_type; + size_t len; + unsigned_8 data[1]; /* variable sized */ } machine_data_cache; static cache_block Cache; @@ -545,7 +546,7 @@ unsigned RemoteGetMsgText( char *buff, trap_elen buff_len ) return( ret.flags ); } -unsigned RemoteMachineData( address addr, uint_8 info_type, +unsigned RemoteMachineData( address addr, dig_info_type info_type, dig_elen in_size, const void *inp, dig_elen out_size, void *outp ) { @@ -556,7 +557,7 @@ unsigned RemoteMachineData( address addr, uint_8 info_type, unsigned len; machine_data_cache *new; - if( info_type == MData->info + if( info_type == MData->info_type && addr.mach.offset >= MData->addr.mach.offset && addr.mach.offset < MData->end && SameAddrSpace( addr, MData->addr ) ) { @@ -564,7 +565,7 @@ unsigned RemoteMachineData( address addr, uint_8 info_type, return( out_size ); } acc.req = REQ_MACHINE_DATA; - acc.info_type = info_type; + acc.info_type = (unsigned_8)info_type; acc.addr = addr.mach; in[0].ptr = &acc; in[0].len = sizeof( acc ); @@ -589,7 +590,7 @@ unsigned RemoteMachineData( address addr, uint_8 info_type, MData->addr = addr; MData->addr.mach.offset = ret.cache_start; MData->end = ret.cache_end; - MData->info = info_type; + MData->info_type = info_type; MData->len = len; return( len ); } diff --git a/bld/wv/h/remcore.h b/bld/wv/h/remcore.h index 1e0ecafb8e..b559565303 100644 --- a/bld/wv/h/remcore.h +++ b/bld/wv/h/remcore.h @@ -2,6 +2,7 @@ * * Open Watcom Project * +* Copyright (c) 2002-2022 The Open Watcom Contributors. All Rights Reserved. * Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved. * * ======================================================================== @@ -51,7 +52,7 @@ extern void RemoteSetDebugScreen( void ); extern unsigned RemoteReadUserKey( uint_16 wait ); extern unsigned long RemoteGetLibName( unsigned long lib_hdl, char *buff, trap_elen buff_len ); extern unsigned RemoteGetMsgText( char *buff, trap_elen buff_len ); -extern unsigned RemoteMachineData( address addr, uint_8 info_type, dig_elen in_size, const void *inp, dig_elen out_size, void *outp ); +extern unsigned RemoteMachineData( address addr, dig_info_type info_type, dig_elen in_size, const void *inp, dig_elen out_size, void *outp ); extern dword RemoteSetBreak( address addr ); extern void RemoteRestoreBreak( address addr, dword value ); extern bool RemoteSetWatch( address addr, uint_8 size, unsigned long *mult );