/** * 아래 함수는 C 언어 커널의 시작 부분임 * 반드시 다른 함수들 보다 가장 앞쪽에 존재해야 함 */ void Main( void ) { DWORD i; kPrintString( 0, 3, "C Language Kernel Start.....................[Pass]" ); // 최소 메모리 크기를 만족하는 지 검사 kPrintString( 0, 4, "Minimum Memory Size Check...................[ ]" ); if( kIsMemoryEnough() == FALSE ) { kPrintString( 45, 4, "Fail" ); kPrintString( 0, 5, "Not Enough Memory~!! MINT64 OS Requires Over " "64Mbyte Memory~!!" ); while( 1 ) ; } else { kPrintString( 45, 4, "Pass" ); } // IA-32e 모드의 커널 영역을 초기화 kPrintString( 0, 5, "IA-32e Kernel Area Initialize...............[ ]" ); if( kInitializeKernel64Area() == FALSE ) { kPrintString( 45, 5, "Fail" ); kPrintString( 0, 6, "Kernel Area Initialization Fail~!!" ); while( 1 ) ; } kPrintString( 45, 5, "Pass" ); while( 1 ) ; }
void Main(void){ DWORD i; DWORD dwEAX, dwEBX, dwECX, dwEDX; char vcVendorString[13] = {0, }; kPrintString(0, 3, "C Language Kernel Start.....................[Pass]"); kPrintString(0, 4, "Minimum Memory Size Check...................[ ]"); if(kIsMemoryEnough() == FALSE){ kPrintString(45, 4, "Fail"); kPrintString(0, 5, "Not Enought Memory. Current memory size is lower than 64MB"); while(1); } else{ kPrintString(45, 4, "Pass"); } kPrintString(0, 5, "IA-32e Kernel Area Initialize...............[ ]"); if(kInitializeKernel64Area() == FALSE){ kPrintString(45, 5, "Fail"); } kPrintString(45, 5, "Pass"); kPrintString(0, 6, "IA-32e Page Tables Initialize...............[ ]"); kInitializePageTables(); kPrintString(45, 6, "Pass"); kReadCPUID( 0x00, &dwEAX, &dwEBX, &dwECX, &dwEDX ); *(DWORD *)vcVendorString = dwEBX; *(DWORD *)vcVendorString = dwEDX; *(DWORD *)vcVendorString = dwECX; kPrintString(0, 7, "Processor Vendor String.....................[ ]"); kPrintString(45, 7, vcVendorString); kReadCPUID(0x80000001, &dwEAX, &dwEBX, &dwECX, &dwEDX); kPrintString(0, 8, "64bit Mode Support Check....................[ ]"); if(dwEDX & ( 1 << 29)){ kPrintString(45, 8, "Pass"); } else{ kPrintString(45, 8, "Fail"); kPrintString(0, 9, "This processor does not support 64bit mode"); while(1); } kPrintString(0, 9, "Switch to IA-32e Mode"); // kSwitchAndExecute64bitKernel(); while(1); }
// 아래 함수는 c언어 커널의 시작 부분임 // 반드시 다른 함수들 보다 가장 앞쪽에 존재해야 함 void main(void) { DWORD i; DWORD dwEAX, dwEBX, dwECX, dwEDX; char vcVendorString[13]={0,}; // Application Processor이면 아래의 코드를 생략하고 바로 64비트 모드로 전환 if(*((BYTE*)BOOTSTRAPPROCESSOR_FLAGADDRESS)==0) { kSwitchAndExecute64bitKernel(); while(1); } //======================================================================================== // BSP만 수행하는 코드 //======================================================================================== kPrintString(0,3,"Protected Mode C Language kernel start........................[Pass]"); // 최소 메모리 크기를 만족하는 지 검사 kPrintString(0,4,"Minimum Memory Size Check...................[ ]"); if(kIsMemoryEnough()==FALSE) { kPrintString(45,4,"Fail"); kPrintString(0,5,"Not Enough Memory~!! MINT64 OS Requires Over 64MByte Memory~!!"); while(1); } else { kPrintString(45,4,"Pass"); } // IA-32e 모드의 커널 영역을 초기화 kPrintString(0,5,"IA-32e kernel Area Initialize...............[ ]"); if(kInitializeKernel64Area()==FALSE) { kPrintString(45,4,"Fail"); kPrintString(0,4,"Kernel Area Initialization Fail~!!"); while(1); } kPrintString(45,5,"Pass"); // IA-32e 모드 커널을 위한 페이지 테이블 생성 kPrintString(0,6,"IA-32e Page Tables Initialize...............[ ]"); kInitializePageTables(); kPrintString(45,6,"Pass"); // 프로세서 제조사 정보 읽기 kReadCPUID(0x00,&dwEAX,&dwEBX,&dwECX,&dwEDX); *(DWORD*)vcVendorString=dwEBX; *((DWORD*)vcVendorString+1)=dwEDX; *((DWORD*)vcVendorString+2)=dwECX; kPrintString(0,7,"Processor Vendor String.....................[ ]"); kPrintString(45,7,vcVendorString); // 64비트 지원 유무 확인 kReadCPUID(0x80000001,&dwEAX,&dwEBX,&dwECX,&dwEDX); kPrintString(0,8,"64bit Mode Support Check....................[ ]"); if(dwEDX&(1<<29)) { kPrintString(45,8,"Pass"); } else { kPrintString(45,8,"Fail"); kPrintString(0,9,"This processor does not support 64bit mode~!!"); while(1); } // IA-32e 모드 커널을 0x200000(2Mbyte) 어드레스로 이동 kPrintString(0,9,"Copy IA-32e kernel To 2M Address............[ ]"); kCopyKernel64ImageTo2Mbyte(); kPrintString(45,9,"Pass"); // IA-32e 모드로 전환 kPrintString(0,10,"Switch To IA-32e Mode"); kSwitchAndExecute64bitKernel(); while(1); }