unsigned ReqMap_addr( void ) { map_addr_req *acc; map_addr_ret *ret; if( !TaskLoaded ) { acc = GetInPtr(0); ret = GetOutPtr(0); ret->out_addr = acc->in_addr; ret->lo_bound = 0; ret->hi_bound = ~(addr48_off)0; return( sizeof( *ret ) ); } return( DoAccess() ); }
trap_retval ReqMachine_data( void ) { machine_data_ret *ret; unsigned_8 *data; if( !TaskLoaded ) { ret = GetOutPtr( 0 ); data = GetOutPtr( sizeof( *ret ) ); ret->cache_start = 0; ret->cache_end = ~(addr_off)0; *data = X86AC_BIG; return( sizeof( *ret ) + sizeof( *data ) ); } return( DoAccess() ); }
unsigned ReqProg_go( void ) { prog_go_ret *ret; unsigned len; if( !TaskLoaded ) { ret = GetOutPtr( 0 ); ret->conditions = COND_TERMINATE; return( sizeof( *ret ) ); } RestoreVectors( CurrVectors ); len = DoAccess(); SaveVectors( CurrVectors ); RestoreVectors( LoadVectors ); return( len ); }
trap_retval ReqProg_kill( void ) { trap_elen len; prog_kill_ret *ret; if( !TaskLoaded ) { ret = GetOutPtr( 0 ); ret->err = 0; return( sizeof( *ret ) ); } len = DoAccess(); RemoteUnLink(); TaskLoaded = false; RestoreVectors( OrigVectors ); return( len ); }
unsigned ReqProg_kill( void ) { int len; prog_kill_ret *ret; if( !TaskLoaded ) { ret = GetOutPtr( 0 ); ret->err = 0; return( sizeof( *ret ) ); } len = DoAccess(); RemoteUnLink(); TaskLoaded = FALSE; RestoreVectors( OrigVectors ); return( len ); }
unsigned ReqGet_sys_config( void ) { get_sys_config_ret *ret; if( !TaskLoaded ) { ret = GetOutPtr(0); ret->sys.os = OS_IDUNNO; ret->sys.osmajor = 0; ret->sys.osminor = 0; ret->sys.fpu = X86_NO; ret->sys.huge_shift = 12; ret->sys.cpu = X86_386; ret->sys.mad = MAD_X86; return( sizeof( *ret ) ); } return( DoAccess() ); }
unsigned ReqClear_watch( void ) { return( DoAccess() ); }
unsigned ReqSet_watch( void ) { return( DoAccess() ); }
unsigned ReqWrite_regs( void ) { return( DoAccess() ); }
// OBSOLETE - use ReqWrite_regs unsigned ReqWrite_fpu( void ) { return( DoAccess() ); }
trap_retval ReqClear_watch( void ) { return( DoAccess() ); }
unsigned ReqGet_message_text( void ) { return( DoAccess() ); }
trap_retval ReqProg_load( void ) { char buffer[160]; char *src; char *dst; char *name; char *endparm; const char *err; tiny_ret_t rc; prog_load_ret *ret; trap_elen len; SaveVectors( OrigVectors ); _DBG_EnterFunc( "AccLoadProg()" ); ret = GetOutPtr( 0 ); src = name = GetInPtr( sizeof( prog_load_req ) ); rc = FindProgFile( src, buffer, DosExtList ); endparm = LinkParms; while( *endparm++ != '\0' ) {} // skip trap parameters strcpy( endparm, buffer ); // add command line // result is as follow // "trap parameters string"+"\0"+"command line string"+"\0" err = RemoteLink( LinkParms, false ); if( err != NULL ) { _DBG_Writeln( "Can't RemoteLink" ); TinyWrite( TINY_ERR, err, strlen( err ) ); LoadError = err; ret->err = 1; len = 0; } else { if( TINY_OK( rc ) ) { while( *src++ != '\0' ) {} len = GetTotalSize() - ( src - name ) - sizeof( prog_load_req ); dst = (char *)buffer; while( *dst++ != '\0' ) {}; memcpy( dst, src, len ); dst += len; _DBG_Writeln( "StartPacket" ); StartPacket(); _DBG_Writeln( "AddPacket" ); AddPacket( In_Mx_Ptr[0].ptr, sizeof( prog_load_req ) ); _DBG_Writeln( "AddPacket" ); AddPacket( buffer, dst - buffer ); _DBG_Writeln( "PutPacket" ); PutPacket(); _DBG_Writeln( "GetPacket" ); len = GetPacket(); _DBG_Writeln( "RemovePacket" ); RemovePacket( ret, sizeof( *ret ) ); } else { len = DoAccess(); } _DBG_Writeln( "Linked --" ); if( ret->err != 0 ) { get_err_text_req erracc; prog_kill_req killacc; trap_elen msg_len; _DBG_Writeln( "loadret->errcode != 0" ); if( LoadError == NULL ) { _DBG_Writeln( "making a REQ_GET_ERR_TEXT request" ); erracc.req = REQ_GET_ERR_TEXT; erracc.err = ret->err; _DBG_Writeln( "StartPacket" ); StartPacket(); _DBG_Writeln( "AddPacket" ); AddPacket( &erracc, sizeof( erracc ) ); _DBG_Writeln( "PutPacket" ); PutPacket(); _DBG_Writeln( "GetPacket" ); msg_len = GetPacket(); _DBG_Writeln( "RemovePacket" ); RemovePacket( FailMsg, msg_len ); _DBG_Write( "FailMsg : " ); _DBG_NoTabWriteln( FailMsg ); LoadError = FailMsg; } _DBG_Writeln( "making a REQ_PROG_KILL request" ); killacc.req = REQ_PROG_KILL; _DBG_Writeln( "StartPacket" ); StartPacket(); _DBG_Writeln( "AddPacket" ); AddPacket( &killacc, sizeof( killacc ) ); _DBG_Writeln( "PutPacket" ); PutPacket(); _DBG_Writeln( "GetPacket" ); GetPacket(); //RemovePacket( &erracc, msg_len ); RemoteUnLink(); TaskLoaded = false; } } if( ret->err == 0 ) { _DBG_Writeln( "loadret->error_code == 0" ); TaskLoaded = true; } SaveVectors( LoadVectors ); SaveVectors( CurrVectors ); _DBG_ExitFunc( "AccLoadProg()" ); return( len ); }
trap_retval ReqRedirect_stdout( void ) { return( DoAccess() ); }
trap_retval ReqGet_message_text( void ) { return( DoAccess() ); }
trap_retval ReqClear_break( void ) { return( DoAccess() ); }
trap_retval ReqSet_break( void ) { return( DoAccess() ); }
unsigned ReqSet_break( void ) { return( DoAccess() ); }
trap_retval ReqWrite_regs( void ) { return( DoAccess() ); }
unsigned ReqClear_break( void ) { return( DoAccess() ); }
unsigned ReqProg_load( void ) { char buffer[160]; char *src; char *dst; char *name; char *endparm; char *err; tiny_ret_t rc; prog_load_ret *ret; unsigned_16 len; SaveVectors( OrigVectors ); _DBG_EnterFunc( "AccLoadProg()" ); ret = GetOutPtr( 0 ); src = name = GetInPtr( sizeof( prog_load_req ) ); rc = FindFilePath( src, buffer, DosXExtList ); endparm = LinkParm; while( *endparm++ != '\0' ) {} // skip program name strcpy( endparm, buffer ); err = RemoteLink( LinkParm, 0 ); if( err != NULL ) { _DBG_Writeln( "Can't RemoteLink" ); TinyWrite( TINY_ERR, err, strlen( err ) ); LoadError = err; ret->err = 1; len = 0; } else { if( TINY_OK( rc ) ) { while( *src++ != '\0' ) {} len = GetTotalSize() - ( src - name ) - sizeof( prog_load_req ); dst = (char *)buffer; while( *dst++ != '\0' ) {}; memcpy( dst, src, len ); dst += len; _DBG_Writeln( "StartPacket" ); StartPacket(); _DBG_Writeln( "AddPacket" ); AddPacket( sizeof( prog_load_req ), In_Mx_Ptr[0].ptr ); _DBG_Writeln( "AddPacket" ); AddPacket( dst - buffer, buffer ); _DBG_Writeln( "PutPacket" ); PutPacket(); _DBG_Writeln( "GetPacket" ); len = GetPacket(); _DBG_Writeln( "RemovePacket" ); RemovePacket( sizeof( *ret ), ret ); } else { len = DoAccess(); } _DBG_Writeln( "Linked --" ); if( ret->err != 0 ) { get_err_text_req erracc; prog_kill_req killacc; int msg_len; _DBG_Writeln( "loadret->errcode != 0" ); if( LoadError == NULL ) { _DBG_Writeln( "making a REQ_GET_ERR_TEXT request" ); erracc.req = REQ_GET_ERR_TEXT; erracc.err = ret->err; _DBG_Writeln( "StartPacket" ); StartPacket(); _DBG_Writeln( "AddPacket" ); AddPacket( sizeof( erracc ), &erracc ); _DBG_Writeln( "PutPacket" ); PutPacket(); _DBG_Writeln( "GetPacket" ); msg_len = GetPacket(); _DBG_Writeln( "RemovePacket" ); RemovePacket( msg_len, FailMsg ); _DBG_Write( "FailMsg : " ); _DBG_NoTabWriteln( FailMsg ); LoadError = FailMsg; } _DBG_Writeln( "making a REQ_PROG_KILL request" ); killacc.req = REQ_PROG_KILL; _DBG_Writeln( "StartPacket" ); StartPacket(); _DBG_Writeln( "AddPacket" ); AddPacket( sizeof( killacc ), &killacc ); _DBG_Writeln( "PutPacket" ); PutPacket(); _DBG_Writeln( "GetPacket" ); GetPacket(); //RemovePacket( msg_len, &erracc ); RemoteUnLink(); TaskLoaded = FALSE; } } if( ret->err == 0 ) { _DBG_Writeln( "loadret->error_code == 0" ); TaskLoaded = TRUE; } SaveVectors( LoadVectors ); SaveVectors( CurrVectors ); _DBG_ExitFunc( "AccLoadProg()" ); return( len ); }
unsigned ReqRedirect_stdout( void ) { return( DoAccess() ); }
trap_retval ReqSet_watch( void ) { return( DoAccess() ); }