Skip to content

Commit

Permalink
cleanup machine specific data processing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Apr 18, 2022
1 parent 482b48a commit 3e762ff
Show file tree
Hide file tree
Showing 22 changed files with 167 additions and 111 deletions.
26 changes: 15 additions & 11 deletions bld/sdk/drwat/nt/digcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* ========================================================================
Expand Down Expand Up @@ -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 );
}
13 changes: 5 additions & 8 deletions bld/sdk/drwat/win/digcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
* ========================================================================
Expand Down Expand Up @@ -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 );
}

Expand All @@ -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 );
}
12 changes: 5 additions & 7 deletions bld/trap/lcl/dos/dosx/cw/c/cwacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/dos/dosx/pls/c/plsacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
15 changes: 9 additions & 6 deletions bld/trap/lcl/dos/dosx/rsi/c/rsiacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/elfcore/c/elfcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
4 changes: 2 additions & 2 deletions bld/trap/lcl/jvm/c/jvmacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}

Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/linux/c/lnxcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
4 changes: 2 additions & 2 deletions bld/trap/lcl/linux/c/lnxmips.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down
4 changes: 2 additions & 2 deletions bld/trap/lcl/linux/c/lnxppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/linux/c/lnxx86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
4 changes: 2 additions & 2 deletions bld/trap/lcl/msj/c/msjacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
41 changes: 28 additions & 13 deletions bld/trap/lcl/nt/c/accmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/nto/c/ntoacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}


Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/os2v2/c/os2v2acc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
17 changes: 10 additions & 7 deletions bld/trap/lcl/qnx/c/qnxacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
9 changes: 6 additions & 3 deletions bld/trap/lcl/qnx/c/qnxpmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
Loading

0 comments on commit 3e762ff

Please sign in to comment.