Linux0.01版本-main.c主程序说明
Linux0.01版本源代码
还没有 Linux0.01 版本源代码的小伙伴可以在这里获取:Linux0.01版本源代码,提取码:r0nx。
核心函数解释说明
主程序 main.c 在最外层目录的 init 文件夹中。
void main(void) /* This really IS void, no error here. */
{ /* The startup routine assumes (well, ...) this */
/*
* Interrupts are still disabled. Do necessary setups, then
* enable them
*/
time_init(); //读取 CMOS 数据,初始化系统时间
tty_init(); //初始化 tty 子系统
trap_init(); //陷阱门(硬件中断向量)初始化
sched_init(); //调度程序初始化
buffer_init(); //缓冲管理初始化(初始化系统块设备缓冲区)
hd_init(); //初始化硬盘中断处理程序
sti(); //所有初始化工作完成,开启中断
move_to_user_mode(); //转入用户模式
if (!fork()) { /* we count on this going ok */
init();
}
/*
* NOTE!! For any other task 'pause()' would mean we have to get a
* signal to awaken, but task0 is the sole exception (see 'schedule()')
* as task 0 gets activated at every idle moment (when no other tasks
* can run). For task0 'pause()' just means we go check if some other
* task can run, and if not we return here.
*/
for(;;) pause();
}