예제 #1
0
파일: libmain.c 프로젝트: ChenLanbo/OS-Lab
void
libmain(int argc, char **argv)
{
	// set env to point at our env structure in envs[].
	// LAB 3: Your code here.
	envid_t pid;

	env = 0;
	pid = sys_getenvid();
	env = (struct Env *)envs;
	env = env + ENVX(pid);
	// Debug info
	// cprintf("pid %u\n", pid);
	// cprintf("off %u\n", ENVX(pid));
	LOG(DEBUG_LIBMAIN, "In libmain, about to start user program %x\n", pid);

	// save the name of the program so that panic() can use it
	if (argc > 0)
		binaryname = argv[0];

	// call user main routine
	umain(argc, argv);

	// exit gracefully
	exit();
}
예제 #2
0
파일: main.c 프로젝트: dingxiao88/6.270
int robot_monitor (void) {
    // start the calibration period...

    printf("Running usetup()...\n");
    usetup();
    printf("Finished usetup().\n");

    printf("Waiting for RF start, or press Go to start now.\n");
    while (!rf_start && !go_press())
      yield();

    printf("Running umain()...\n");
    return umain();
}
예제 #3
0
void
libmain(int argc, char **argv)
{
	// Set thisenv to point at our Env structure in envs[]
	thisenv = &envs[ENVX(sys_getenvid())];

	// save the name of the program so that panic() can use it
	if (argc > 0)
		binaryname = argv[0];

	// call user main routine
	umain(argc, argv);

	// exit gracefully
	exit();
}
예제 #4
0
파일: libos.c 프로젝트: SivilTaram/Jos-mips
void
libmain(int argc, char **argv)
{
	// set env to point at our env structure in envs[].
	env = 0;	// Your code here.
	//writef("xxxxxxxxx %x  %x  xxxxxxxxx\n",argc,(int)argv);
	int envid;
	envid = syscall_getenvid();
	envid = ENVX(envid);
	env = &envs[envid];
	// call user main routine
	umain(argc, argv);
	// exit gracefully
	exit();
	//syscall_env_destroy(0);
}
예제 #5
0
파일: libmain.c 프로젝트: amisharma/OSLAB
void
libmain(int argc, char **argv)
{
	// set thisenv to point at our Env structure in envs[].
	// LAB 3: Your code here.
	thisenv = &envs[ENVX(sys_getenvid())];
	
	// save the name of the program so that panic() can use it
	if (argc > 0)
		binaryname = argv[0];
	// call user main routine
//	env_create(binaryname,ENV_TYPE_USER);
	umain(argc, argv);

	// exit gracefully
	exit();
}
예제 #6
0
파일: libmain.c 프로젝트: Hzwcode/MIT-JOS
void
libmain(int argc, char **argv)
{
    // set env to point at our env structure in envs[].
    // LAB 3: Your code here.
    env = envs + ENVX(sys_getenvid());

    // save the name of the program so that panic() can use it
    if (argc > 0)
        binaryname = argv[0];

    // call user main routine
    umain(argc, argv);

    // exit gracefully
    exit();
}
예제 #7
0
파일: libmain.c 프로젝트: jos-mmap/mmap
void
libmain(int argc, char **argv)
{
	// set thisenv to point at our Env structure in envs[].
	// LAB 3: Your code here.
	thisenv = (struct Env*)envs + ENVX(sys_getenvid());

	// save the name of the program so that panic() can use it
	if (argc > 0)
		binaryname = argv[0];

  mmapmd_init();

  set_pgfault_handler(mmap_pgfault);
	// call user main routine
	umain(argc, argv);

	// exit gracefully
	exit();
}
예제 #8
0
파일: libmain.c 프로젝트: bwang4958/my-jos
void
libmain(int argc, char **argv)
{
	// set thisenv to point at our Env structure in envs[].
	// LAB 3: Your code here.
	envid_t envid;
	struct Env *envs_convert = (struct Env *)envs;
	envid = sys_getenvid();
	thisenv = &envs_convert[ ENVX(envid) ];

	// save the name of the program so that panic() can use it
	if (argc > 0)
		binaryname = argv[0];

	// call user main routine
	umain(argc, argv);

	// exit gracefully
	exit();
}
예제 #9
0
        void
