⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c~

📁 The main purpose of this project is to add a new scheduling algorithm to GeekOS and to implement a s
💻 C~
字号:
/* * GeekOS C code entry point * Copyright (c) 2001,2003,2004 David H. Hovemeyer <daveho@cs.umd.edu> * Copyright (c) 2003, Jeffrey K. Hollingsworth <hollings@cs.umd.edu> * Copyright (c) 2004, Iulian Neamtiu <neamtiu@cs.umd.edu> * $Revision: 1.51 $ *  * This is free software.  You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". */#include <geekos/bootinfo.h>#include <geekos/string.h>#include <geekos/screen.h>#include <geekos/mem.h>#include <geekos/crc32.h>#include <geekos/tss.h>#include <geekos/int.h>#include <geekos/kthread.h>#include <geekos/trap.h>#include <geekos/timer.h>#include <geekos/keyboard.h>#include <geekos/dma.h>#include <geekos/ide.h>#include <geekos/floppy.h>#include <geekos/pfat.h>#include <geekos/vfs.h>#include <geekos/user.h>/* * Define this for a self-contained boot floppy * with a PFAT filesystem.  (Target "fd_aug.img" in * the makefile.) *//*#define FD_BOOT*/#ifdef FD_BOOT#  define ROOT_DEVICE "fd0"#  define ROOT_PREFIX "a"#else#  define ROOT_DEVICE "ide0"#  define ROOT_PREFIX "c"#endif#define INIT_PROGRAM "/" ROOT_PREFIX "/shell.exe"static void Mount_Root_Filesystem(void);static void Spawn_Init_Process(void);/* * Kernel C code entry point. * Initializes kernel subsystems, mounts filesystems, * and spawns init process. */void Main(struct Boot_Info* bootInfo){    Init_BSS();    Init_Screen();    Init_Mem(bootInfo);    Init_CRC32();    Init_TSS();    Init_Interrupts();    Init_Scheduler();    Init_Traps();    Init_Timer();    Init_Keyboard();    Init_DMA();    Init_Floppy();    Init_IDE();    Init_PFAT();    Mount_Root_Filesystem();    Set_Current_Attr(ATTRIB(BLACK, GREEN|BRIGHT));    Print("Welcome to GeekOS!\n");    Set_Current_Attr(ATTRIB(BLACK, GRAY));    Set_Current_Attr(ATTRIB(BLACK, GREEN|BRIGHT));//    Print("\nHello from Eric 030310117\tWjb 030310121\t HY 030310104\t YJ 030310127\n\n");    Set_Current_Attr(ATTRIB(BLACK, GRAY));    Spawn_Init_Process();    /* Now this thread is done. */    Exit(0);}static void Mount_Root_Filesystem(void){    if (Mount(ROOT_DEVICE, ROOT_PREFIX, "pfat") != 0)	Print("Failed to mount /" ROOT_PREFIX " filesystem\n");    else	Print("Mounted /" ROOT_PREFIX " filesystem!\n");}static void Spawn_Init_Process(void){	struct Kernel_Thread * pThread;	int result;	result = Spawn("/c/shell.exe", "/c/shell.exe", &pThread);	if (result <= 0)		Print("Failed to spawn init process : error code = %d\n", result);	else	{//		Print("Join\n");		int exitCode = Join(pThread);		Print("Init process exited with code %d\n", exitCode);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -