コード例 #1
0
ファイル: init.c プロジェクト: sunrenjie/jos
void
i386_init(void)
{
	extern char edata[], end[];

	// Before doing anything else, complete the ELF loading process.
	// Clear the uninitialized global data (BSS) section of our program.
	// This ensures that all static/global variables start out zero.
	memset(edata, 0, end - edata);

	// Initialize the console.
	// Can't call cprintf until after we do this!
	cons_init();

	cprintf("6828 decimal is %o octal!\n", 6828);

	// Lab 2 memory management initialization functions
	i386_detect_memory();
	i386_vm_init();
	page_init();
	page_check();

	// Lab 3 user environment initialization functions
	env_init();
	idt_init();

	// Lab 4 multitasking initialization functions
	pic_init();
	kclock_init();

	// Should always have an idle process as first one.
	ENV_CREATE(user_idle);

	// Start fs.
	ENV_CREATE(fs_fs);
	ENV_CREATE(user_icode);

#if defined(TEST)
	// Don't touch -- used by grading script!
	ENV_CREATE2(TEST, TESTSIZE)
#else
	// Touch all you want.
	// ENV_CREATE(user_icode);
	// ENV_CREATE(user_pipereadeof);
	// ENV_CREATE(user_pipewriteeof);
	// ENV_CREATE(user_testpipe);
	// ENV_CREATE(user_primespipe);
	// ENV_CREATE(user_testpiperace);
	// ENV_CREATE(user_testpiperace2);
	// ENV_CREATE(user_testfdsharing);
#endif // TEST*

	// Should not be necessary - drain keyboard because interrupt has given up.
	kbd_intr();

	// Schedule and run the first user environment!
	sched_yield();


}
コード例 #2
0
ファイル: init.c プロジェクト: SivilTaram/Jos-mips
void mips_init()
{
	printf("init.c:\tmips_init() is called\n");
	mips_detect_memory();

	mips_vm_init();
	page_init();
	//page_check();

	env_init();

	//ENV_CREATE(user_fktest);
	//ENV_CREATE(user_pt1);
	ENV_CREATE(user_idle);
	ENV_CREATE(fs_serv);
	//ENV_CREATE(user_fktest);
	//ENV_CREATE(user_pingpong);
	//ENV_CREATE(user_testfdsharing);
	//ENV_CREATE(user_testspawn);
	//ENV_CREATE(user_testpipe);
	//ENV_CREATE(user_testpiperace);
	ENV_CREATE(user_icode);
	trap_init();
	kclock_init();
	//env_run(&envs[0]);

	//env_run(&envs[1]);

	panic("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");

	while (1);

	panic("init.c:\tend of mips_init() reached!");
}
コード例 #3
0
ファイル: init.c プロジェクト: mcorley/jos
void
i386_init(void)
{
	extern char edata[], end[];

	// Before doing anything else, complete the ELF loading process.
	// Clear the uninitialized global data (BSS) section of our program.
	// This ensures that all static/global variables start out zero.
	memset(edata, 0, end - edata);

	// Initialize the console.
	// Can't call cprintf until after we do this!
	cons_init();

	cprintf("6828 decimal is %o octal!\n", 6828);

	// Lab 2 memory management initialization functions
	i386_detect_memory();
	i386_vm_init();

	// Lab 3 user environment initialization functions
	env_init();
	idt_init();

	// Lab 4 multitasking initialization functions
	pic_init();
	kclock_init();

	time_init();
	pci_init();

	// Should always have an idle process as first one.
	ENV_CREATE(user_idle);

	// Start fs.
	ENV_CREATE(fs_fs);

#if !defined(TEST_NO_NS)
	// Start ns.
	ENV_CREATE(net_ns);
#endif

#if defined(TEST)
	// Don't touch -- used by grading script!
	ENV_CREATE2(TEST, TESTSIZE);
#else
	// Touch all you want.
	// ENV_CREATE(net_testoutput);
	// ENV_CREATE(user_echosrv);
	// ENV_CREATE(user_httpd);
  // ENV_CREATE(user_writemotd);
	// ENV_CREATE(user_testfile);
	ENV_CREATE(user_icode);
	// ENV_CREATE(user_primes);
#endif // TEST*

	// Schedule and run the first user environment!
	sched_yield();
}
コード例 #4
0
ファイル: init.c プロジェクト: kay21s/JOS-Lab
void
i386_init(void)
{
	extern char edata[], end[];

	// Before doing anything else, complete the ELF loading process.
	// Clear the uninitialized global data (BSS) section of our program.
	// This ensures that all static/global variables start out zero.
	memset(edata, 0, end - edata);

	// Initialize the console.
	// Can't call cprintf until after we do this!
	cons_init();

#if defined(LAB1_ONLY)
	cprintf("6828 decimal is %o octal!\n", 6828);

	/* ----- Exercise 8 of Lab 1 -----*/
	int x=1,y=3,z=4;
	cprintf("x %d, y %x, z %d\n", x, y, z);

	unsigned int i = 0x00646c72;
	cprintf("H%x Wo%s\n", 57616, &i);
	// Shows  He110 World, while the demical 0d57616 = 0xe110
	// 'r' = 0x72, 'l' = 0x6c, 'd' = 0x64, '\0' = 0x00 which indicates the end of the string
	// If the x86 is big-endian, 57616 -> 4321, 0x00646c72 -> 0x726c6400 

        // Test the stack backtrace function (lab 1 only)
	test_backtrace(5);
#endif

	// Lab 2 memory management initialization functions
	i386_detect_memory();
	i386_vm_init();

	// Lab 3 user environment initialization functions
	env_init();
	idt_init();
 
	// Lab 4 multitasking initialization functions
	pic_init();
	kclock_init();

	time_init();
	pci_init();

	// Should always have an idle process as first one.
	ENV_CREATE(user_idle); // 0

	// Start fs
	ENV_CREATE(fs_fs); // 1

	// Start ns.
	ENV_CREATE(net_ns); // 2

	// Start init
#if defined(TEST)
	// Don't touch -- used by grading script!
	ENV_CREATE2(TEST, TESTSIZE);
#else
	// Touch all you want.
	// ENV_CREATE(user_echosrv);
	// ENV_CREATE(user_httpd);
	// ENV_CREATE(user_testtime);
#endif // TEST*
 
	// Schedule and run the first user environment!
	sched_yield();


}
コード例 #5
0
ファイル: init.c プロジェクト: BGCX262/zt-jos-svn-to-git
void
i386_init(uint32_t memsize)
{
	extern char etext[],edata[], end[];

	// Before doing anything else, complete the ELF loading process.
	// Clear the uninitialized global data (BSS) section of our program.
	// This ensures that all static/global variables start out zero.
	
	/* 
	 * From http://en.wikipedia.org/wiki/.bss
	 * In computer programming
	 * .bss or bss (Block Started by Symbol) is used by many compilers and linkers 
	 * as the name of the data segment containing static variables 
	 * that are filled solely with zero-valued data initially 
	 * (i. e., when execution begins). 
	 * It is often referred to as the "bss section" or "bss segment". 
	 * The program loader initializes the memory allocated for the bss section 
	 * when it loads the program.
	 */
	
	memset(edata, 0, end - edata);

	// Initialize the console.
	// Can't call cprintf until after we do this!
	cons_init();


	cprintf("6828 decimal is %o octal!\n", 6828);
	cprintf("etext:%08x,edata:%08x,end:%08x\n",etext,edata,end);

	// Lab 2 memory management initialization functions
	i386_detect_memory(memsize);
	i386_vm_init();

	// Lab 3 user environment initialization functions
	env_init();
	idt_init();

	// Lab 4 multitasking initialization functions
	pic_init();
	kclock_init();
	// Should always have an idle process as first one.
	ENV_CREATE(user_idle);

	// Start fs.
	ENV_CREATE(fs_fs);
	// Start init
#if defined(TEST)
	// Don't touch -- used by grading script!
	ENV_CREATE2(TEST, TESTSIZE);
#else
	// Touch all you want.
	ENV_CREATE(user_fairness);
	//ENV_CREATE(user_pipereadeof);
	// ENV_CREATE(user_pipewriteeof);
#endif

	// Should not be necessary - drain keyboard because interrupt has given up.
	kbd_intr();

	//while(login() != 0)
	//	continue;
	// Schedule and run the first user environment!
	sched_yield();


}