libmain(int argc, char **argv)
{
        // set env to point at our env structure in envs[].
        // LAB 3: Your code here.
        env = 0;
        // DEC 15,2010 sunus
        envid_t et = sys_getenvid();
#if S_DBG_PRINT_ENVID
        cprintf("Now curenvID = %d\n",ENVX(et));
#endif
        env = &envs[ENVX(et)];  
        // save the name of the program so that panic() can use it
        if (argc > 0)
                binaryname = argv[0];

        // call user main routine
        umain(argc, argv);

        // exit gracefully
        exit();
}
예제 #10
0
파일: main.c 프로젝트: tioui/EiffelStudio
rt_public void eif_rtinit(int argc, EIF_NATIVE_CHAR **argv, EIF_NATIVE_CHAR **envp)
{
	char *eif_timeout;

		/* Retrieve root argument if any and update `argc' accordingly. */
	eif_retrieve_root(&argc, argv);

#ifdef EIF_WINDOWS
	set_windows_exception_filter();

#if defined(_MSC_VER) && _MSC_VER >= 1400 /* version 14.0+ (MSVC 8.0+)  */
		/* Ensures consistent behavior across all our platforms where we
		 * get 2-digit exponent up to 99 and then 3-digit exponent for 100 and
		 * above. */
   (void) _set_output_format(_TWO_DIGIT_EXPONENT);
#endif

#endif

#ifdef BOEHM_GC
	GC_register_displacement (OVERHEAD);
#endif

	ieee_init();
	starting_working_directory = (char *) eif_malloc (PATH_MAX + 1);
		/* Initialize directory to an empty string by default. */
	starting_working_directory [0] = '\0';

	ufill();							/* Get urgent memory chunks */

#if defined(DEBUG) && (EIF_OS != EIF_OS_VXWORKS) && !defined(EIF_WINDOWS)
	/* The following install signal handlers for signals USR1 and USR2. Both
	 * raise an immediate scanning of memory and dumping of the free list usage
	 * and other statistics. The difference is that USR1 also performrs a full
	 * GC cycle before runnning the diagnosis. If memck() is programmed to
	 * panic when inconsistencies are detected, this may raise a system failure
	 * due to race condition. There is nothing the user can do about it, except
	 * pray--RAM.
	 */

	esignal(SIGUSR1, mem_diagnose);
	esignal(SIGUSR2, mem_diagnose);
#endif

	/* Check if the user wants to override the default timeout value
	 * for interprocess communications (IPC). This new value is specified in
	 * the ISE_TIMEOUT environment variable
	 */
	eif_timeout = getenv("ISE_TIMEOUT");
	if ((eif_timeout != NULL) && (strlen(eif_timeout) > 0)) {		/* Environment variable set */
		TIMEOUT = (unsigned) atoi(eif_timeout);
	} else {
		TIMEOUT = 30;
	}

	eoption = egc_foption;

#ifdef WORKBENCH
	xinitint();							/* Interpreter initialization */
	esystem = egc_fsystem;
	eif_par_table = egc_partab;
	eif_par_table_size = egc_partab_size;
	eorg_table = egc_forg_table;
	pattern = egc_fpattern;

	debug_initialize(); /* Initialize debug information (breakpoints ...) */

	/* In workbench mode, we have a slight problem: when we link ewb in
	 * workbench mode, since ewb is a child from ised, the run-time will
	 * assume, wrongly, that the executable is started in debug mode. Therefore,
	 * we need a special run-time, with no debugging hooks involved.
	 */
#ifndef NOHOOK
	winit();					/* Did we start under ewb control? */
#endif

	/* Initialize dynamically computed variables (i.e. system dependent)
	 * Then we may call update. Eventually, when debugging the
	 * application, the values loaded from the update file will be overridden
	 * by the workbench (via winit).
	 */

	egc_einit();							/* Various static initializations */
	fcount = scount;

	{
		char temp = 0;
		int i;

		for (i=1;i<argc;i++) {
			if (0 == rt_nstrcmp (argv[i], rt_nmakestr("-ignore_updt"))) {
				temp = (char) 1;	
				break;
			}
		}
		update(temp, argv[0]);					
	}									/* Read melted information
										 * Note: the `update' function takes
										 * care of the initialization of the 
										 * temporary descriptor structures
										 */

	create_desc();						/* Create descriptor (call) tables */
	
#else

	/*
	 * Initialize the finalized system with the static data structures.
	 */
	esystem = egc_fsystem;
	eif_par_table = egc_partab;
	eif_par_table_size = egc_partab_size;
	eif_gen_conf_init (eif_par_table_size);
	nbref = egc_fnbref;
	esize = egc_fsize;

#endif

#if !defined CUSTOM || defined NEED_UMAIN_H
	umain(argc, argv, envp);			/* User's initializations */
#endif
#if !defined CUSTOM || defined NEED_ARGV_H
	rt_arg_init(argc, argv);				/* Save copy for class ARGUMENTS */
#endif
	eif_environ = envp;				/* Save pointer to environment variable storage */
	once_init();
#if defined(EIF_THREADS) && defined(WORKBENCH)
	notify_root_thread();
#endif
	initprf();						/* Initialize profiler. */
	init_emnger();					/* Initialize ISE_EXCEPTION_MANAGER */
	init_scp_manager();				/* Initialize ISE_SCOOP_MANAGER */

		/* Initialize our root class. */
	eif_init_root();
}