// Called to start an M. void runtime·mstart(void) { // It is used by windows-386 only. Unfortunately, seh needs // to be located on os stack, and mstart runs on os stack // for both m0 and m. SEH seh; if(g != m->g0) runtime·throw("bad runtime·mstart"); // Record top of stack for use by mcall. // Once we call schedule we're never coming back, // so other calls can reuse this stack space. runtime·gosave(&m->g0->sched); m->g0->sched.pc = (void*)-1; // make sure it is never used m->seh = &seh; runtime·asminit(); runtime·minit(); // Install signal handlers; after minit so that minit can // prepare the thread to be able to handle the signals. if(m == &runtime·m0) runtime·initsig(); schedule(nil); // TODO(brainman): This point is never reached, because scheduler // does not release os threads at the moment. But once this path // is enabled, we must remove our seh here. }
int main (void) { int argc; char **argv; char **envp; /* These variables are used by the WEL library */ ghInstance = GetModuleHandle(NULL); eif_hInstance = GetModuleHandle(NULL); eif_hPrevInstance = NULL; eif_lpCmdLine = GetCommandLine(); eif_nCmdShow = SW_SHOW; /* Initialization of the command line which is going to be passed to eiffel */ get_argcargv (&argc, &argv); /* We get ANSI version of environment variables */ envp = (char **) GetEnvironmentStringsA(); eif_alloc_init(); #ifdef EIF_THREADS eif_thr_init_root(); #endif { GTCX struct ex_vect *exvect; jmp_buf exenv; egc_init_plug(); initsig(); initstk(); exvect = exset((char *) 0, 0, (char *) 0); exvect->ex_jbuf = &exenv; if (setjmp(exenv)) failure(); eif_retrieve_root (&argc, argv); eif_rtinit(argc, argv, envp); eif_init_root(); egc_rcdt_init(); emain(argc, argv); free_argv (&argv); reclaim(); } FreeEnvironmentStringsA ((LPSTR) envp); exit(0); return 0; }
// Called to start an M. void runtime·mstart(void) { if(g != m->g0) runtime·throw("bad runtime·mstart"); // Record top of stack for use by mcall. // Once we call schedule we're never coming back, // so other calls can reuse this stack space. runtime·gosave(&m->g0->sched); m->g0->sched.pc = (void*)-1; // make sure it is never used runtime·asminit(); runtime·minit(); // Install signal handlers; after minit so that minit can // prepare the thread to be able to handle the signals. if(m == &runtime·m0) runtime·initsig(); schedule(nil); }