摘要
本系统是基于 Intel X86 平台的 32 位多任务操作系统内核的设计与实现,采用了软
件工程中面向过程的开发方法,包括问题定义、可行性研究、需求分析、总体设计、详
细设计、编码、测试与维护等部分。
本系统功能大致分为系统的加载、块设备驱动、字符设备驱动、进程调度、高速缓
冲区管理、中断服务、内存管理、文件系统管理、系统调用和 Command 命令行解释程
序。本文分析了操作系统的体系架构,简述了在 Windows 平台与 Linux 平台上编写操作
系统的设计方法,并给出详细的设计与实现过程。
本系统内核采用了 C 语言和汇编语言编写,外围支撑软件采用 Windows 下 VC++
编写。汇编语言采用了 Nasm 和 AT&T 两种语言编写,用于不同用途。在内核的文件系
统当中使用了 Minix 文件系统,做到了简单实用。该系统利用 Windows 和 Linux 交叉编
译的形式实现了操作系统内核的各项功能,具有较强的使用价值。
关键词:操作系统;内核;AT&T 汇编; Minix 文件系统
I
Abstract
The system is based on the Intel X86 platform more than 32 tasks the operating system
kernel design and implementation of a process-oriented programming method. System is broadly
divided into the loading system, block device drivers, character device driver, the process of
scheduling, high-speed buffer management, interrupt services, memory management, file system
management, system calls and command-line interpreter Command. Core of the system using C
language and compiled language, the external support software under Windows using VC + + to
prepare. Nasm assembly language used and the AT&T two compilation prepared for different
purposes. In the core file system which used the Minix file system, do a simple and practical.
This paper analyzes the architecture of the operating system, on the Windows platform with
the Linux operating system platform on the preparation of the design method, and gives details
of the realization of the process. The system uses C language and compiled language, using
Windows and Linux form of cross compiler to achieve the various functions of the operating
system kernel, has a strong value.
Key words: operating system;Kernel;AT&T compilation; Minix file system
II
目录
0 前言........................................................................................................................1
1.1 操作系统的历史...........................................................................................2
1.2 内核功能介绍...............................................................................................3
1.3 解决的主要技术问题...................................................................................4
2.1 设计目的.......................................................................................................6
2.2 可行性分析...................................................................................................6
2.3 结论意见.......................................................................................................7
3.1 操作系统功能需求.......................................................................................7
3.2 操作系统性能需求.......................................................................................8
3.3 操作系统错误处理需求...............................................................................8
3.4 操作系统的约束...........................................................................................8
3.5 操作系统逆向需求.......................................................................................8
3.6 将来可能提出的要求...................................................................................9
4.1 设计思想.......................................................................................................9
4.2 具体功能.....................................................................................................12
4.3 内核模块描述.............................................................................................16
4.3.1 内核加载模块描述............................................................................16
4.3.2 块设备驱动模块描述........................................................................16
请求项数据结构:request..........................................................................16
4.3.3 字符设备驱动模块描述....................................................................17
虚拟控制台数据结构:Virtual_Control....................................................17
表 4.2 虚拟控制台数据结构 Virtual_Control............................................17
unsigned long.....................................................................................................17
mem_start..........................................................................................................17
显存起始地址...................................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
mem_end...........................................................................................................17
显存结束地址...................................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
disp_start............................................................................................................17
当前窗口起始地址...........................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
disp_end.............................................................................................................17
当前窗口结束地址...........................................................................................17
4.........................................................................................................................17
unsigned char.....................................................................................................17
attr......................................................................................................................17
显示字符属性...................................................................................................17
1.........................................................................................................................17
unsigned char.....................................................................................................17
default_attr.........................................................................................................17
默认显示字符属性...........................................................................................17
1.........................................................................................................................17
unsigned short....................................................................................................17
erase...................................................................................................................17
擦除字符...........................................................................................................17
2.........................................................................................................................17
unsigned long.....................................................................................................17
x_pos..................................................................................................................17
当前窗口 X 坐标...............................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
y_pos..................................................................................................................17
当前窗口 Y 坐标...............................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
pos......................................................................................................................17
显示窗口当前位置...........................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
state....................................................................................................................17
当前控制台状态...............................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
save_x................................................................................................................17
保存的 X 坐标...................................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................17
save_y................................................................................................................17
保存的 Y 坐标...................................................................................................17
4.........................................................................................................................17
unsigned long.....................................................................................................18
save_pos............................................................................................................18
保存的坐标位置...............................................................................................18
4.........................................................................................................................18
unsigned long.....................................................................................................18
old_x_pos..........................................................................................................18
旧的 X 坐标.......................................................................................................18
4.........................................................................................................................18
unsigned long.....................................................................................................18
old_y_pos..........................................................................................................18
旧的 Y 坐标.......................................................................................................18
4.........................................................................................................................18
unsigned long.....................................................................................................18