Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ccrysisa/ccrysisa.github.io
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrysisa committed Dec 8, 2024
2 parents 0e60742 + f8f0a99 commit ea6832e
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"baseUrl": ".",
"paths": {
"*": [
"../themes/FixIt/assets/*"
"..\\themes\\FixIt\\assets\\*"
]
}
}
Expand Down
7 changes: 6 additions & 1 deletion content/posts/sysprog/CSAPP-ch2.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ repost:
<!--more-->

- {{< link href="https://hackmd.io/@sysprog/CSAPP-ch2" content="原文地址" external-icon=true >}}

搭配 CMU: 15-213: Intro to Computer Systems: Schedule for Fall 2015
- 可以在 [这里](https://www.cs.cmu.edu/afs/cs/academic/class/15213-f15/www/schedule.html) 找到相关的投影片和录影
Expand Down Expand Up @@ -227,3 +226,9 @@ Denormalized 的作用一是表示 0,二是配合 Normalized 在靠近 0 的
> 50% of the time.
Round-to-even 可以让 round 后的数据在统计上的均值与原先数据的均值误差比较小
## References
- HackMD: {{< link href="https://hackmd.io/@sysprog/CSAPP-ch2" content=".GUST 的文字导读" external-icon=true >}}
- bilibili: {{< link href="https://space.bilibili.com/4564101" content="yaaangmin 的讲解视频" external-icon=true >}} / {{< link href="https://github.com/yangminz/bcst_csapp" content="相关资源" external-icon=true >}}
- bilibili: {{< link href="https://space.bilibili.com/4564101" content="Dr.Dng 陪跑 CSAPP: bigONE《深入理解计算机系统》" external-icon=true >}}
95 changes: 95 additions & 0 deletions content/posts/sysprog/tp5a0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: "TP5A0: An Experimental 32-Bit Macrokernel"
subtitle:
date: 2024-11-10T18:58:28+08:00
slug: 5441bf2
# draft: true
# author:
# name:
# link:
# email:
# avatar:
description:
keywords:
license:
comment: false
weight: 0
tags:
- draft
categories:
- draft
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRelated: false
hiddenFromFeed: false
summary:
resources:
- name: featured-image
src: featured-image.jpg
- name: featured-image-preview
src: featured-image-preview.jpg
toc: true
math: true
lightgallery: true
password:
message:
repost:
enable: true
url:

# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---

<!--more-->

## 前言

以吾爱破解论坛的系列博文「[从 0 到 -1 写一个操作系统](https://www.52pojie.cn/thread-1748588-1-1.html)」为主干,配合书籍《操作系统真象还原》来从零开始实现一个基于 x86 架构的 32 位操作系统。该系列博文可以视为书籍的提纲,省略了书籍中为趣味性而增加的形象表达和无关的背景故事,使得如何实现操作系统相关的表述更为精简干练,但是由于论坛的图床原因,博文有些图片已失效,需要搭配书籍来查看相应图片;另外博文中所贴代码可能在上传时被分割了,并不符合指定格式,需要搭配博文作者的源代码和书籍所提供的代码片段来验证,确保代码准确无误。

此外,原书和博文对于开发环境配置、模拟器 Bochs 的运用、x86 汇编并未做过多的介绍说明,这些内容可以参考 References 的相关资源进行针对性的学习,这里比较推荐稀风大神的 [KOS](https://gitee.com/thin-wind/KOS) 项目,里面资料非常详尽,有些原书未列入的问题这里面也有相应的解决方案。

### 开发环境

{{< admonition info >}}
- WSL2 Ubuntu 22.04
- Bochs 2.8
- NASM 2.15.05
- GNU Make 4.3
- VS Code
- ASM Code Lens
- clangd
- Clang-Format
- WSL
{{< /admonition >}}

```bash
OS: Ubuntu 22.04.5 LTS on Windows 10 x86_64
Kernel: 5.15.153.1-microsoft-standard-WSL2
Uptime: 3 mins
Packages: 924 (dpkg), 6 (snap)
Shell: bash 5.1.16
Theme: Adwaita [GTK3]
Icons: Adwaita [GTK3]
Terminal: Windows Terminal
CPU: Intel i7-1065G7 (8) @ 1.497GHz
GPU: b523:00:00.0 Microsoft Corporation Device 008e
Memory: 665MiB / 7840MiB
```

## Bootloader

两种 IO 接口访问方式的区别可以形象理解为:采用统一编址方式的外设需要连接在 **内存地址解码单元** 之后,这样才可以使用统一的地址来访问外设;而采用独立编址方式的外设则直接与 CPU 通过 **端口** 进行连接,CPU 通过特殊的指令访问这些外设的 IO 接口 (即通过端口实现与驱动互联),而无需通过统一的内存地址进行访问 (但是只能使用 dx 和 ax 这两个寄存器)。

{{< image src="/images/tp5/x86-io.drawio.png" >}}

## Protected Mode

保护模式杂糅了很多历史兼容,在架构上很复杂,不需要研究太深,知道启用保护模式的大致流程即可。

## References

- 吾爱破解: \[系统底层\] [从 0 到 -1 写一个操作系统](https://www.52pojie.cn/thread-1748588-1-1.html)
- 稀风: [如何从零实现一个操作系统 KOS](https://gitee.com/thin-wind/KOS)
- 看见南山: [用《操作系统真象还原》写一个操作系统](https://space.bilibili.com/8393171/channel/collectiondetail?sid=1394920)
- 豆瓣: [操作系统真象还原](https://book.douban.com/subject/26745156/)
- 豆瓣: [x86 汇编语言:从实模式到保护模式](https://book.douban.com/subject/20492528/)
Binary file added static/images/tp5/x86-io.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ea6832e

Please sign in to comment.