linux0.01内核源码结构

目录
boot 系统引导。
fs 文件系统。
include 头文件。一些C标准库,系统核心库。
init 入口。main.c。
kernel 内核。
lib 库。C源程序,一些基本核心的程序。
mm 内存管理
tools C程序编译构建相关。不算系统文件
Makefile C程序编译构建相关。不算系统文件。

main.c -> main()

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(); // 初始化运行时间
	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();
}
posted @ 2021-08-26 20:39  Audience80  阅读(575)  评论(0编辑  收藏  举报