rust os comp's daily blog
rust 好好好!
Intro
这里是我学习rust-based-os-comp的一个日常记录
我的个人实验环境配置:

Blog
由于我看到训练营的通知较晚,导致我在最后一天才了解这个项目,又因为这几天还在学校实习,所以可能最近几天进度比较慢.
2022-07-05 (day 1)
Task / Progress
- 配置本地rust环境(之前已经配好)
- 尝试
gitclassroom, 使用codespace进行rustlings的训练 rustlings:variablesfunctionsmove_semantics
2022-07-06 (day 2)
Task / Progress
- 第零章 实验环境配置
- 第一章 应用程序与基本执行环境(lab0-0)
rustlings:primitive_typesenumsstructs
实验环境配置
由于我之前接触过mit的 6.S081, qemu已经装好(mit 6.S081的安装指引)
通过命令:
qemu-riscv64 -version, 可以看出qemu的版本.此外, 我用的是
manjaro(一个基于arch linux的linux发行版),所以qemu版本较新,符合实验要求.
根据文档,clone仓库, 运行
cd os1
LOG=DEBUG make run
成功获得输出:

QA / Thinking / Reading
- 为什么 rust 的 两个宏:
print/pringln不能被写进core而需要写进std
By default, all Rust crates link the standard library, which depends on the operating system for features such as threads, files, or networking. It also depends on the C standard library libc, which closely interacts with OS services. Since our plan is to write an operating system, we can not use any OS-dependent libraries. So we have to disable the automatic inclusion of the standard library through the no_std attribute.
为了打印到标准输出, 需要与内核进行交互, 因此必然与所在平台有关
为什么rust的
corelibarary能做到 platform-agnostic.
2022-07-07 (day 3)
Task / Progress
- 第二章 批处理系统: 看到最后一节
rustlings:collectionserror_handlinggenericsmodulesoptionstandard_library_typesstringsteststhreadstraits
QA / Thinking / Reading
2022-07-08 (day 4)
rustlings终于写完了..
macros这部分的练习出的有点敷衍 😂
感觉要看懂rCore tutorial, 修改它的代码, 还得学点 unsafe rust, 只做 rustlings 和一些常规的练习感觉完全不够啊
Task / Progress
- 看完第二章,开始看第三章(感觉汇编部分还是有点吃力,看来得好好学下riscv了)
- 看了下 writing an OS in rust
- 完成
rustlings
QA / Thinking / Reading
2022-07-09 (day 5)
今天不太想做lab...
Task / Progress
QA / Thinking / Reading
2022-07-10 (day 6)
今天好像没干啥...