/* * This is a DiOS configuration used in the static checking (SHOOP) mode. * At the moment, it is derived from the null configuration (i.e. it traps on every syscall) */ #include #include #include #define SYSCALL( name, schedule, ret, arg ) ret SysProxy::name arg noexcept { __builtin_trap(); } namespace __dios { #include } #undef SYSCALL #include #include #include #include #include #include #include __BEGIN_DECLS void *__dios_term_init(); // This is the hook point for the currently tested function void __tester(); void __assert_precondition( bool v ) { if ( !v ) __dios_fault( _VM_F_Assert, "precondition failed" ); } void __fault_handler( _VM_Fault, _VM_Frame *, void (*)() ) { __vm_ctl_flag( 0, _VM_CF_Error ); __vm_suspend(); } void __scheduler() { auto tls = __CAST( struct __dios_tls *, __vm_obj_make( sizeof( struct __dios_tls ), _VM_PT_Heap ) ); tls->__rst_stack_frames = __vm_obj_make( sizeof( void * ), _VM_PT_Heap ); __vm_ctl_set( _VM_CR_User2, tls ); __dios_tainted_init(); __dios_term_init(); __tester(); // TODO: __vm_suspend calls the scheduler again. Do we want this? Shouldn't we stop here completely? __vm_suspend(); } void __dios_boot( const _VM_Env * ) { __vm_ctl_set( _VM_CR_FaultHandler, reinterpret_cast< void * >( __fault_handler ) ); __vm_ctl_set( _VM_CR_Scheduler, reinterpret_cast< void * >( __scheduler ) ); __vm_ctl_set( _VM_CR_State, __vm_obj_make( 4, _VM_PT_Heap ) ); __vm_suspend(); } void __boot( const _VM_Env *env ) { __dios_boot( env ); __vm_suspend(); } __END_DECLS