Example #1
0
File: vm.c Project: jessZhAnG/OS
void
vm_bootstrap(void)
{
    /*
     initialize locks
     these locks are supposed to be resident in RAM for ever
    */
    coremap_lock = lock_create("coremap");
    page_lock = lock_create("page");
    swap_lock = lock_create("swap");

    /*
     check
    */
    assert(coremap_lock != NULL);
    assert(page_lock != NULL);
    assert(swap_lock != NULL);

    // initialize coremap
    coremap_bootstrap();
    vmstats_init();

    // coremap done
    // take charge of memory management
    coremap_ready = 1;
  
}
Example #2
0
int
uwvmstatstest(int nargs, char **args)
{
	int i, result;
  char name[NAME_LEN];

	(void)nargs;
	(void)args;

	inititems();
	kprintf("Starting uwvmstatstest...\n");

  kprintf("Initializing vmstats\n");
  vmstats_init();

	for (i=0; i<NTESTTHREADS; i++) {
    snprintf(name, NAME_LEN, "vmstatsthread %d", i);
		result = thread_fork(name, NULL, vmstats_thread, NULL, i);
		if (result) {
			panic("uwvmstatstest: thread_fork failed: %s\n",
			      strerror(result));
		}
	}

	for (i=0; i<NTESTTHREADS; i++) {
		P(donesem);
	}

  vmstats_print();

	cleanitems();
	kprintf("uwvmstatstest done.\n");

	return 0;
}
Example #3
0
/*
 * Initial boot sequence.
 */
static
void
boot(void)
{
	/*
	 * The order of these is important!
	 * Don't go changing it without thinking about the consequences.
	 *
	 * Among other things, be aware that console output gets
	 * buffered up at first and does not actually appear until
	 * dev_bootstrap() attaches the console device. This can be
	 * remarkably confusing if a bug occurs at this point. So
	 * don't put new code before dev_bootstrap if you don't
	 * absolutely have to.
	 *
	 * Also note that the buffer for this is only 1k. If you
	 * overflow it, the system will crash without printing
	 * anything at all. You can make it larger though (it's in
	 * dev/generic/console.c).
	 */

	kprintf("\n");
	kprintf("OS/161 base system version %s\n", BASE_VERSION);
	kprintf("%s", harvard_copyright);
	kprintf("\n");

	kprintf("CS350-036's system version %s (%s #%d)\n", 
		GROUP_VERSION, buildconfig, buildversion);
	kprintf("\n");
	#if OPT_A0
   	hello();
	#endif /* OPT_A0 */
	ram_bootstrap();
	scheduler_bootstrap();
	thread_bootstrap();
	vfs_bootstrap();
	dev_bootstrap();
#if OPT_A3   
        vmstats_init();

#endif
	vm_bootstrap();
	kprintf_bootstrap();

	/* Default bootfs - but ignore failure, in case emu0 doesn't exist */
	vfs_setbootfs("emu0");
#if OPT_A3   

        initSwapOps();

#endif

	/*
	 * Make sure various things aren't screwed up.
	 */
	assert(sizeof(userptr_t)==sizeof(char *));
	assert(sizeof(*(userptr_t)0)==sizeof(char));
}