Esempio n. 1
0
File: init.c Progetto: cjeong/jake
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("\n*** Welcome to Jake, The Java Kernel! ***");
	cprintf("\nCopyright (C) 2011. Enterprise Java Systems.\n\n");

	/* test the stack backtrace function */
	test_backtrace(5);

  /* memory setup */
  i386_detect_memory();
  i386_vm_init();

	/* drop into the kernel monitor */
	while (1)
		monitor(NULL);
}
Esempio n. 2
0
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);


	//check page_alloc() this is a test,not my code
	check_page_alloc();




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

	// Drop into the kernel monitor.
	while (1)
		monitor(NULL);
}
Esempio n. 3
0
void
i386_init(void)
{
	extern char edata[], end[];
   	// Lab1 only
	char chnum1 = 0, chnum2 = 0, ntest[256] = {};

	// 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\n%n", 6828, &chnum1, &chnum2);
	cprintf("pading space in the right to number 22: %-8d.\n", 22);
	//cprintf("show me the sign: %+d, %+d\n", 1024, -1024);
	cprintf("chnum1: %d chnum2: %d\n", chnum1, chnum2);
	cprintf("%n", NULL);
	memset(ntest, 0xd, sizeof(ntest) - 1);
	cprintf("%s%n", ntest, &chnum1); 
	cprintf("chnum1: %d\n", chnum1);
	cprintf("show me the sign: %+d, %+d\n", 1024, -1024);


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

	// Drop into the kernel monitor.
	while (1)
		monitor(NULL);
}
Esempio n. 4
0
int test(int i) {
  if (i == 0) {
    test_backtrace();
    return 0;
  } else {
    return i + test(i - 1);
  }
}
Esempio n. 5
0
// Test the stack backtrace function (lab 1 only)
void test_backtrace(int x)
{
	cprintf("entering test_backtrace %d\n", x);
	if (x > 0)
		test_backtrace(x-1);
	else
		mon_backtrace(0, 0, 0);
	cprintf("leaving test_backtrace %d\n", x);
}
Esempio n. 6
0
 static void test_backtrace(int x)
 {
     printf("entering test_backtrace %d\n", x);
     if (x > 0)
         test_backtrace(x - 1);
     else
         Monitor::backtrace(0, nullptr);
     printf("leaving test_backtrace %d\n", x);
 }
Esempio n. 7
0
// Test the stack backtrace function (lab 1 only)
void
test_backtrace(int x)
{
	int i;

	cprintf("entering test_backtrace %d\n", x);
	if (x > 0) {
		test_backtrace(x-1);
	} else {
		mon_backtrace(0,0,0);
	}
	cprintf("leaving test_backtrace %d\n", x);
}
Esempio n. 8
0
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();


}
Esempio n. 9
0
 void lab1()
 {
     printf(CBLU "6828 decimal is %o octal!\n" CEND, 6828);
     test_backtrace(5);
 }