int main( void ) { union { struct _proc_emul87 s; struct _proc_emul87_reply r; } msg; int i; #ifdef QNX16 if( _32bit ) { #else if( !_32bit ) { #endif Msg( "incorrect process manager for " EMU "\n" ); return( 2 ); } msg.s.type = _PROC_EMUL87; msg.s.segment = FP_SEG( __int7 ); msg.s.offset = FP_OFF( __int7 ); msg.s.nbytes = 128; /* size of emulator save area */ Send( PROC_PID, &msg.s, &msg.r, sizeof( msg.s ), sizeof( msg.r ) ); if( msg.r.status != EOK ) { Msg( "unable to attach " EMU "\n" ); return( 2 ); } /* close all file descriptors to release console */ for( i = 0; i < 10; ++i ) { close( i ); } for( ;; ) { Receive( 0, &msg, 0 ); } return( 0 ); } static int has_fpu( void ) { union { struct _proc_osinfo s; struct _proc_osinfo_reply r; } msg; msg.s.type = _PROC_OSINFO; Send( PROC_PID, &msg.s, &msg.r, sizeof( msg.s ), sizeof( msg.r ) ); if( msg.r.data.sflags & _PSF_32BIT ) { _32bit = 1; } else { _32bit = 0; } return( msg.r.data.fpu != 0 ); } #ifdef __386__ void _CMain( int argc, char **argv, char **arge ) { int install; char *cp; int rc; cp = ( argc >= 2 ) ? argv[1] : ""; #else void _CMain( void __near *free, /* start of free space */ short unsigned n, /* number of bytes */ struct _proc_spawn __near *cmd, /* pointer to spawn msg */ short unsigned stk_bot, /* bottom of stack */ pid_t my_pid ) /* my pid */ { int install; char *cp; int argc; int rc; argc = cmd->argc; cp = cmd->data; while( *cp != '\0' ) /* skip executable name */ ++cp; ++cp; while( *cp != '\0' ) /* skip argv[0] */ ++cp; ++cp; #endif if( *cp == '?' ) { Msg( USAGE ); __qnx_exit( 0 ); } install = 1; if( has_fpu() ) install = 0; if( argc >= 2 ) { #if 0 while( *cp != '\0' ) /* skip command name */ ++cp; ++cp; #endif if( cp[0] == '-' && cp[1] == 'f' ) { if( !install ) { Msg( EMU " force install\n" ); } install = 1; } } rc = 0; if( install ) rc = main(); __qnx_exit( rc ); }
void __CEndThread( void ) /***********************/ { __QNXRemoveThread(); __qnx_exit( 0 ); }
void KillDebugger( void ) { __qnx_exit( 0 ); }