-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## 内存地址 | ||
![](./resources/memory_addr.png) | ||
|
||
* 逻辑地址:程序代码指令中的地址,可以认为是虚拟地址; | ||
* 线性地址:逻辑地址经过分段计算后得到。在现代 x86-64 位操作系统中,线性地址和逻辑地址是一样的; | ||
* 物理地址:线性地址经过 MMU 后,得到物理上真正地址; | ||
|
||
|
||
|
||
## 分段 | ||
|
||
段描述符:用于描述一个段的信息。在长模式下,其格式是: | ||
|
||
<img src="./resources/segment_descriptor.webp" style="zoom:13%;" /> | ||
|
||
在操作系统中,多个段描述符组成一个描述符表。通过 gdtr(全局描述符寄存器)指向表的基地址。 | ||
|
||
> 还有一个 ldtr(局部描述符寄存器),现代操作系统都是通过分页来管理内存,分段处理只是为了兼容,ldtr 用的比较少,所以也不讨论 ldtr。 | ||
段选择子:通过段选择子可以确定该使用哪个段描述符: | ||
|
||
<img src="./resources/segment_selector.webp" style="zoom:23%;" /> | ||
|
||
通过分段来计算线性地址流程: | ||
|
||
![](./resources/seg_gdtr.png) | ||
|
||
同理,在长模式下中断门描述符格式: | ||
|
||
<img src="./resources/interceptor_descriptor.webp" style="zoom:13%;" /> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters