forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
49 lines (28 loc) · 3.17 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Linux kernel
============
There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.
In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``. The formatted documentation can also be read online at:
https://www.kernel.org/doc/html/latest/
There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
============
本项目为江苏大学2022级计算机学院操作系统课程设计指南,可以为后续学弟学妹起到一定借鉴作用
本指南是笔者在完成课设两个月后写成的,可能会遗漏一些配置环境上的细节问题,欢迎使用issue功能提出问题
============
# 正文
首先简单了解一下项目,笔者选择的课设题目是**添加系统调用**(system call),系统调用简单来说就是一个写在系统底层的,可供全局调用的特殊函数入口
至于这个函数入口的特殊之处,留给感兴趣的读者自行解决(推荐读物:操作系统真相还原,了解16位和32位操作系统的话,只需要看这本,64位操作系统对于大部分人来说一般不需要太多了解,如果想要了解可以阅读《一个64位操作系统的设计与实现》)
这个函数既然是操作系统级别的全局函数,我们就需要了解一些定性的执行流的执行过程
请看下图,高地址是内核空间,是操作系统内核独占的,低地址是用户空间(当然这么说只是笼统泛泛而谈的,实际情况会复杂很多,请自行搜索了解)
[![vppYDg.jpg](https://s1.ax1x.com/2022/07/27/vppYDg.jpg)](https://imgtu.com/i/vppYDg)
正是因为所有用户进程都共享了内核空间,才可以使得内核空间中的所有函数入口理论上都可以是被全局使用的,然而我们也知道.有些函数是具有危险性的, 因此需要进行""鉴权", 即: 鉴定调用者的权限是否正确
鉴权这一过程可以说是非常简单, 因为只需要几个if检查几个标志位就行了, 但同时也非常冗杂,因为如果要讲清楚**为什么是这几个标志位, 而不是那几个, 为什么这几个就够了, 而不是再多几个或者少几个**, 是一项非常复杂而麻烦的事情, 因此这个问题笔者不打算展开, 感兴趣的读者可以看一下上面提到的那两本书
那么我们这里其实cover到了本次课设的第二个关键点: 需要为鉴权模块添加正确的权限
第三个关键点是: linux的兼容性和代码复用做的很好, 64位系统和32位系统之间有大量代码复用了, x86和arm Linux之间也有大量的代码复用; 所以我们本次实验需要正确设置编译配置, 对于第一次做这个课设的同学而言, 成功配置编译环境与成功编译,大致会占据整个实验时间的一般左右,期间可能还需要学习一些cmake和makefile相关的知识
(待补充)