/* * GeekOS C code entry point * Copyright (c) 2001,2003,2004 David H. Hovemeyer * Copyright (c) 2003, Jeffrey K. Hollingsworth * Copyright (c) 2004, Iulian Neamtiu * $Revision: 1.2 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define TEST_PAGING 0 #define TEST_PCI 1 /* static inline unsigned int cpuid_ecx(unsigned int op) { unsigned int eax, ecx; __asm__("cpuid" : "=a" (eax), "=c" (ecx) : "0" (op) : "bx", "dx" ); return ecx; } */ extern void Get_MSR(ulong_t msr, unsigned int *val1, unsigned int *val2); extern void Set_MSR(ulong_t msr, ulong_t val1, ulong_t val2); extern uint_t Get_EIP(); extern uint_t Get_ESP(); extern uint_t Get_EBP(); extern void Invalidate_PG(void * addr); int foo=42; #define SPEAKER_PORT 0x61 void Buzz(unsigned delay, unsigned num) { volatile int x; int i,j; unsigned char init; init=In_Byte(SPEAKER_PORT); for (i=0;i"); PrintBoth("Launching Noisemaker and keyboard listener threads\n"); key_thread = Start_Kernel_Thread(Keyboard_Listener, (ulong_t)&doIBuzz, PRIORITY_NORMAL, false); spkr_thread = Start_Kernel_Thread(Buzzer, (ulong_t)&doIBuzz, PRIORITY_NORMAL, false); PrintBoth("Next: setup GDT\n"); { uint_t addr = 0xe0000; uint_t hi = 0; // wrmsr(SYMBIOTIC_MSR, hi, addr); { uint_t msr_num = 0x0000001B; __asm__ __volatile__ ("rdmsr" : : "c"(msr_num) : "%eax","%edx","memory"); } { uint_t msr_num = 0x0000001c; __asm__ __volatile__ ("rdmsr" : : "c"(msr_num) : "%eax","%edx","memory"); } { uint_t msr_num = 0x0000001B; __asm__ __volatile__ ("wrmsr" : : "c"(msr_num), "a"(hi), "d"(addr) : "memory"); } { uint_t msr_num = 0x535; __asm__ __volatile__ ("wrmsr" : : "c"(msr_num), "a"(hi), "d"(addr) : "memory"); } while (1) {} } if (TEST_PAGING) { int i = 0; for (i = 0; i < 1024; i++) { uint_t * addr = (uint_t *)0xa00000; uint_t foo = *addr; PrintBoth("Read From 0x%x=%d\n", (uint_t)addr, foo); } // Invalidate_PG((void *)0x2000); // VM_Test(bootInfo, 32); //VM_Test(bootInfo, 1536); } if (TEST_PCI) { Init_PCI(); } while(1); /* Now this thread is done. */ Exit(0); }