Merge remote-tracking branch 'upstream/master' into feat-network-rebuild

This commit is contained in:
Samuka007 2025-06-09 16:51:32 +08:00
commit 32ca9b63c7
554 changed files with 31601 additions and 11661 deletions

65
.github/workflows/doc_translation.yml vendored Normal file
View File

@ -0,0 +1,65 @@
name: Docs Translation
on:
push:
branches: [master]
paths:
- "docs/**"
workflow_dispatch:
jobs:
translate-and-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: get-short_sha
uses: actions/github-script@v7.0.1
with:
script: |
const short_sha = context.sha.substring(0, 8)
core.setOutput('short_sha', short_sha)
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Run document translator
run: python tools/doc_translator.py
env:
MAX_WORKERS: 20
OPENAI_API_KEY: ${{ secrets.DRAGONOS_OPENAI_API_KEY }}
OPENAI_MODEL: Qwen/Qwen3-8B
OPENAI_BASE_URL: ${{ secrets.DRAGONOS_OPENAI_API_BASE }}
- name: Commit translated files
run: |
git config --global user.name "dragonosbot"
git config --global user.email "bot@dragonos.org"
git add docs/locales/
git commit -m "Update translated documentation" || echo "No changes to commit"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Update translated documentation"
title: "docs: Translation update [${{steps.get-short_sha.outputs.short_sha}}]"
body: |
Automated translation update triggered by docs changes
Commit: ${{ github.sha }}
branch: "dragonosbot/docs-translation-update"
branch-suffix: "timestamp"
base: ${{ github.ref_name }}
author: bot <bot@dragonos.org>
delete-branch: true
reviewers: fslongjin
assignees: fslongjin

View File

@ -11,14 +11,14 @@ jobs:
name: Format check ${{ matrix.arch }}
runs-on: ubuntu-latest
continue-on-error: true
container: dragonos/dragonos-dev:v1.8
container: dragonos/dragonos-dev:v1.12
strategy:
matrix:
arch: [x86_64, riscv64]
arch: [x86_64, riscv64, loongarch64]
steps:
- run: echo "Running in dragonos/dragonos-dev:v1.8"
- run: echo "Running in dragonos/dragonos-dev:v1.12"
- uses: actions/checkout@v3
- name: Format check
@ -35,14 +35,14 @@ jobs:
name: Kernel static test ${{ matrix.arch }}
runs-on: ubuntu-latest
continue-on-error: true
container: dragonos/dragonos-dev:v1.8
container: dragonos/dragonos-dev:v1.12
strategy:
matrix:
arch: [x86_64, riscv64]
arch: [x86_64, riscv64, loongarch64]
steps:
- run: echo "Running in dragonos/dragonos-dev:v1.8"
- run: echo "Running in dragonos/dragonos-dev:v1.12"
- uses: actions/checkout@v3
@ -53,46 +53,41 @@ jobs:
HOME: /root
run: bash -c "source /root/.cargo/env && cd kernel && make test && make test-rbpf"
build-x86_64:
build:
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
container: dragonos/dragonos-dev:v1.8
container: dragonos/dragonos-dev:v1.12
continue-on-error: true
strategy:
matrix:
include:
- arch: x86_64
make_target: all
checkout_params: {}
- arch: riscv64
make_target: all
checkout_params:
submodules: "recursive"
- arch: loongarch64
make_target: all
checkout_params: {}
steps:
- run: echo "Running in dragonos/dragonos-dev:v1.8"
- run: echo "Running in dragonos/dragonos-dev:v1.12"
- uses: actions/checkout@v3
- name: build the DragonOS
with: ${{ matrix.checkout_params }}
- name: Build the DragonOS
env:
ARCH: x86_64
ARCH: ${{ matrix.arch }}
HOME: /root
shell: bash -ileo pipefail {0}
run: |
source ~/.bashrc
source ~/.cargo/env
export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
source $HOME/.bashrc
source $HOME/.cargo/env
if [[ "$ARCH" == "x86_64" ]]; then
export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
fi
sed -i 's/arch = ".*"/arch = "${{ env.ARCH }}"/' dadk-manifest.toml
make all -j $(nproc)
build-riscv64:
runs-on: ubuntu-latest
container: dragonos/dragonos-dev:v1.8
steps:
- run: echo "Running in dragonos/dragonos-dev:v1.8"
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: build the DragonOS
shell: bash -ileo pipefail {0}
env:
ARCH: riscv64
HOME: /root
run: |
source ~/.bashrc && source ~/.cargo/env
sed -i 's/arch = ".*"/arch = "${{ env.ARCH }}"/' dadk-manifest.toml
make kernel -j $(nproc)
make ${{ matrix.make_target }} -j $(nproc)

View File

@ -35,5 +35,5 @@ jobs:
context: "{{defaultContext}}:tools"
file: Dockerfile
platforms: linux/amd64
push: true
push: ${{ github.repository == 'DragonOS-Community/DragonOS' }}
tags: dragonos/dragonos-dev:${{ steps.fetch-versions.outputs.build_container_version }}

23
.github/workflows/sync-to-cnb.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: Sync to CNB.cool
on: [push]
jobs:
sync:
if: github.repository == 'DragonOS-Community/DragonOS'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Sync to CNB Repository
run: |
docker run --rm \
-v ${{ github.workspace }}:${{ github.workspace }} \
-w ${{ github.workspace }} \
-e PLUGIN_TARGET_URL="https://cnb.cool/DragonOS-Community/DragonOS.git" \
-e PLUGIN_AUTH_TYPE="https" \
-e PLUGIN_USERNAME="cnb" \
-e PLUGIN_PASSWORD=${{ secrets.CNB_GIT_PASSWORD }} \
-e PLUGIN_FORCE="true" \
tencentcom/git-sync

1
.gitignore vendored
View File

@ -19,3 +19,4 @@ cppcheck.xml
.cache
compile_commands.json
/logs/
*.log

141
.vscode/settings.json vendored
View File

@ -1,158 +1,19 @@
{
"files.associations": {
"stdbool.h": "c",
"printk.h": "c",
"stdarg.h": "c",
"process.h": "c",
"cpu.h": "c",
"mm.h": "c",
"glib.h": "c",
"asm.h": "c",
"memory.h": "c",
"kprint.h": "c",
"ptrace.h": "c",
"mouse.h": "c",
"algorithm": "c",
"array": "c",
"atomic": "c",
"*.tcc": "c",
"bitset": "c",
"cassert": "c",
"cctype": "c",
"cerrno": "c",
"chrono": "c",
"climits": "c",
"clocale": "c",
"cmath": "c",
"codecvt": "c",
"condition_variable": "c",
"cstdarg": "c",
"cstddef": "c",
"cstdint": "c",
"cstdio": "c",
"cstdlib": "c",
"cstring": "c",
"ctime": "c",
"cwchar": "c",
"cwctype": "c",
"deque": "c",
"exception": "c",
"forward_list": "c",
"functional": "c",
"iterator": "c",
"list": "c",
"map": "c",
"memory": "c",
"memory_resource": "c",
"numeric": "c",
"optional": "c",
"random": "c",
"ratio": "c",
"set": "c",
"string": "c",
"string_view": "c",
"system_error": "c",
"tuple": "c",
"type_traits": "c",
"unordered_map": "c",
"utility": "c",
"vector": "c",
"fstream": "c",
"initializer_list": "c",
"ios": "c",
"iosfwd": "c",
"istream": "c",
"limits": "c",
"locale": "c",
"mutex": "c",
"new": "c",
"ostream": "c",
"queue": "c",
"sstream": "c",
"stdexcept": "c",
"streambuf": "c",
"thread": "c",
"cinttypes": "c",
"cstdbool": "c",
"typeinfo": "c",
"unistd.h": "c",
"stdint.h": "c",
"syscall.h": "c",
"fcntl.h": "c",
"types.h": "c",
"string.h": "c",
"math.h": "c",
"arch.h": "c",
"stdio.h": "c",
"wait_queue.h": "c",
"stddef.h": "c",
"spinlock.h": "c",
"stat.h": "c",
"video.h": "c",
"ahci.h": "c",
"slab.h": "c",
"boot_info.h": "c",
"pci.h": "c",
"time.h": "c",
"errno.h": "c",
"bug.h": "c",
"sched.h": "c",
"preempt.h": "c",
"textui.h": "c",
"atomic.h": "c",
"semaphore.h": "c",
"mm-types.h": "c",
"current.h": "c",
"traceback.h": "c",
"bitcount.h": "c",
"limits.h": "c",
"mutex.h": "c",
"mount.h": "c",
"internal.h": "c",
"compiler_attributes.h": "c",
"timer.h": "c",
"hid.h": "c",
"compiler.h": "c",
"err.h": "c",
"list.h": "c",
"irqflags.h": "c",
"dirent.h": "c",
"cmd_help.h": "c",
"wait.h": "c",
"ctype.h": "c",
"stdint-gcc.h": "c",
"acpi.h": "c",
"assert.h": "c",
"sys_version.h": "c",
"cmd.h": "c",
"net.h": "c",
"cmd_test.h": "c",
"cmpxchg.h": "c",
"mman.h": "c",
"clocksource.h": "c",
"ata.h": "c",
"barrier": "c",
"charconv": "c",
"printf.h": "c",
"klog.h": "c",
"malloc.h": "c",
"*.o": "c",
"k_log.h": "c"
},
"C_Cpp.errorSquiggles": "enabled",
"esbonio.sphinx.confDir": "",
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.linkedProjects": [
"./kernel/Cargo.toml",
//"./tools/Cargo.toml",
],
// "rust-analyzer.cargo.target": "loongarch64-unknown-none",
// "rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf",
"rust-analyzer.cargo.target": "x86_64-unknown-none",
"rust-analyzer.check.overrideCommand": [
"make",
"check",
],
"makefile.configureOnOpen": false,
}

View File

@ -74,6 +74,8 @@ clean-docs:
gdb:
ifeq ($(ARCH), x86_64)
rust-gdb -n -x tools/.gdbinit
else ifeq ($(ARCH), loongarch64)
loongarch64-unknown-linux-gnu-gdb -n -x tools/.gdbinit
else
gdb-multiarch -n -x tools/.gdbinit
endif
@ -139,6 +141,11 @@ run-vnc: check_arch
$(MAKE) write_diskimage || exit 1
$(MAKE) qemu-vnc
run-nographic: check_arch
$(MAKE) all -j $(NPROCS)
$(MAKE) write_diskimage || exit 1
$(MAKE) qemu-nographic
# 在docker中编译并启动QEMU
run-docker: check_arch
@echo "使用docker构建并运行"

127
README.md
View File

@ -1,129 +1,94 @@
<div align="center">
<img width="40%" src="docs/_static/dragonos-logo.svg" alt="dragonos-logo"></br>
<h2>打造完全自主可控的数字化未来!</h2>
<h2>Lightweight Cloud-Native Kernel</h2>
<a href="https://dragonos.org"><img alt="官网" src="https://img.shields.io/badge/%E5%AE%98%E7%BD%91-DragonOS.org-4c69e4?link=https%3A%2F%2Fbbs.dragonos.org.cn" ></a>
<a href="https://bbs.dragonos.org.cn"><img alt="bbs" src="https://img.shields.io/badge/BBS-bbs.dragonos.org.cn-purple?link=https%3A%2F%2Fbbs.dragonos.org.cn" ></a>
---
</div>
# DragonOS
**Languages** 中文|[English](README_EN.md)
**Languages** [中文](README_CN.md)|English
&nbsp;
&emsp;&emsp;DragonOS龙操作系统是一个面向云计算轻量化场景的完全自主内核的提供Linux二进制兼容性的64位操作系统。它使用Rust语言进行开发以提供更好的可靠性。目前在Rust操作系统领域DragonOS在Github排行全国稳居前三位。
&emsp;&emsp;DragonOS is a 64-bit operating system with a completely independent kernel, designed for lightweight cloud computing scenarios, offering Linux binary compatibility. It aims to provide lightweight, high-performance solutions for containerized workloads. Developed using Rust for enhanced reliability.
&emsp;&emsp;DragonOS开源社区成立于2022年7月它完全商业中立。我们的目标是构建一个完全独立自主的、开源的、高性能及高可靠性的服务器操作系统打造完全自主可控的数字化未来
&emsp;&emsp;The DragonOS open-source community was established in July 2022 and is entirely commercially neutral. We warmly welcome interested developers and enthusiasts to join us!
&emsp;&emsp;DragonOS具有优秀的、完善的架构设计。相比于同体量的其他系统DragonOS支持虚拟化并在设备模型、调度子系统等方面具有一定优势。当前正在大力推进云平台支持、riscv支持等工作以及编译器、应用软件的移植。力求在5年内实现生产环境大规模应用。
&emsp;&emsp;DragonOS features excellent and comprehensive architectural design. Compared to other systems of similar scale, DragonOS supports eBPF and virtualization. Currently, we are actively advancing container support, cloud platform compatibility, RISC-V support, as well as porting compilers and application software. Our goal is to achieve large-scale production environment deployment within five years.
&emsp;&emsp;DragonOS目前在社区驱动下正在快速发展中目前DragonOS已经实现了约1/4的Linux接口在未来我们将提供对Linux的100%兼容性,并且提供新特性。
&emsp;&emsp;DragonOS is rapidly evolving under community-driven development. Currently, DragonOS has implemented approximately 1/4 of Linux interfaces. In the future, we will provide 100% Linux compatibility along with new features.
## How to Run?
## 参与开发?
&emsp;&emsp;Running DragonOS is straightforward. You can refer to the following resources to get DragonOS up and running in as little as 15 minutes!
仔细阅读 [DragonOS社区介绍文档] ,能够帮助你了解社区的运作方式,以及如何参与贡献!
- [Building DragonOS — DragonOS dev documentation](https://docs.dragonos.org.cn/locales/en/introduction/build_system.html)
- **了解开发动态、开发任务请访问DragonOS社区论坛** [https://bbs.dragonos.org.cn](https://bbs.dragonos.org.cn)
- 您也可以从项目的issue里面了解相关的开发内容。
## Want to Contribute?
Read the [DragonOS Community Introduction Document] carefully to understand how the community operates and how you can contribute!
&emsp;&emsp;如果你愿意加入我们你可以查看issue并在issue下发表讨论、想法或者访问DragonOS的论坛了解开发动态、开发任务 [https://bbs.dragonos.org.cn](https://bbs.dragonos.org.cn)
&emsp;&emsp;If you'd like to join us, check out the issues and participate in discussions or share your ideas. You can also visit the DragonOS forum to stay updated on development progress and tasks: [https://bbs.dragonos.org.cn](https://bbs.dragonos.org.cn)
&emsp;&emsp;你也可以带着你的创意与想法和社区的小伙伴一起讨论为DragonOS创造一些新的功能。
&emsp;&emsp;You can also bring your creativity and ideas to discuss with the community and contribute new features to DragonOS.
## 网站
## Sites
- Official Website: **[DragonOS.org](https://dragonos.org)**
- Documentation: **[docs.dragonos.org](https://docs.dragonos.org)**
- Community Introduction: **[community.dragonos.org](https://community.dragonos.org)**
- QQ Group: 476358494
- 项目官网 **[DragonOS.org](https://dragonos.org)**
- 文档:**[docs.dragonos.org](https://docs.dragonos.org)**
- 社区介绍文档: **[community.dragonos.org](https://community.dragonos.org)**
## How to Connect with the Community?
Please read the [Contributor Guide](https://community.dragonos.org/contributors/#%E7%A4%BE%E5%8C%BA)~
## 如何运行?
&emsp;&emsp;运行DragonOS的步骤非常简单您可以参考以下几个资料在最短15分钟内运行DragonOS
- [构建DragonOS — DragonOS dev 文档](https://docs.dragonos.org/zh_CN/latest/introduction/build_system.html)
## 如何与社区建立联系?
请阅读[贡献者指南](https://community.dragonos.org/contributors/#%E7%A4%BE%E5%8C%BA)~
- 您可以通过[社区管理团队]信息,与各委员会的成员们建立联系~
- 同时,您可以通过[SIGs]和[WGs]页面,找到对应的社区团体负责人的联系方式~
## 贡献者名单
- You can find contact details for members of various committees in the [Community Management Team] section.
- You can also locate the contact information for leaders of specific community groups via the [SIGs] and [WGs] pages.
## Contributor List
[Contributors to DragonOS-Community/DragonOS · GitHub](https://github.com/DragonOS-Community/DragonOS/graphs/contributors)
## Sponsorship
[![Sponsor this project](https://img.shields.io/badge/Sponsor_This_Project-DragonOS_Community-ff69b4?style=for-the-badge)](https://dragonos.org/?page_id=37)
&emsp;&emsp;DragonOS is a non-profit open-source project, and its development relies on financial support. All sponsors will be publicly acknowledged. Every contribution you make will help advance DragonOS!
## 赞助
### Where Will Sponsorship Funds Be Used?
&emsp;&emsp;DragonOS是一个公益性质的开源项目但是它的发展离不开资金的支持如果您愿意的话可以通过 **[赞助 - DragonOS](https://dragonos.org/?page_id=37)** 从而促进这个项目的发展。所有的赞助者的名单都会被公示。您的每一分赞助都会为DragonOS的发展作出贡献
We guarantee that all sponsorship funds and items will be used for:
### 赞助的资金都会被用到哪里?
- Event organization, cloud service expenses, and any other purposes beneficial to the development and growth of the DragonOS community.
我们保证,所有赞助的资金及物品,将会用于:
## 🌟 Sponsor List
**Special thanks to these generous financial supporters** (in reverse chronological order):
- 为活跃的社区开发者发放补贴或设备支持
- **[中国雅云](https://yacloud.net)** 雅安大数据产业园 - 🥇 Long-term supporter
- DragonOS的云服务开支
### Individual Sponsors List
See [Supporters.md](./SUPPORTERS.md)
- 设备购置
## Open Source License Notice
- 任何有助于DragonOS发展建设的用途
This project is open-sourced under the GPLv2 license. You are welcome to use the code in compliance with the open-source license!
### 赞助商列表
If you encounter any violations of the open-source license, we encourage you to email pmc@dragonos.org to report them. Let's work together to build a trustworthy open-source community.
- **[中国雅云](https://yacloud.net)** 雅安数字经济运营有限公司为DragonOS提供了云服务器支持。
---
## 👩💻 Contributors
### 个人赞赏者列表
> *"Open source shines because of you!"*
- 万晓兰
- David Wen
- [YJwu2023](https://github.com/YJwu2023)
- [longjin](https://github.com/fslongjin)
- [黄铭涛](https://github.com/1037827920)
- [许梓毫](https://github.com/Jomocool)
- [谢润霖](https://github.com/xiaolin2004)
- [蔡俊源](https://github.com/SMALLC04)
- Kelly
- [Samuka007](https://github.com/Samuka007)
- [杨璐玮](https://github.com/val213)
- [何懿聪](https://github.com/GnoCiYeH)
- [周凯韬](https://github.com/laokengwt)
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- [ferchiel](https://github.com/ferchiel)
- 叶锦毅
- 林
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- 悟
**Thanks to all developers who submitted code, fixed issues, or reviewed PRs**:
## 开放源代码声明
<a href="https://github.com/DragonOS-Community/dragonos/graphs/contributors">
<img src="https://contrib.rocks/image?repo=dragonos-community/dragonos" />
</a>
本项目采用GPLv2协议进行开源欢迎您在遵守开源协议的基础之上使用本项目的代码
**我们支持**:遵守协议的情况下,利用此项目,创造更大的价值,并为本项目贡献代码。
**我们谴责**:任何不遵守开源协议的行为。包括但不限于:剽窃该项目的代码作为你的毕业设计等学术不端行为以及商业闭源使用而不付费。
若您发现了任何违背开源协议的使用行为,我们欢迎您发邮件到 pmc@dragonos.org 反馈!让我们共同建设诚信的开源社区。
[DragonOS社区介绍文档]: https://community.dragonos.org/
[社区管理团队]: https://community.dragonos.org/governance/staff-info.html
[DragonOS Community Introduction Document]: https://community.dragonos.org/
[Community Management Team]: https://community.dragonos.org/governance/staff-info.html
[SIGs]: https://community.dragonos.org/sigs/
[WGs]: https://community.dragonos.org/wgs/

101
README_CN.md Normal file
View File

@ -0,0 +1,101 @@
<div align="center">
<img width="40%" src="docs/_static/dragonos-logo.svg" alt="dragonos-logo"></br>
<h2>轻量级云原生内核</h2>
<a href="https://dragonos.org"><img alt="官网" src="https://img.shields.io/badge/%E5%AE%98%E7%BD%91-DragonOS.org-4c69e4?link=https%3A%2F%2Fbbs.dragonos.org.cn" ></a>
<a href="https://bbs.dragonos.org.cn"><img alt="bbs" src="https://img.shields.io/badge/BBS-bbs.dragonos.org.cn-purple?link=https%3A%2F%2Fbbs.dragonos.org.cn" ></a>
---
</div>
# DragonOS
**Languages** 中文|[English](README.md)
&nbsp;
&emsp;&emsp;DragonOS龙操作系统是一个面向云计算轻量化场景的完全自主内核的提供Linux二进制兼容性的64位操作系统旨在为容器化工作负载提供轻量级、高性能的解决方案。它使用Rust语言进行开发以提供更好的可靠性。
&emsp;&emsp;DragonOS开源社区成立于2022年7月完全商业中立。我们热烈欢迎感兴趣的开发者和爱好者加入我们
&emsp;&emsp;DragonOS具有优秀的、完善的架构设计。相比于同体量的其他系统DragonOS支持eBPF、虚拟化。当前正在大力推进容器支持、云平台支持、riscv支持等工作以及编译器、应用软件的移植。力求在5年内实现生产环境大规模应用。
&emsp;&emsp;DragonOS目前在社区驱动下正在快速发展中目前DragonOS已经实现了约1/4的Linux接口在未来我们将提供对Linux的100%兼容性,并且提供新特性。
## 如何运行?
&emsp;&emsp;运行DragonOS的步骤非常简单您可以参考以下几个资料在最短15分钟内运行DragonOS
- [构建DragonOS — DragonOS dev 文档](https://docs.dragonos.org.cn/introduction/build_system.html)
## 参与开发?
仔细阅读 [DragonOS社区介绍文档] ,能够帮助你了解社区的运作方式,以及如何参与贡献!
&emsp;&emsp;如果你愿意加入我们你可以查看issue并在issue下发表讨论、想法或者访问DragonOS的论坛了解开发动态、开发任务 [https://bbs.dragonos.org.cn](https://bbs.dragonos.org.cn)
&emsp;&emsp;你也可以带着你的创意与想法和社区的小伙伴一起讨论为DragonOS创造一些新的功能。
## 站点
- 项目官网 **[DragonOS.org](https://dragonos.org)**
- 文档:**[docs.dragonos.org](https://docs.dragonos.org)**
- 社区介绍文档: **[community.dragonos.org](https://community.dragonos.org)**
- QQ群 476358494
## 如何与社区建立联系?
请阅读[贡献者指南](https://community.dragonos.org/contributors/#%E7%A4%BE%E5%8C%BA)~
- 您可以通过[社区管理团队]信息,与各委员会的成员们建立联系~
- 同时,您可以通过[SIGs]和[WGs]页面,找到对应的社区团体负责人的联系方式~
## 贡献者名单
[Contributors to DragonOS-Community/DragonOS · GitHub](https://github.com/DragonOS-Community/DragonOS/graphs/contributors)
## 赞助
[![Sponsor this project](https://img.shields.io/badge/Sponsor_This_Project-DragonOS_Community-ff69b4?style=for-the-badge)](https://dragonos.org/?page_id=37)
&emsp;&emsp;DragonOS是一个公益性质的开源项目它的发展离不开资金的支持所有的赞助者的名单都会被公示。您的每一分赞助都会为DragonOS的发展作出贡献
### 赞助的资金都会被用到哪里?
我们保证,所有赞助的资金及物品,将会用于:
- 活动开展、云服务开支以及任何有利于DragonOS社区发展和建设的用途。
## 🌟 赞助商列表
**Special thanks to these generous financial supporters** (in reverse chronological order):
- **[中国雅云](https://yacloud.net)** 雅安大数据产业园 - 🥇 Long-term supporter
### 个人赞赏者列表
请见 [Supporters.md](./SUPPORTERS.md)
## 开放源代码声明
本项目采用GPLv2协议进行开源欢迎您在遵守开源协议的基础之上使用本项目的代码
若您发现了任何违背开源协议的使用行为,我们欢迎您发邮件到 pmc@dragonos.org 反馈!让我们共同建设诚信的开源社区。
## 👩💻 Contributors
> *"开源因你而更加闪耀!"*
**感谢所有提交代码、修复问题或审核PR的开发者**:
<a href="https://github.com/DragonOS-Community/dragonos/graphs/contributors">
<img src="https://contrib.rocks/image?repo=dragonos-community/dragonos" />
</a>
[DragonOS社区介绍文档]: https://community.dragonos.org/
[社区管理团队]: https://community.dragonos.org/governance/staff-info.html
[SIGs]: https://community.dragonos.org/sigs/
[WGs]: https://community.dragonos.org/wgs/

View File

@ -1,119 +0,0 @@
<div align="center">
<img width="40%" src="docs/_static/dragonos-logo.svg" alt="dragonos-logo"></br>
<h2>打造完全自主可控的数字化未来!</h2>
<a href="https://dragonos.org"><img alt="官网" src="https://img.shields.io/badge/%E5%AE%98%E7%BD%91-DragonOS.org-4c69e4?link=https%3A%2F%2Fbbs.dragonos.org.cn" ></a>
<a href="https://bbs.dragonos.org.cn"><img alt="bbs" src="https://img.shields.io/badge/BBS-bbs.dragonos.org.cn-purple?link=https%3A%2F%2Fbbs.dragonos.org.cn" ></a>
---
</div>
# DragonOS
**Languages** [中文](README.md)|English
&nbsp;
&emsp;&emsp;DragonOS is a 64-bit operating system designed for lightweight cloud computing scenarios, featuring a fully independent kernel and offering Linux binary compatibility. Developed using the Rust programming language, it aims to provide improved reliability. In the Rust operating system domain, DragonOS consistently ranks among the top three on GitHub nationally.
&emsp;&emsp;The DragonOS open-source community was established in July 2022 and is entirely business-neutral. Our goal is to build a fully independent, open-source, high-performance, and highly reliable server operating system, fostering a digitally autonomous and controllable future!
&emsp;&emsp;DragonOS boasts an excellent and comprehensive architecture design. Compared to other systems of similar scale, DragonOS supports virtualization and has certain advantages in terms of device model and调度子系统 (scheduler subsystem).Currently, significant efforts are being made to promote cloud platform support, RISC-V compatibility, and the porting of compilers and application software. The aim is to achieve large-scale application in production environments within five years.
&emsp;&emsp;Driven by the community, DragonOS is currently evolving rapidly. DragonOS has already implemented about 1/4 of Linux interfaces, and in the future, we will strive to provide 100% compatibility with Linux, along with new features.
## Get Involved in Development?
Carefully read the [DragonOS Community Introduction Document] to understand how the community operates and how you can contribute!
- **To stay updated on development news and tasks, visit the DragonOS Community Forum**: [https://bbs.dragonos.org.cn](https://bbs.dragonos.org.cn)
- You can also learn about the development progress by checking the project's issues.
&emsp;&emsp;If you're interested in joining us, you can check out the issues and post your discussions or ideas under them, or visit the DragonOS forum to learn about development updates and tasks: [https://bbs.dragonos.org.cn](https://bbs.dragonos.org.cn)
&emsp;&emsp;You're also welcome to bring your creative ideas and discuss them with the community members, working together to create new features for DragonOS.
## Website
- **Project's Website**: [DragonOS.org](https://dragonos.org)
- Documentation: [docs.dragonos.org](https://docs.dragonos.org)
- Community Introduction Document: [community.dragonos.org](https://community.dragonos.org)
## How to Run?
&emsp;&emsp;Running DragonOS is quite straightforward. You can refer to the following resources and get DragonOS up and running in as little as 15 minutes!
- [Building DragonOS — DragonOS Development Documentation](https://docs.dragonos.org/zh_CN/latest/introduction/build_system.html)
## How to Connect with the Community?
Please read the [Contributor Guide](https://community.dragonos.org/contributors/#%E7%A4%BE%E5%8C%BA)~
- You can establish contact with the members of various committees through the [Community Management Team] information.
- Additionally, you can find the contact information of the respective community group leaders via the [SIGs] and [WGs] pages.
## Reward
&emsp;&emsp;DragonOS is an open source public welfare project, but its development cannot be separated from the support of funds. If you want, you can visit **[Sponsor - DragonOS](https://dragonos.org/?page_id=37)** , so as to promote the development of this project. The list of all sponsors will be published. Every bit of your sponsorship will contribute to the development of DragonOS!
### Where will the sponsorship funds be used?
We guarantee that all sponsorship funds and items will be used for:
- Subsidies or equipment support for active community developers
- Cloud service expenditure of DragonOS
- Equipment purchase
- Any use conducive to the development and construction of DragonOS
### Sponsor List
**Not yet**
- **[China YaCloud](https://yacloud.net)** Ya'an Digital Economy Operations Co., Ltd. provides cloud server support for DragonOS.
### Individual Sponsor List
- 万晓兰
- David Wen
- [YJwu2023](https://github.com/YJwu2023)
- [longjin](https://github.com/fslongjin)
- [黄铭涛](https://github.com/1037827920)
- [许梓毫](https://github.com/Jomocool)
- [谢润霖](https://github.com/xiaolin2004)
- [蔡俊源](https://github.com/SMALLC04)
- Kelly
- [Samuka007](https://github.com/Samuka007)
- [杨璐玮](https://github.com/val213)
- [何懿聪](https://github.com/GnoCiYeH)
- [周凯韬](https://github.com/laokengwt)
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- [ferchiel](https://github.com/ferchiel)
- 叶锦毅
- 林
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- 悟
## Open source statement
&emsp;&emsp;This project adopts GPLv2 LICENSE for open source. You are welcome to use the code of this project on the basis of abiding by the open source license!
**What we support:** using this project to create greater value and contribute code to this project under the condition of abiding by the agreement.
**What we condemn**: any non-compliance with the open source license. Including but not limited to: plagiarizing the code of the project as your graduation project and other academic misconduct, as well as commercial closed source use without payment.
If you find any violation of the open source license, we welcome you to send email feedback! Let's build an honest open source community together!
[DragonOS Community Introduction Document]: https://community.dragonos.org/
[Community Management Team]: https://community.dragonos.org/governance/staff-info.html
[SIGs]: https://community.dragonos.org/sigs/
[WGs]: https://community.dragonos.org/wgs/

64
SUPPORTERS.md Normal file
View File

@ -0,0 +1,64 @@
# 🙌 Supporters & Contributors
Thank you to the following individuals and organizations for supporting this project! Whether through code contributions, issue feedback, or financial sponsorship, your support makes this project better.
> *"Open source shines because of you!"*
---
## 🌟 Sponsors
**Special thanks to these generous financial supporters** (in reverse chronological order):
[![Sponsor this project](https://img.shields.io/badge/Sponsor_This_Project-DragonOS_Community-ff69b4?style=for-the-badge)](https://dragonos.org/?page_id=37)
- **[中国雅云](https://yacloud.net)** 雅安大数据产业园 - 🥇 Long-term supporter
### Individual Supporters
- 万晓兰
- David Wen
- [YJwu2023](https://github.com/YJwu2023)
- [longjin](https://github.com/fslongjin)
- [黄铭涛](https://github.com/1037827920)
- [许梓毫](https://github.com/Jomocool)
- [谢润霖](https://github.com/xiaolin2004)
- [蔡俊源](https://github.com/SMALLC04)
- Kelly
- [Samuka007](https://github.com/Samuka007)
- [杨璐玮](https://github.com/val213)
- [何懿聪](https://github.com/GnoCiYeH)
- [周凯韬](https://github.com/laokengwt)
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- [ferchiel](https://github.com/ferchiel)
- 叶锦毅
- 林
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- 悟
---
## 👩💻 Contributors
**Thanks to all developers who submitted code, fixed issues, or reviewed PRs**:
<a href="https://github.com/DragonOS-Community/dragonos/graphs/contributors">
<img src="https://contrib.rocks/image?repo=dragonos-community/dragonos" />
</a>
---
## 🤝 Community Supporters
**Thanks to the following members for suggestions, testing, and promotion**
---
## 🙏 How to Join This List?
If you'd like to support this project, here's how:
1. **Code Contributions**: Submit PRs to address [open issues](https://github.com/DragonOS-Community/DragonOS/issues)
2. **Financial Sponsorship**: [![Sponsor this project](https://img.shields.io/badge/Sponsor_This_Project-DragonOS_Community-ff69b4?style=for-the-badge)](https://dragonos.org/?page_id=37)
3. **Community Help**: Test new releases, share the project, provide feedback
All valid supporters will be periodically updated to this list (anonymous display available upon request).
---

View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "aho-corasick"
@ -87,12 +87,6 @@ version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "elf"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b"
[[package]]
name = "equivalent"
version = "1.0.1"
@ -109,6 +103,10 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "gen_kallsyms"
version = "0.1.0"
[[package]]
name = "glob"
version = "0.3.1"
@ -193,13 +191,6 @@ version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
[[package]]
name = "linux_boot_helper"
version = "0.1.0"
dependencies = [
"elf",
]
[[package]]
name = "log"
version = "0.4.20"

View File

@ -1,5 +1,3 @@
[workspace]
members = [
"kernel_build",
]
members = ["gen_kallsyms", "kernel_build"]
resolver = "2"

View File

@ -1,8 +1,9 @@
.PHONY: fmt
all:
@cargo +nightly-2024-11-05 build --release -p gen_kallsyms
fmt:
cargo fmt --all $(FMT_CHECK)
clean:
@cargo clean
check:
@cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json
.PHONY: fmt

View File

@ -0,0 +1,6 @@
[package]
name = "gen_kallsyms"
version = "0.1.0"
edition = "2021"
[dependencies]

View File

@ -0,0 +1,122 @@
use std::str;
#[derive(Debug, Clone)]
struct KernelSymbolEntry {
vaddr: u64,
#[allow(dead_code)]
symbol_type: char,
symbol: String,
symbol_length: usize,
}
fn symbol_to_write(vaddr: u64, text_vaddr: u64, etext_vaddr: u64) -> bool {
vaddr >= text_vaddr && vaddr <= etext_vaddr
}
fn read_symbol(line: &str) -> Option<KernelSymbolEntry> {
if line.len() > 512 {
return None;
} // skip line with length >= 512
let mut parts = line.split_whitespace();
let vaddr = u64::from_str_radix(parts.next()?, 16).ok()?;
let symbol_type = parts.next()?.chars().next()?;
let symbol = parts.collect::<Vec<_>>().join(" ");
if symbol_type != 'T' && symbol_type != 't' {
return None;
} // local symbol or global symbol in text section
if symbol == "$x" {
return None;
} // skip $x symbol
let symbol_length = symbol.len() + 1; // +1 for null terminator
Some(KernelSymbolEntry {
vaddr,
symbol_type,
symbol,
symbol_length,
})
}
fn read_map() -> (Vec<KernelSymbolEntry>, u64, u64) {
let mut symbol_table = Vec::new();
let mut text_vaddr = 0;
let mut etext_vaddr = 0;
let mut line = String::new();
loop {
let size = std::io::stdin().read_line(&mut line).unwrap();
if size == 0 {
break;
}
line = line.trim().to_string();
if let Some(entry) = read_symbol(&line) {
if entry.symbol.starts_with("_text") {
text_vaddr = entry.vaddr;
} else if entry.symbol.starts_with("_etext") {
etext_vaddr = entry.vaddr;
}
symbol_table.push(entry);
}
line.clear();
}
(symbol_table, text_vaddr, etext_vaddr)
}
fn generate_result(symbol_table: &[KernelSymbolEntry], text_vaddr: u64, etext_vaddr: u64) {
println!(".section .rodata\n");
println!(".global kallsyms_address");
println!(".align 8\n");
println!("kallsyms_address:");
let mut last_vaddr = 0;
let mut total_syms_to_write = 0;
for entry in symbol_table {
if !symbol_to_write(entry.vaddr, text_vaddr, etext_vaddr) || entry.vaddr == last_vaddr {
continue;
}
println!("\t.quad\t{:#x}", entry.vaddr);
total_syms_to_write += 1;
last_vaddr = entry.vaddr;
}
println!("\n.global kallsyms_num");
println!(".align 8");
println!("kallsyms_num:");
println!("\t.quad\t{}", total_syms_to_write);
println!("\n.global kallsyms_names_index");
println!(".align 8");
println!("kallsyms_names_index:");
let mut position = 0;
last_vaddr = 0;
for entry in symbol_table {
if !symbol_to_write(entry.vaddr, text_vaddr, etext_vaddr) || entry.vaddr == last_vaddr {
continue;
}
println!("\t.quad\t{}", position);
position += entry.symbol_length;
last_vaddr = entry.vaddr;
}
println!("\n.global kallsyms_names");
println!(".align 8");
println!("kallsyms_names:");
last_vaddr = 0;
for entry in symbol_table {
if !symbol_to_write(entry.vaddr, text_vaddr, etext_vaddr) || entry.vaddr == last_vaddr {
continue;
}
println!("\t.asciz\t\"{}\"", entry.symbol);
last_vaddr = entry.vaddr;
}
}
fn main() {
let (symbol_table, text_vaddr, etext_vaddr) = read_map();
generate_result(&symbol_table, text_vaddr, etext_vaddr);
}

View File

@ -0,0 +1,10 @@
use super::BindgenArch;
pub struct LoongArch64BindgenArch;
impl BindgenArch for LoongArch64BindgenArch {
fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder {
builder
.clang_arg("-I./src/arch/loongarch64/include")
.clang_arg("--target=x86_64-none-none") // 由于clang不支持loongarch64所以使用x86_64作为目标按理来说问题不大
}
}

View File

@ -1,20 +0,0 @@
use crate::utils::cargo_handler::{CargoHandler, TargetArch};
use self::x86_64::X86_64BindgenArch;
pub mod riscv64;
pub mod x86_64;
pub(super) trait BindgenArch {
fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder;
}
/// 获取当前的bindgen架构;
pub(super) fn current_bindgenarch() -> &'static dyn BindgenArch {
let arch = CargoHandler::target_arch();
match arch {
TargetArch::X86_64 => &X86_64BindgenArch,
TargetArch::Riscv64 => &riscv64::RiscV64BindgenArch,
_ => panic!("Unsupported arch: {:?}", arch),
}
}

View File

@ -1,10 +0,0 @@
use super::BindgenArch;
pub struct RiscV64BindgenArch;
impl BindgenArch for RiscV64BindgenArch {
fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder {
builder
.clang_arg("-I./src/arch/riscv64/include")
.clang_arg("--target=riscv64-none-none-elf")
}
}

View File

@ -1,11 +0,0 @@
use super::BindgenArch;
pub struct X86_64BindgenArch;
impl BindgenArch for X86_64BindgenArch {
fn generate_bindings(&self, builder: bindgen::Builder) -> bindgen::Builder {
builder
.clang_arg("-I./src/arch/x86_64/include")
.clang_arg("--target=x86_64-none-none")
}
}

View File

@ -1,50 +0,0 @@
use std::{path::PathBuf, str::FromStr};
use crate::{bindgen::arch::current_bindgenarch, utils::cargo_handler::CargoHandler};
mod arch;
/// 生成 C->Rust bindings
pub fn generate_bindings() {
let wrapper_h = PathBuf::from_str("src/include/bindings/wrapper.h")
.expect("Failed to parse 'wrapper.h' path");
CargoHandler::emit_rerun_if_files_changed(&[wrapper_h.clone()]);
let out_path = PathBuf::from(String::from("src/include/bindings/"));
// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options for
// the resulting bindings.
let builder = bindgen::Builder::default()
.clang_arg("-I./src")
.clang_arg("-I./src/include")
// The input header we would like to generate
// bindings for.
.header(wrapper_h.to_str().unwrap())
.blocklist_file("src/include/bindings/bindings.h")
.clang_arg("-v")
// 使用core并将c语言的类型改为core::ffi而不是使用std库。
.use_core()
.ctypes_prefix("::core::ffi")
.generate_inline_functions(true)
.raw_line("#![allow(dead_code)]")
.raw_line("#![allow(non_upper_case_globals)]")
.raw_line("#![allow(non_camel_case_types)]")
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks));
// 处理架构相关的绑定
let builder = current_bindgenarch().generate_bindings(builder);
// Finish the builder and generate the bindings.
let bindings = builder
.generate()
// Unwrap the Result and panic on failure.
.expect("Unable to generate bindings");
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}

View File

@ -0,0 +1,29 @@
use std::{collections::HashSet, path::PathBuf};
use crate::constant::ARCH_DIR_LOONGARCH64;
use super::CFilesArch;
pub(super) struct LoongArch64CFilesArch;
impl CFilesArch for LoongArch64CFilesArch {
fn setup_defines(&self, c: &mut cc::Build) {
c.define("__loongarch64__", None);
c.define("__loongarch", None);
}
fn setup_files(&self, _c: &mut cc::Build, _files: &mut HashSet<PathBuf>) {}
fn setup_global_flags(&self, c: &mut cc::Build) {
// 在这里设置编译器不然的话vscode的rust-analyzer会报错
c.compiler("loongarch64-unknown-linux-gnu-gcc");
c.flag("-mcmodel=normal");
c.flag("-march=loongarch64");
}
}
#[allow(dead_code)]
fn arch_path(relative_path: &str) -> PathBuf {
PathBuf::from(format!("{}/{}", ARCH_DIR_LOONGARCH64, relative_path))
}

View File

@ -6,17 +6,15 @@ use crate::utils::cargo_handler::{CargoHandler, TargetArch};
use self::x86_64::X86_64CFilesArch;
pub mod loongarch64;
pub mod riscv64;
pub mod x86_64;
pub(super) trait CFilesArch {
/// 设置架构相关的宏定义
fn setup_defines(&self, c: &mut Build);
/// 设置架构相关的全局包含目录
fn setup_global_include_dir(&self, c: &mut HashSet<PathBuf>);
/// 设置需要编译的架构相关的文件
fn setup_files(&self, c: &mut Build, files: &mut HashSet<PathBuf>);
/// 设置架构相关的全局编译标志
fn setup_global_flags(&self, c: &mut Build);
}
@ -27,6 +25,8 @@ pub(super) fn current_cfiles_arch() -> &'static dyn CFilesArch {
match arch {
TargetArch::X86_64 => &X86_64CFilesArch,
TargetArch::Riscv64 => &riscv64::RiscV64CFilesArch,
TargetArch::LoongArch64 => &loongarch64::LoongArch64CFilesArch,
_ => panic!("Unsupported arch: {:?}", arch),
}
}

View File

@ -1,8 +1,5 @@
use std::{collections::HashSet, path::PathBuf};
use crate::{constant::ARCH_DIR_RISCV64, utils::FileUtils};
use super::CFilesArch;
use std::{collections::HashSet, path::PathBuf};
pub(super) struct RiscV64CFilesArch;
@ -12,18 +9,8 @@ impl CFilesArch for RiscV64CFilesArch {
c.define("__riscv", None);
}
fn setup_global_include_dir(&self, include_dirs: &mut HashSet<PathBuf>) {
include_dirs.insert("src/arch/riscv64/include".into());
}
fn setup_files(&self, _c: &mut cc::Build, files: &mut HashSet<PathBuf>) {
files.insert(PathBuf::from("src/arch/riscv64/asm/head.S"));
FileUtils::list_all_files(&arch_path("asm"), Some("c"), true)
.into_iter()
.for_each(|f| {
files.insert(f);
});
}
fn setup_global_flags(&self, c: &mut cc::Build) {
@ -37,7 +24,3 @@ impl CFilesArch for RiscV64CFilesArch {
c.flag("-march=rv64gc");
}
}
fn arch_path(relative_path: &str) -> PathBuf {
PathBuf::from(format!("{}/{}", ARCH_DIR_RISCV64, relative_path))
}

View File

@ -1,10 +1,6 @@
use std::{collections::HashSet, path::PathBuf};
use cc::Build;
use crate::{constant::ARCH_DIR_X86_64, utils::FileUtils};
use super::CFilesArch;
use cc::Build;
use std::{collections::HashSet, path::PathBuf};
pub(super) struct X86_64CFilesArch;
@ -13,20 +9,7 @@ impl CFilesArch for X86_64CFilesArch {
c.define("__x86_64__", None);
}
fn setup_global_include_dir(&self, include_dirs: &mut HashSet<PathBuf>) {
include_dirs.insert("src/arch/x86_64/include".into());
}
fn setup_files(&self, _c: &mut Build, files: &mut HashSet<PathBuf>) {
const DIRS: [&str; 4] = ["driver/apic", "init", "asm", "interrupt"];
DIRS.iter().for_each(|dir| {
FileUtils::list_all_files(&arch_path(dir), Some("c"), true)
.into_iter()
.for_each(|f| {
files.insert(f);
});
});
// setup asm files
files.insert(PathBuf::from("src/arch/x86_64/asm/head.S"));
files.insert(PathBuf::from("src/arch/x86_64/asm/entry.S"));
@ -39,7 +22,3 @@ impl CFilesArch for X86_64CFilesArch {
c.flag("-mcmodel=large").flag("-m64");
}
}
fn arch_path(relative_path: &str) -> PathBuf {
PathBuf::from(format!("{}/{}", ARCH_DIR_X86_64, relative_path))
}

View File

@ -1,20 +1,7 @@
use std::{collections::HashSet, path::PathBuf};
use crate::utils::FileUtils;
pub(super) fn setup_common_files(files: &mut HashSet<PathBuf>) {
const DIRS: [&str; 3] = ["src/common", "src/debug/traceback", "src/libs"];
DIRS.iter().for_each(|dir| {
FileUtils::list_all_files(&dir.into(), Some("c"), true)
.into_iter()
.for_each(|f| {
files.insert(f);
});
});
}
pub(super) fn setup_common_include_dir(include_dirs: &mut HashSet<PathBuf>) {
const DIRS: [&str; 3] = ["src/include", "src/common", "src"];
const DIRS: [&str; 2] = ["src/common", "src"];
DIRS.iter().for_each(|dir| {
include_dirs.insert(dir.into());
});

View File

@ -20,6 +20,9 @@ impl CFilesBuilder {
Self::setup_defines(&mut c);
Self::setup_global_include_dir(&mut c);
Self::setup_files(&mut c);
if c.get_files().count() == 0 {
return;
}
c.compile("dragonos_kernel_cfiles");
}
@ -53,8 +56,6 @@ impl CFilesBuilder {
common::setup_common_include_dir(&mut include_dirs);
current_cfiles_arch().setup_global_include_dir(&mut include_dirs);
let include_dirs: Vec<PathBuf> = include_dirs.into_iter().collect();
Self::set_rerun_if_files_changed(&include_dirs);
@ -67,7 +68,6 @@ impl CFilesBuilder {
fn setup_files(c: &mut Build) {
let mut files: HashSet<PathBuf> = HashSet::new();
current_cfiles_arch().setup_files(c, &mut files);
common::setup_common_files(&mut files);
// 去重
let files: Vec<PathBuf> = files.into_iter().collect();
Self::set_rerun_if_files_changed(&files);

View File

@ -1,2 +1,5 @@
#[allow(dead_code)]
pub const ARCH_DIR_X86_64: &str = "src/arch/x86_64";
#[allow(dead_code)]
pub const ARCH_DIR_RISCV64: &str = "src/arch/riscv64";
pub const ARCH_DIR_LOONGARCH64: &str = "src/arch/loongarch64";

View File

@ -2,7 +2,6 @@
extern crate lazy_static;
extern crate cc;
mod bindgen;
mod cfiles;
mod constant;
mod kconfig;
@ -12,7 +11,6 @@ mod utils;
pub fn run() {
println!("cargo:rustc-link-search=src");
crate::bindgen::generate_bindings();
crate::cfiles::CFilesBuilder::build();
crate::kconfig::KConfigBuilder::build();
}

View File

@ -68,6 +68,7 @@ pub enum TargetArch {
Riscv64,
Mips64,
Powerpc64,
LoongArch64,
S390x,
Sparc64,
Unknown,
@ -85,6 +86,7 @@ impl TargetArch {
"riscv64" => TargetArch::Riscv64,
"mips64" => TargetArch::Mips64,
"powerpc64" => TargetArch::Powerpc64,
"loongarch64" => TargetArch::LoongArch64,
"s390x" => TargetArch::S390x,
"sparc64" => TargetArch::Sparc64,
_ => TargetArch::Unknown,

View File

@ -2,8 +2,10 @@ use std::path::PathBuf;
pub mod cargo_handler;
#[allow(dead_code)]
pub struct FileUtils;
#[allow(dead_code)]
impl FileUtils {
/// 列出指定目录下的所有文件
///

View File

@ -1,7 +1,7 @@
# DADK 总控文件
[metadata]
# Target architecture. Options: x86_64, riscv64
# Target architecture. Options: x86_64, riscv64, loongarch64
arch = "x86_64"
# Hypervisor config path

View File

@ -0,0 +1,275 @@
{
"en:kernel/memory_management/index.rst": {
"hash": "e394aa123a0030c0ec4276485fc764b7"
},
"en:kernel/debug/index.rst": {
"hash": "6dc058a954b8620162e8293faa4959b2"
},
"en:kernel/libs/index.rst": {
"hash": "d8667f36cbfe9d9f532737a3fbe39f2d"
},
"en:kernel/process_management/index.rst": {
"hash": "b200476562e580ee97d8a3ffe19d5605"
},
"en:kernel/libs/unified-init.md": {
"hash": "28374260f0134386d53392156d749733"
},
"en:kernel/process_management/load_binary.md": {
"hash": "b7d462c7c6573ecab186c535346d6609"
},
"en:kernel/core_api/index.rst": {
"hash": "7889b9dd1b120f09f3b7feaa2dbb3c41"
},
"en:kernel/process_management/kthread.md": {
"hash": "0ce92c5a05a0e78dfceb89c215294e28"
},
"en:kernel/debug/traceback.md": {
"hash": "f22fcde87181fe9bb5ba97f133506ca1"
},
"en:kernel/core_api/casting.md": {
"hash": "b86564a0d602dfad61ab0893de43a8f8"
},
"en:kernel/memory_management/intro.md": {
"hash": "777fe6a902720949596f5a35bdf26372"
},
"en:kernel/syscall/index.rst": {
"hash": "d94e7cff4242362399e96051df1e7aad"
},
"en:kernel/libs/lib_ui/scm.md": {
"hash": "a03d756677c64b1247cfe40b6d73f1b1"
},
"en:kernel/libs/id-allocation.md": {
"hash": "5789b9d1fe4f8f72848412f6e766e099"
},
"en:kernel/memory_management/allocate-memory.md": {
"hash": "9a5c0ec57bae0576c30fbab60407f178"
},
"en:kernel/locking/index.rst": {
"hash": "299b0ccecf4ef174fffcce4731a98728"
},
"en:kernel/sched/index.rst": {
"hash": "76ca73ed6d47a4207d2ca193b88eae0b"
},
"en:kernel/locking/locks.md": {
"hash": "5514ff361db4677d2b4fa522852aaeea"
},
"en:kernel/sched/cfs.md": {
"hash": "7c89ba1c0416ec346f2982b3139cc819"
},
"en:kernel/core_api/notifier_chain.md": {
"hash": "5d21aad4640544ad49348d3cd2e8a386"
},
"en:kernel/filesystem/index.rst": {
"hash": "52dd12d566da2003602ee21c4a3d007f"
},
"en:kernel/ktest/index.rst": {
"hash": "5a4565952877c82b9a0ed3b67103c141"
},
"en:kernel/filesystem/vfs/api.md": {
"hash": "1b0b3fe0cc2918cc2c53a5af392a96ff"
},
"en:kernel/filesystem/vfs/index.rst": {
"hash": "d0de5d78a2105a1ecfe4ef137c18f7f5"
},
"en:kernel/debug/profiling-kernel-with-dadk.md": {
"hash": "966d07272ad19e1afbdc64bb6cfcea73"
},
"en:kernel/filesystem/unionfs/index.rst": {
"hash": "7ee4201508b51b4c5ac9e3b520472cd6"
},
"en:kernel/core_api/atomic.md": {
"hash": "ff17c6b902baddffff32cb9f70ddefcb"
},
"en:kernel/libs/lib_ui/textui.md": {
"hash": "dc914079508390cf7544b5b9c7ef7e4f"
},
"en:kernel/sched/rust_waiting.md": {
"hash": "6777e758cd796a356c8789f4306911ae"
},
"en:kernel/locking/rwlock.md": {
"hash": "457db706fcf5f4a7e45d15d496a29605"
},
"en:kernel/configuration/index.rst": {
"hash": "77a375890e3abf508ea1147da0e92a50"
},
"en:kernel/filesystem/kernfs.md": {
"hash": "da5cf8148a5ab38c6d0efd9ada8a0a29"
},
"en:kernel/container/namespaces/index.rst": {
"hash": "60c3b1e0726791677414064c2a98e848"
},
"en:kernel/filesystem/vfs/design.md": {
"hash": "16577686b5f5b15a5cfb25f379e01a03"
},
"en:kernel/syscall/syscall_table.rst": {
"hash": "dc34f86b55c62bdd1777a97eb7e6bd26"
},
"en:kernel/filesystem/unionfs/overlayfs.md": {
"hash": "2eba6973dc429ea15ad6ac8f47bfa187"
},
"en:kernel/container/index.rst": {
"hash": "624e76dd31081ef9304da582d835992f"
},
"en:kernel/container/namespaces/mnt_namespace.md": {
"hash": "19af9b11f162c0e4be4725d8458fd253"
},
"en:kernel/memory_management/mmio.md": {
"hash": "e956a9cd454416578996f955cd905a08"
},
"en:kernel/cpu_arch/x86_64/index.rst": {
"hash": "ff36e992e4dee15f740259d545e161e2"
},
"en:kernel/sched/rt.md": {
"hash": "913a29f3bccbf0c10a093fd558100e8d"
},
"en:kernel/cpu_arch/index.rst": {
"hash": "72efe542c7854926ac0f33287345b856"
},
"en:kernel/ipc/index.rst": {
"hash": "bbc40e0a41a1467dbdd42196c443f1ef"
},
"en:kernel/boot/index.rst": {
"hash": "8fe854f9c48d4e2e3fee0cf7f3526dfe"
},
"en:kernel/container/namespaces/pid_namespace.md": {
"hash": "7b78f405306356aec439bfd5bad69967"
},
"en:kernel/cpu_arch/x86_64/usb_legacy_support.md": {
"hash": "a0c3300d1641f613777d631578e0ea58"
},
"en:kernel/sched/kernel_timer.md": {
"hash": "95bf320a3e748c7bb41150940fee0e77"
},
"en:kernel/configuration/arch.md": {
"hash": "a024ea920cdb719454beaae1eb9e09e9"
},
"en:kernel/filesystem/sysfs.md": {
"hash": "68d5270491432d41b254c750d59aca89"
},
"en:kernel/core_api/softirq.md": {
"hash": "c931f3fcfca7d8d10cd16a8b68e6274a"
},
"en:community/ChangeLog/index.rst": {
"hash": "aa1979d81b79f64b12962f885a6820af"
},
"en:kernel/trace/index.rst": {
"hash": "944a5b865100258ec7957a4cbedd7251"
},
"en:kernel/configuration/config.md": {
"hash": "dff794c4f3bfb4c3d66e6d0fa8f7c495"
},
"en:kernel/sched/core.md": {
"hash": "f449acec9b9ad36c4a75e8594d38e44d"
},
"en:kernel/filesystem/overview.md": {
"hash": "44499f7673a0c68c53b12882258b9f5c"
},
"en:kernel/boot/bootloader.md": {
"hash": "e6f65060560663ca2ce4d56d750332d8"
},
"en:kernel/ipc/signal.md": {
"hash": "abe911dac525b44fe083752a1e6bbdc7"
},
"en:kernel/locking/mutex.md": {
"hash": "a82fa540acd44a93f5cb3c069d5584da"
},
"en:kernel/boot/cmdline.md": {
"hash": "3d17446c60b72e9cadf82002520ebbf9"
},
"en:community/code_contribution/index.rst": {
"hash": "38b6fe56ee739723a662cd1fec7a194a"
},
"en:community/contact/index.rst": {
"hash": "1fbd4c64558614101f195681b92a179e"
},
"en:kernel/locking/spinlock.md": {
"hash": "b97729ffa1d19fb131a85c72c2411146"
},
"en:kernel/trace/kprobe.md": {
"hash": "7e92cda81dfc19881d45e7cc0606f8c6"
},
"en:introduction/mirrors.md": {
"hash": "e5b572a5f5abca55e9ffcbc9827ce6f7"
},
"en:community/ChangeLog/V0.1.x/V0.1.8.md": {
"hash": "8c26796807713751958810efecaedebd"
},
"en:community/ChangeLog/V0.1.x/V0.1.7.md": {
"hash": "c74fe7a6db6d59d3d6d5116d4c4e0ceb"
},
"en:community/ChangeLog/V0.1.x/V0.1.9.md": {
"hash": "bf42117b62c4739a8101b33390b5a4c7"
},
"en:community/code_contribution/rust-coding-style.md": {
"hash": "db7eddfe4d16166ebe28def72f63fbb6"
},
"en:community/ChangeLog/V0.1.x/V0.1.1.md": {
"hash": "d94351167179beb0bb1b1f3bb82da2ff"
},
"en:userland/appdev/index.rst": {
"hash": "78e6747475981b5cc17cd206c135ca4f"
},
"en:userland/appdev/c-cpp-quick-start.md": {
"hash": "0101f8fa98a0536d43ff897145d4a43d"
},
"en:community/code_contribution/c-coding-style.md": {
"hash": "ea3c95cc032e4fa7cde32a56359ab328"
},
"en:community/code_contribution/conventional-commit.md": {
"hash": "31666b2ee98f5fe3698ae234b6ef0f00"
},
"en:userland/appdev/rust-quick-start.md": {
"hash": "6366c994d75086098469d8ea02555b88"
},
"en:kernel/debug/debug-kernel-with-gdb.md": {
"hash": "ab7904f52dcf35d0675e48fe8e88ec9a"
},
"en:community/ChangeLog/V0.1.x/V0.1.3.md": {
"hash": "c302428982363f627bedda89c1ab9232"
},
"en:introduction/index.rst": {
"hash": "a7c445abd29ce6817b098787f69902b7"
},
"en:kernel/sched/c_waiting.md": {
"hash": "bb2435e3905e8e71eca8f6a583e31d94"
},
"en:introduction/build_system.md": {
"hash": "fafac4210fb49c9e160b46c2101df238"
},
"en:community/ChangeLog/V0.1.x/V0.1.4.md": {
"hash": "5720af929320997f8824bcdfd3a17bdd"
},
"en:kernel/trace/eBPF.md": {
"hash": "62f8451a2e9e851a67266bf8cbb0fc6d"
},
"en:community/ChangeLog/V0.1.x/V0.1.6.md": {
"hash": "5517b35f61f5b89d8e825a399581ea0f"
},
"en:introduction/features.md": {
"hash": "75d47fcb0d83487b28957dace1e24578"
},
"en:community/ChangeLog/V0.1.x/V0.1.5.md": {
"hash": "898444d989993df55486ca8d454efbb6"
},
"en:community/ChangeLog/V0.1.x/V0.1.0.md": {
"hash": "26fef9a12925fdcc4729f363ae5b2614"
},
"en:community/ChangeLog/V0.1.x/V0.1.2.md": {
"hash": "41afa92fde268ffd547a3e4326fba1cd"
},
"en:community/ChangeLog/V0.1.x/V0.1.10.md": {
"hash": "7a292c40f822e371ea650f3157857844"
},
"en:kernel/core_api/kernel_api.md": {
"hash": "8b840ec6af5782d8f793f746b1061ed9"
},
"en:index.rst": {
"hash": "9bdd33a9fc7a2648cded2d463fe29115"
},
"en:questions/index.rst": {
"hash": "b1cee9bfde04d6375f24c93a29ce3c71"
},
"en:questions/build_errors.md": {
"hash": "76bf24821bab907c28e8c8287d2895d5"
}
}

View File

@ -1,7 +1,7 @@
.. _get_contact_with_community:
与社区建立联系
====================================
====================================================================
联系方式
-------------------------
@ -18,7 +18,7 @@ DragonOS官网 https://DragonOS.org
赞助及捐赠
-------------------------
---------------------------------------------------------
DragonOS是一个开源项目我们欢迎任何形式的赞助和捐赠您的捐赠将用于DragonOS的开发和维护以及社区的运营。
@ -28,6 +28,7 @@ DragonOS是一个开源项目我们欢迎任何形式的赞助和捐赠
- 联系社区负责人沟通具体的赞助方式等。联系方式longjin@dragonos.org
财务及捐赠信息公开
-------------------------
---------------------------------------------------------
DragonOS社区的捐赠信息将按年进行公开。赞助商、赞助者信息将在收到赞助后15天内进行公开。

View File

@ -17,7 +17,7 @@ import os
# -- Project information -----------------------------------------------------
project = 'DragonOS'
copyright = '2022-2024, DragonOS Community'
copyright = '2022-2025, DragonOS Community'
author = 'longjin'
github_org = 'DragonOS-Community'
github_repo = 'DragonOS'
@ -31,7 +31,12 @@ release = 'dev'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['myst_parser', 'sphinx_multiversion']
extensions = [
'myst_parser',
'sphinx_multiversion',
'sphinxcontrib.mermaid',
'sphinx.ext.extlinks',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -42,6 +47,7 @@ templates_path = ['_templates']
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'zh_CN'
locale_dirs = ['locale/'] # path is example but recommended.
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.

View File

@ -3,9 +3,22 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. Note: __EXCLUDE_IN_TRANSLATED_START
欢迎来到DragonOS的文档
====================================
.. raw:: html
<div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Translations</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="locales/en/index.html">English</a></li>
</ul>
</div>
.. Note: __EXCLUDE_IN_TRANSLATED_END
.. toctree::
:maxdepth: 1
:caption: 入门
@ -34,6 +47,7 @@
kernel/libs/index
kernel/net/index
kernel/trace/index
kernel/syscall/index
@ -45,9 +59,11 @@
.. toctree::
:maxdepth: 1
:caption: 系统调用api文档
:caption: Q&A
questions/index
syscall_api/index
.. toctree::
:maxdepth: 1
@ -57,6 +73,13 @@
community/contact/index
community/ChangeLog/index
.. Note: __EXCLUDE_IN_TRANSLATED_START
.. toctree::
:maxdepth: 1
:caption: Translations
locales/en/index
Indices and tables
==================
@ -64,3 +87,5 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. Note: __EXCLUDE_IN_TRANSLATED_END

View File

@ -240,6 +240,8 @@ make run-docker
- 本地编译,不运行: `make all -j 您的CPU核心数`
- 本地编译,并写入磁盘镜像,不运行: `make build`
- 本地编译写入磁盘镜像并在QEMU中运行: `make run`
- 本地编译,写入磁盘镜像,以无图形模式运行:
`make run-nographic`
- Docker编译并写入磁盘镜像,: `make docker`
- Docker编译写入磁盘镜像并在QEMU中运行: `make run-docker`
- 不编译,直接从已有的磁盘镜像启动: `make qemu`

View File

@ -572,86 +572,6 @@
&emsp;&emsp;第二个字符串
#### `printk(const char* fmt, ...)`
##### 描述
&emsp;&emsp;该宏能够在控制台上以黑底白字格式化输出字符串.
##### 参数
**fmt**
&emsp;&emsp;源格式字符串
**...**
&emsp;&emsp;可变参数
#### `printk_color(unsigned int FRcolor, unsigned int BKcolor, const char* fmt, ...)`
##### 描述
&emsp;&emsp;在控制台上以指定前景色和背景色格式化输出字符串.
##### 参数
**FRcolor**
&emsp;&emsp;前景色
**BKcolor**
&emsp;&emsp;背景色
**fmt**
&emsp;&emsp;源格式字符串
**...**
&emsp;&emsp;可变参数
#### `int vsprintf(char *buf, const char *fmt, va_list args)`
##### 描述
&emsp;&emsp;按照fmt格式化字符串并将结果输出到buf中返回写入buf的字符数量。
##### 参数
**buf**
&emsp;&emsp;输出缓冲区
**fmt**
&emsp;&emsp;源格式字符串
**args**
&emsp;&emsp;可变参数列表
#### `int sprintk(char *buf, const char *fmt, ...)`
##### 描述
&emsp;&emsp;按照fmt格式化字符串并将结果输出到buf中返回写入buf的字符数量。
##### 参数
**buf**
&emsp;&emsp;输出缓冲区
**fmt**
&emsp;&emsp;源格式字符串
**...**
&emsp;&emsp;可变参数
### 内存操作
#### `void *memcpy(void *dst, const void *src, uint64_t size)`

View File

@ -67,7 +67,7 @@ Syscall: │ sys_open, sys_read, sys_write, sys_close, │
- `sys_fchmod`:修改文件权限(未实现)
- 其他系统调用接口(未实现)
&emsp;&emsp;关于接口的具体含义,可以参考 [DragonOS系统调用接口](../../syscall_api/index.rst)
&emsp;&emsp;关于接口的具体含义,可以参考Linux的相关文档
## 虚拟文件系统VFS

View File

@ -1,10 +1,10 @@
.. _syscall_api:
.. _syscall:
系统调用API
系统调用
====================================
.. toctree::
:maxdepth: 1
:caption: 目录
intro
syscall_table

View File

@ -0,0 +1,120 @@
系统调用表实现方案
====================
.. note::
Author: longjin <longjin@dragonos.org>
Date: 2025/05/13
概述
----
.. mermaid::
:align: center
:caption: 系统调用表架构
classDiagram
class Syscall {
<<trait>>
+num_args() usize
+handle(args, from_user) Result<usize, SystemError>
+entry_format(args) Vec<FormattedSyscallParam>
}
class SyscallHandle {
+nr: usize
+inner_handle: &dyn Syscall
}
class SyscallTable {
-entries: [Option<&SyscallHandle>; 512]
+get(nr) Option<&dyn Syscall>
}
Syscall <|.. SysXXXXXXHandle
SyscallHandle "1" *-- "1" Syscall
SyscallTable "1" *-- "512" SyscallHandle
相比于将原本集中在一个大match中的系统调用分发本方案采用基于trait和系统调用表的实现。主要优势包括
- 降低栈内存使用:避免单个大函数占用过多栈空间
- 支持参数打印:通过统一的参数格式化接口
- 更好的扩展性:新增系统调用无需修改分发逻辑
核心设计
--------
Syscall Trait
~~~~~~~~~~~~~
所有系统调用处理函数都需要实现 `Syscall` trait
.. code-block:: rust
pub trait Syscall: Send + Sync + 'static {
fn num_args(&self) -> usize;
fn handle(&self, args: &[usize], from_user: bool) -> Result<usize, SystemError>;
fn entry_format(&self, args: &[usize]) -> Vec<FormattedSyscallParam>;
}
- `num_args()`: 返回该系统调用需要的参数数量
- `handle()`: 实际执行系统调用处理
- `entry_format()`: 格式化参数用于调试打印
SyscallHandle
~~~~~~~~~~~~~
`SyscallHandle` 结构体将系统调用号与处理函数关联:
.. code-block:: rust
pub struct SyscallHandle {
pub nr: usize, // 系统调用号
pub inner_handle: &'static dyn Syscall, // 处理函数
pub name: &'static str,
}
SyscallTable
~~~~~~~~~~~~
`SyscallTable` 管理所有系统调用:
- 固定大小512项
- 编译时初始化
- 通过系统调用号快速查找处理函数
使用方式
--------
实现系统调用
~~~~~~~~~~~~
1. 定义实现``Syscall`` trait的结构体
2. 实现``handle()````entry_format()``方法
3. 使用``declare_syscall!``宏注册
参考实现:`sys_write.rs <sys_write_>`_
.. _sys_write:
https://github.com/DragonOS-Community/DragonOS/blob/master/kernel/src/filesystem/vfs/syscall/sys_write.rs
注册系统调用
~~~~~~~~~~~~
使用``declare_syscall!``宏注册系统调用:
.. code-block:: rust
syscall_table_macros::declare_syscall!(SYS_WRITE, SysWriteHandle);
参数说明:
1. 系统调用名称(用于生成符号)
2. 实现``Syscall`` trait的结构体
初始化流程
----------
1. 内核启动时调用``syscall_table_init()``
2. 从链接器符号``_syscall_table``加载所有注册的系统调用
3. 填充系统调用表

View File

@ -18,7 +18,7 @@ eBPF 从根本上改变了这个方式。通过允许在操作系统中运行沙
## eBPF的运行流程
![image-20240909165945192](./ebpf_flow.png)
![image-20240909165945192](/kernel/trace/ebpf_flow.png)
如图所示eBPF程序的运行过程分为三个主要步骤

View File

@ -14,7 +14,7 @@ kprobes技术依赖硬件架构相关的支持主要包括CPU的异常处理
## kprobe工作流程
<img src="./kprobe_flow.png" style="zoom: 67%;" alt="xxx"/>
<img src="/kernel/trace/kprobe_flow.png" style="zoom: 67%;" alt="xxx"/>

View File

@ -0,0 +1,304 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.0.md
- Translation time: 2025-05-19 01:48:03
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.0
:::{note}
Author of this document: Longjin <longjin@RinGoTek.cn>
November 6, 2022
:::
## Preface
&emsp;&emsp;DragonOS has been under development since January 15, 2022, and has now gone through nearly 300 days. In these many days and nights, it's hard to count how much time has been spent on DragonOS development. I have basically given all my free time to DragonOS, and the estimated total working hours have already exceeded 1000 hours. It feels very rewarding to be able to release the first version.
&emsp;&emsp;Since July 2022, a number of friends and mentors from six universities or companies have joined the development of DragonOS. I was very happy about this. I think, with everyone's joint efforts, we can create an operating system that is truly practical! We have held 14 discussion meetings. I believe, with everyone's joint efforts, in the future, we will be able to create an independent, open, server-oriented open-source operating system that can be used in production environments.
&emsp;&emsp;Although DragonOS is currently just a toy-level operating system, it's "only slightly more difficult than a undergraduate graduation project." However, please don't underestimate it. Its internal architecture design targets Linux 5.18 and later distributions. Although it has not yet reached the level of Linux, we are working hard to catch up. Thanks to the relevant resources of Linux, DragonOS has learned a lot of design ideas from Linux during its architecture design. The related components have considered scalability and portability as much as possible.
&emsp;&emsp;A journey of a thousand miles begins with a single step. The release of DragonOS V0.1.0 is a new beginning. **I hope, in the next ten years, we can work together with many partners, and by 2032, build DragonOS into a practical, widely used open-source operating system in the server field!**
&emsp;&emsp;**A hundred boats race, the ones who row first win; in the middle stream, the brave win.** I believe, with the continuous efforts of the community developers in the coming time, our goal will become a reality!
## Special Thanks
&emsp;&emsp;At the time of the release of DragonOS V0.1.0, I would like to express my sincere gratitude to my teachers, predecessors, and school!
- **Teacher Yao Zhicheng from Dali Town Central Primary School, Nanhai District, Foshan City**: You are the guide who introduced me to computers and taught me programming. Ten years ago, when we talked, you said, "Our country currently does not have an independent and mature operating system." This sentence planted the seed of my dream. You cultivated my love for computers, so I chose the major of software engineering. Thank you for your guidance back then, I will never forget your kindness!
- **Shimen Experimental School, Nanhai District, Foshan City**: During the three years I studied at Shimen Experimental School, I am very grateful for the school's "Strength-based Education" philosophy. Under the guidance of the teachers, I was able to fully develop my personality and talents, and achieved good results. During the three years at Shimen Experimental School, I learned C++, Java, and simple algorithms, and I developed several Android apps, accumulating nearly 6,000 lines of code.
- **Shimen Middle School, Nanhai District, Foshan City**: "The road is long and the task is heavy, never forget to strive" is the school motto of Shimen Middle School. I think this motto should also become the motto of each new generation of youth. During the three years at Shimen Middle School, the education of national sentiment had a great impact on me. I think, as new generation of youth, we should shoulder the responsibility of the times, strive hard, and work for the development of the country, the strength of the nation, and the future of humanity!
- **South China University of Technology**: "Broad learning, careful thinking, clear discernment, and firm action" at SCUT, I received further learning and development. I broadened my horizons, learned to communicate with many people. Moreover, in the School of Software, I met a group of conscientious and responsible teachers. I am very grateful for the support of the school, which supported us in establishing the project group. I believe, with the support of the school, DragonOS can achieve better development and go further!
- **Professor Wang Guohua from the School of Software, South China University of Technology**: Professor Wang is my teacher for the course "Operating System". Under her guidance, I gained a deeper understanding of the principles of operating systems, and participated in the "Pan-Delta+ University Students' Computer Works Competition". In the Guangdong provincial selection in June 2022, DragonOS won the first prize and the Best Innovation Award.
- **Professor Tang Feng from the School of Software, South China University of Technology**: Professor Tang is our project group's on-campus mentor. Under her careful guidance, we will continue to move forward, keep our direction, and continuously build an open-source community. I sincerely thank Professor Tang for her guidance!
- **[Yaotian Feng](https://github.com/Codetector1374)**: I met this very capable person on Bilibili. He answered many of my questions. Many times, after I had debugged for several days without any idea, a few words from him would wake me up and help me find the path to solve the problem. He also shared with me the places where I might fall into traps, allowing me to have a psychological expectation when about to fall into a trap, so I wouldn't feel so uncomfortable, ha ha.
## Contributors List
The release of DragonOS V0.1.0 could not have been achieved without the joint efforts of the following friends:
- Longjin <longjin@RinGoTek.cn>
- zzy666-hw <zzy666@mail.ustc.edu.cn>
- Guan Jinquan <guanjinquan@DragonOS.org>
- Zhou Yuzhe <zhouyuzhe@DragonOS.org>
- kkkkkong <kongweichao@DragonOS.org>
- houmkh <jiaying.hou@qq.com>
- wang904 <1234366@qq.com>
- Liric Mechan <i@liric.cn>
- Mustang <handsomepd@qq.com>
- Eugene <caima12138@foxmail.com>
- kun <1582068144@qq.com>
- zhujikuan <1335289286@qq.com>
- Alloc Alice <1548742234@qq.com>
## Sponsors List
Thank you to the following students for their donations. We will keep working hard!
- TerryLeeSCUT
- Wu
- slientbard
## Kernel
### Some Standards and Specifications Followed
- Bootloader: Multiboot2
- System Interface: POSIX 2008
### Hardware Architecture
- Currently supports running on x86-64 architecture processors
### Bootloader
- Uses Grub 2.06 as the bootloader
### Memory Management
- Implemented a bitmap-based page allocator
- Implemented a slab allocator for allocating small, aligned memory blocks
- Abstracted VMA (Virtual Memory Area)
- Implemented VMA reverse mapping mechanism
- Implemented MMIO address space auto-mapping mechanism
### Multi-core
- Supports multi-core boot. That is, after DragonOS starts, it will start the AP processor. However, to simplify the implementation of other kernel modules, currently, there are no tasks running on the AP processor.
- Roughly implemented the IPI (Inter-Processor Interrupt) framework
### Process Management
- Supports process creation and recycling
- Kernel threads
- Kthread mechanism
- User-space and kernel-space process/thread fork/vfork (note that user-space fork and kernel-space fork have some differences; kernel-space fork is more complex)
- exec allows a process to execute a new executable file
- Process timer sleep (sleep) (supports high-precision sleep with spin/rdtsc, supports sleep via context switching)
### Synchronization Primitives
- spinlock spin lock
- mutex mutex
- atomic atomic variable
- wait_queue wait queue
- semaphore semaphore
### Scheduling Related
- CFS scheduler
- Single-core scheduling (multi-core load balancing is temporarily not supported)
- completion "completion" mechanism, allowing a process to wait for a task to complete
### IPC (Inter-Process Communication)
- Anonymous pipe
### File System
- Basic functionality of the VFS virtual file system
- FAT32 file system (does not support deleting folders)
- devfs device file system. Currently, only the keyboard file is registered.
- rootfs root file system, provides support for other pseudo-file systems before the real disk file system is mounted
- Mount point abstraction. Currently, file system mounting is implemented, and all mount points are managed in a stack-like manner (optimization is needed in the future)
### Exception and Interrupt Handling
- Handling of processor exceptions
- Support for APIC
- Softirq soft interrupt mechanism
- Ability to trace the kernel stack
### Kernel Data Structures
- Ordinary binary tree
- kfifo first-in-first-out buffer
- Circular linked list
- IDR mapping data structure
- IDA ID allocation data component
### Screen Display
- VESA VBE display chip driver
- Implemented a screen manager, supporting multiple display frameworks to be registered with the screen manager
- Implemented a TextUI text interface framework, capable of rendering text to the screen. Also reserves support for scrollable pages and multiple display windows
- printk
### Kernel Utility Library
- String operation library
- ELF executable file support component
- Basic math library
- CRC function library
### Software Portability
- Ported the LZ4 compression library (V1.9.3), laying the foundation for future page compression mechanisms
### Kernel Testing
- ktest unit test framework
- Supports outputting screen content to a file via serial port (COM1)
### Driver Support
- IDE hard disk
- AHCI hard disk (SATA Native)
- ACPI Advanced Power Configuration module
- PCI bus driver
- XHCI host controller driver (USB 3.0)
- PS/2 keyboard
- PS/2 mouse
- HPET high-precision timer
- RTC clock
- Local APIC timer
- UART serial port (supports RS-232)
- VBE display
- Virtual tty device
### System Calls
DragonOS currently has a total of 22 valid system calls.
- SYS_PUT_STRING Print characters to the screen
- SYS_OPEN Open a file
- SYS_CLOSE Close a file
- SYS_READ Read from a file
- SYS_WRITE Write to a file
- SYS_LSEEK Adjust the file pointer
- SYS_FORK Fork system call
- SYS_VFORK Vfork system call
- SYS_BRK Adjust the heap size to a specified value
- SYS_SBRK Adjust the heap size by a relative value
- SYS_REBOOT Reboot (this system call will be removed after sysfs is improved; please do not rely on this system call excessively)
- SYS_CHDIR Change the working directory of the process
- SYS_GET_DENTS Get metadata of directory entries
- SYS_EXECVE Let the current process execute a new program file
- SYS_WAIT4 Wait for a process to exit
- SYS_EXIT Exit the current process
- SYS_MKDIR Create a directory
- SYS_NANOSLEEP Nanosecond-level sleep (up to 1 second), capable of high-precision sleep when less than 500ns
- SYS_CLOCK Get the current CPU time
- SYS_PIPE Create a pipe
- SYS_MSTAT Get the current memory status information of the system
- SYS_UNLINK_AT Delete a directory or delete a file link
### Rust Support
- Implemented a simple "hello world" in Rust. Plan to gradually shift to using Rust for development in the next version.
## User Environment
### LibC
&emsp;&emsp;LibC is the bridge between applications and the operating system. DragonOS's LibC implements some simple functions.
- malloc heap memory allocator
- Basic math library
- A few simple functions related to files
- pipe
- fork/vfork
- clock
- sleep
- printf
### Shell Command Line Programs
- Based on simple string matching parsing (not done through the compilation course's method, so it's simple and crude)
- Supported commands: ls, cd, mkdir, exec, about, rmdir, rm, cat, touch, reboot
### User-space Driver Programs
- User-space keyboard driver
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code in the following ways:
### Get via Git
- You can visit [https://github.com/fslongjin/DragonOS/releases](https://github.com/fslongjin/DragonOS/releases) to download the release code and the compiled, runnable disk image.
- We also have a mirror repository on gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To solve the problem of slow and unstable access to GitHub in China, and to make it convenient for developers to download the code of each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the DragonOS code archive and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
## Open Source Code Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source protocol. Everyone who can obtain the DragonOS source code and related software products (including but not limited to binary copies and documents) will enjoy the rights granted by us through the GPLv2 protocol, and you must also comply with the obligations stipulated in the protocol.
This is a rather strict protocol that protects the healthy development of open source software and prevents it from being encroached upon.
For most people with good intentions, you will not violate our open source protocol.
We encourage the free spread and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others, nor do they violate the GPLv2 protocol.
Please pay special attention to the fact that those who violate the open source protocol, especially **commercial closed-source use and any plagiarism or academic misconduct**, will be held seriously accountable. (This is the easiest scenario to violate our open source protocol.)
Also, please note that according to the requirements of the GPLv2 protocol, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 protocol and must indicate that it is based on DragonOS. It must also ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must make sure that the DragonOS developers can obtain the source code of your modified version through the same way from public channels, otherwise you will violate the GPLv2 protocol.
For detailed information about the protocol, please read the **LICENSE** file in the root directory of the project. Please note that according to the requirements of the GPLv2 protocol, **only the English original version has legal effect**. Any translated version is for reference only.
:::
### Usage of Open Source Software
&emsp;&emsp;During the development of DragonOS, some open source projects' designs were referenced, or parts of their code were introduced, or they were inspired by them. Below are the list of these open source projects. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - 《A Design and Implementation of a 64-bit Operating System》Tian Yu; People's Posts and Telecommunications Press
- chcore - 《Modern Operating Systems: Design and Implementation》Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT

View File

@ -0,0 +1,358 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.1.md
- Translation time: 2025-05-19 01:41:56
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.1
:::{note}
Author: Longjin <longjin@RinGoTek.cn>
November 27, 2022
:::
## Contributors List
The DragonOS V0.1.1 version was contributed by the following team members:
- Longjin <longjin@RinGoTek.cn>
- Zhou Yuzhe <zhouyuzhe@DragonOS.org>
## Sponsors List
Thank you to the following individuals for their support. We will continue to strive for excellence!
- David Wen
- TerryLeeSCUT
- Wu
- slientbard
Among them, we are especially grateful to **David Wen** for his sponsorship of RMB 1000 to the DragonOS project! We will carefully record each donation and ensure that it is used appropriately.
## Update Content - Kernel
- Added Rust FFI (#_translated_label__77_en)
- Ported kmalloc and printk to Rust
- Rust macros for kdebug, kinfo, kwarn, kBUG, kerror
- Bugfix: Fixed the issue where the process PCB was not removed from the list when it was reclaimed
- Directory structure optimization: Moved asm.h and cmpxchg.h
- Signal sending
- procfs: View process status
- Resolved the issue of disk image permission errors during the first compilation
- Moved fork-related code to fork.c
## Update Content - User Environment
- Shell: Added the kill command, which can send signals to a target process. However, since the signal mechanism is still not fully implemented, the target process cannot currently respond to this signal.
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can download the release code and the compiled, runnable disk image from [https://github.com/fslongjin/DragonOS/releases](https://github.com/fslongjin/DragonOS/releases).
- We also have a mirror repository on Gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To address the slow and unstable access to GitHub in China, and to make it easier for developers to download the code for each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the compressed package of DragonOS code and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the DragonOS source code and corresponding software products (including but not limited to binary copies and documentation) will enjoy the rights granted by us through the GPLv2 license, and you must also comply with the obligations stipulated in the agreement.
This is a rather strict license that protects the healthy development of open source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others or violate the GPLv2 license.
Please pay special attention to the fact that violations of the open source license, especially **commercial closed-source use and any plagiarism or academic misconduct**, will be subject to serious accountability. (This is the most common scenario where the open source license is violated.)
Also, please note that according to the requirements of the GPLv2 license, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 license and must clearly indicate that it is based on DragonOS. It is also necessary to ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must make it possible for the developers of DragonOS to obtain the source code of your modified version through public channels, otherwise you will violate the GPLv2 license.
For detailed information about the agreement, please read the **LICENSE** file in the project root directory. Please note that according to the requirements of the GPLv2 license, **only the English original version is legally binding**. Any translated version is for reference only.
:::
### Open Source Software Usage
&emsp;&emsp;During the development of DragonOS, we have referenced the design of some open source projects, or introduced parts of their code, or been inspired by them. Below is a list of these open source projects. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - 《A Design and Implementation of a 64-bit Operating System》 by Tian Yu; People's Posts and Telecommunications Press
- chcore - 《Modern Operating Systems: Design and Implementation》 by Chen Haibo and Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
## All Commit Records of the Current Version
```text
commit d65ade9c5909076747bd00966a398fe27fbd290d
Author: DaJiYuQia <88259094+DaJiYuQia@users.noreply.github.com>
Date: Sun Nov 27 14:21:31 2022 +0800
Patch procf (#95)
* debug color problem
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 6cb769c423b09e88fea1763210200a716477be0a
Author: login <longjin@ringotek.cn>
Date: Sun Nov 27 14:17:36 2022 +0800
将include目录下的rust代码转移到他们应当属于的模块中 (#96)
* 将include目录下的rust代码转移到他们应当属于的模块下。
commit 27a97abd2474b03ad09b562e5ed11e1fdae8eb32
Author: DaJiYuQia <88259094+DaJiYuQia@users.noreply.github.com>
Date: Sat Nov 26 17:34:00 2022 +0800
Patch procf (#90)
* 1234
* 123
* 合并master
* procfs
* 1
* procfs展示进程基本信息
* modified code
* 恢复权限
* 恢复权限
#恢复权限
* modify permission
* 删除run.sh
* 解决第一次编译时磁盘镜像权限错误的问题
* 恢复.vscode/c_cpp_properties.json
* 删除process.c中错误的do_fork
* remake procfs
* 修改一些变量名
* 修改类型
* modified
* data_puts缓冲区溢出后return
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit ad23fcddf893d7f92d2bf3efdb66e969416d2852
Author: login <longjin@ringotek.cn>
Date: Wed Nov 23 21:34:35 2022 +0800
bugfix: 修复进程退出时未释放signal和sighand && 增加赞赏者名单David Wen (#93)
* bugfix: 修复进程退出时未释放signal和sighand的bug
* 增加赞赏者名单David Wen
commit 0274cd6eeec01885232e7418a501857cb76da69e
Author: login <longjin@ringotek.cn>
Date: Wed Nov 23 20:43:18 2022 +0800
修正drop signal结构体的box对象的的问题 (#92)
* fix: exit signal and exit sighand
commit c8025a88798dc57ecc5d7f20ad69de695445638f
Author: login <longjin@ringotek.cn>
Date: Wed Nov 23 20:18:22 2022 +0800
new:在fork时拷贝signal和sighand (#91)
* refcount初始化
* new: 实现copy_sighand
del: 删除sighand_struct的wqh, 待将来有需要时替换成rust版本的
* new: 拷贝signal
bugfix: 解决拷贝sighand时的uaf问题
commit 66f67c6a95b8aad85cfd2146a86e5e3e6a3568e7
Author: login <longjin@ringotek.cn>
Date: Wed Nov 23 11:38:20 2022 +0800
signal的发送暂时父子进程之间共享信号及相应的结构体 (#89)
* 解决由于spinlock.h中包含preempt_enable()带来的循环include问题
* new: 初步实现signal的数据结构
* new:signal相关数据结构
* fix: 解决bindings.rs报一堆警告的问题
* new: rust下的kdebug kinfo kwarn kBUG kerror宏
* 移动asm.h和cmpxchg.h
* new: signal的发送暂时只支持父子进程共享信号及处理函数
commit 3d729e2069e01ee07525ff83167566dac5322a40
Author: login <longjin@ringotek.cn>
Date: Fri Nov 18 17:59:33 2022 +0800
bugfix: 修复进程pcb被回收时未将其从链表中删除的问题 (#87)
* bugfix: 修复进程pcb被回收时未将其从链表中删除的问题
new: pcb相关api文档
* 将文档加入目录
commit 0bfe94f46be9bdde1ade81a20e803aa2aafd2964
Author: login <longjin@ringotek.cn>
Date: Fri Nov 18 16:32:15 2022 +0800
new: rust下的kdebug kinfo kwarn kBUG kerror宏 (#86)
* new: rust下的kdebug kinfo kwarn kBUG kerror宏
commit c6174797dcf3427f38bfa0f4bd3e039c319f7c5b
Author: login <longjin@ringotek.cn>
Date: Thu Nov 17 20:29:29 2022 +0800
fix: 解决bindings.rs报了很多警告的问题 (#85)
* fix: 解决bindings.rs报一堆警告的问题
commit cffd7144fbed84f9775e89d7b99602c6ccc5a510
Author: login <longjin@ringotek.cn>
Date: Wed Nov 16 15:18:03 2022 +0800
signal相关数据结构&代码结构优化 (#84)
* 解决由于spinlock.h中包含preempt_enable()带来的循环include问题
* new: 初步实现signal的数据结构
commit fb6c29d01d4cf92368efec08c01e419c2a941f7d
Author: login <longjin@ringotek.cn>
Date: Sun Nov 13 16:43:58 2022 +0800
port kmalloc and printk to rust (#83)
* 暂时移除cbindgen
* 将lib文件夹更名为libs文件夹解决rust的冲突
* 实现了全局的allocator
* 实现了printk宏
* new: 完善了printk的颜色
commit 82d2e446a401e7eee57a847f48a6d162931170c3
Author: login <longjin@ringotek.cn>
Date: Sat Nov 12 15:25:54 2022 +0800
new: 暂时移除cbindgen (#82)
commit 2aaf7808efe44ecfaadd51ae4f8892e667108578
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 22:21:44 2022 +0800
在内核中引入cbindgen生成rust-C的FFI (#81)
* 解决codeql失败问题
* new: 为内核引入cbindgen
commit 2813126e3190c9b3c1a836a647b259a7adbe0cf3
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 15:35:37 2022 +0800
新增rust ffi (#77)
* 引入cargo
* 取消对Cargo.lock的跟踪
* 解决vscode报错问题
* new: rust的代码能够调用c语言的printk_color
* 1、将原本run.sh的工作拆解变为几个不同的make命令
2、在docker镜像中编译rust
* 更改workflow
* update workflow
* new: 解决workflow无法通过编译的问题
commit 5e023cf7911333eb05bfe65704dce4b01fa4d0a7
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 15:21:45 2022 +0800
Update makefile.yml
commit e44795008f7e34d2068cf28dcedbcb91f5ccd66b
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 15:18:13 2022 +0800
Update makefile.yml (#80)
commit ec5fb84b61c313824cc2199ab64e3af4b7e5f895
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 15:08:09 2022 +0800
Update makefile.yml
commit 6d9dff5f1ff347ea780a0249e54eef356cdcaaea
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 15:07:48 2022 +0800
Revert "Update makefile.yml (#78)" (#79)
This reverts commit badc7d238f2341e844a90be3e357e5dd77a447fc.
commit badc7d238f2341e844a90be3e357e5dd77a447fc
Author: login <longjin@ringotek.cn>
Date: Fri Nov 11 15:05:52 2022 +0800
Update makefile.yml (#78)
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,333 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.2.md
- Translation time: 2025-05-19 01:42:16
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.2
:::{note}
Author: Long Jin <longjin@RinGoTek.cn>
December 17, 2022
:::
## Contributors
The DragonOS V0.1.2 version has been contributed by the following developers:
- Long Jin <longjin@ringotek.cn>
- Wu Yujian <wuyujian@DragonOS.org>
- Gou Ngai <sujintao@DragonOS.org>
- Huang Ting <huangting@DragonOS.org>
- Wang Wencong <1297389017@qq.com>
## Sponsors
Thank you to the following individuals for their support. We will continue to strive hard!
- David Wen
- [Seele.Clover](https://github.com/seeleclover)
- TerryLeeSCUT
- Wu
- slientbard
Among them, we are especially grateful to **Seele.Clover** for contributing RMB 500 to the DragonOS project! We will carefully record every sponsorship and ensure that it is used appropriately.
## Update Content - Kernel
- Remove rust_helloworld file (#_translated_label__113_en)
- Signal: Allow users to register signal handler functions, enabling custom handlers. (#_translated_label__112_en)
- Support for the kill command
- Allow users to customize signal handling functions
- Add two new system calls: `SYS_SIGACTION`, `SYS_RT_SIGRETURN`
- libc adds `signal()`, `sigaction()` functions.
- Currently only supports the old version of sighandler, i.e., signal handler functions with only one parameter of type `void handler(int signum)`. The other type of signal handler function `void handler(int signum, siginfo_t *info, void* data)` does not currently support passing the third parameter.
- Add a custom stdint.h file in the kernel code (#_translated_label__109_en)
- Adjust the script for compiling grub (#_translated_label__108_en)
- Add 32-bit and 64-bit UEFI boot support (#_translated_label__105_en)(#_translated_label__101_en)
- Use compiled installed grub-2.06 to solve the problem of compilation failure due to incorrect grub version on the client.
- Add a timekeeping module (#_translated_label__106_en)
- Bugfix: Fix the issue where the rtc clock forgot to process the day field when converting to BCD code (#_translated_label__104_en)
- New: Development process documentation (completed half)
- bootstrap.sh solves the problem of slow rust download
- Update the "Build System" documentation
- procfs->status adds display of preempt and virtual runtime (#_translated_label__100_en)
- ffz function: get the first bit that is 0 in a u64 (#_translated_label__100_en)
- Solve the problem of local_irq_restore not being able to get the correct rflags value due to compiler optimization
- Refactor the serial port driver using Rust (#_translated_label__99_en)
## Update Content - User Environment
- about app: Display the current git commit sha1 and build time (#_translated_label__114_en)
- shell: Fix the error in the shell's exec command when concatenating absolute paths (#_translated_label__114_en)
- shell: Add "&" background execution option for the exec command (#_translated_label__100_en)
- New: Test app for signal
- Adjust the libc directory and add cargo as the Rust package manager
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can download the release code and the compiled, runnable disk image from [https://github.com/fslongjin/DragonOS/releases](https://github.com/fslongjin/DragonOS/releases).
- We also have a mirror repository on gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To solve the problem of slow and unstable access to GitHub in China, and to make it convenient for developers to download the code of each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the DragonOS source code package and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the DragonOS source code and corresponding software products (including but not limited to binary copies and documents) can enjoy the rights granted by us through the GPLv2 protocol, while you also need to comply with the obligations stipulated in the protocol.
This is a rather strict protocol that protects the healthy development of open source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open source protocol.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others or violate the GPLv2 protocol.
Please pay special attention to the fact that violations of the open source protocol, especially **commercial closed-source use and any plagiarism or academic misconduct**, will be subject to serious accountability. (This is the easiest scenario to violate our open source protocol.)
Also, please note that according to the requirements of the GPLv2 protocol, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 protocol and clearly indicate that it is based on DragonOS. It must also ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must make sure that the developers of DragonOS can obtain the source code of your modified version through public channels in the same way, otherwise you will violate the GPLv2 protocol.
For detailed information about the protocol, please read the **LICENSE** file in the root directory of the project. Please note that according to the requirements of the GPLv2 protocol, **only the English original version is legally binding**. Any translated version is for reference only.
:::
### Open Source Software Usage
&emsp;&emsp;During the development of DragonOS, we have referenced some open source projects' designs, or introduced parts of their code, or been inspired by them. We list them below. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - 《A Design and Implementation of a 64-bit Operating System》 by Tian Yu; People's Posts and Telecommunications Press
- chcore - 《Modern Operating Systems: Design and Implementation》 by Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
## All Commit Records of the Current Version
```text
commit 7a818da88a1c7a1760de7671141b0ce1ca4e3dde
Author: login <longjin@ringotek.cn>
Date: Sat Dec 17 17:49:12 2022 +0800
Patch about auto gen version string (#114)
* new: about app中显示当前构建的git commit sha1以及构建时间
* bugfix: 修复shell的exec命令对绝对路径的拼接错误问题
commit 83a7aaa46bbc411c43d4fc099c6c8884efbe4771
Author: login <longjin@ringotek.cn>
Date: Sat Dec 17 16:31:50 2022 +0800
删除rust_helloworld文件 (#113)
commit 6efd4740336205c9bfdd8b164e667cee2f38781e
Author: login <longjin@ringotek.cn>
Date: Sat Dec 17 16:27:50 2022 +0800
允许用户自定义信号处理函数 (#112)
* new: 用户注册信号处理函数能够进入自定义的handler
* 修复忘了传信号的数字给用户的处理函数的bug
* new:sigreturn
* 删除注释
commit 0e0c187484281768391e131495f0655e40d70cf7
Author: login <longjin@ringotek.cn>
Date: Fri Dec 16 16:20:09 2022 +0800
在内核代码中加入自定义的stdint.h文件 (#109)
commit d02e6ea4112ad520aa4090ff73cdf592e14c0a82
Author: login <longjin@ringotek.cn>
Date: Wed Dec 14 20:01:55 2022 +0800
调整编译grub的脚本的部分 (#108)
1、bugfix: 修复编译grub的脚本的部分错误
2、将grub下载源替换为tuna
3、优化写入磁盘镜像的脚本
4、将bios文件夹改名为legacy
commit 38b341b8aa671f75ac26d05059aa2e9a09e653b7
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Wed Dec 14 16:58:49 2022 +0800
新增32位uefi启动 (#105)
* 新增32位uefi启动
* 修复小bug
* 增加grub本地编译安装
* 增加本地grub编译安装脚本
* 修正小错误
* 修复空文件夹不上传的bug
commit 01876902fbf6ed43992cc7d153bd8c505cb5224b
Author: Gou Ngai <94795048+AlbertSanoe@users.noreply.github.com>
Date: Wed Dec 14 15:13:54 2022 +0800
增加了timekeeping模块 (#106)
* 增加了timekeeping模块
* 格式化文档和细节更改
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 728aca308917a7d4d0ba10fe8174e9408d77a9a6
Author: login <longjin@ringotek.cn>
Date: Sun Dec 11 22:59:47 2022 +0800
bugfix: 修复rtc时钟对BCD码进行转换的时候忘了处理day字段的问题 (#104)
commit 237e95c6ddce72d72ae7fedfeca412fab82b3622
Author: wwc-15172310230 <78997674+wwc-15172310230@users.noreply.github.com>
Date: Sun Dec 11 22:22:10 2022 +0800
调整user下libs的libc目录结构 (#103)
* 调整user下libs的libc目录结构
* 修正.gitignore文件的问题
* 修复无法编译的问题
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 2291ffdece1dc5a703602f79f74df8a4854d215b
Author: login <longjin@ringotek.cn>
Date: Sun Dec 11 20:09:58 2022 +0800
文档更新 (#102)
* new: 开发过程文档(完成了一半)
* bootstrap.sh解决下载rust慢的问题
* 更新“构建系统”文档
commit 7f439c5ddbd2ecffc112149d16983975f523052c
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Fri Dec 9 16:08:54 2022 +0800
增加uefi启动 (#101)
* 增加uefi启动
* 修改脚本
* uefi修改
* 删除错误的注释
* 修正写入磁盘镜像的脚本
* 修改X86_64为x86_64
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 1a2eaa402f05f82aaeebe1e03824534a0a425d4d
Author: login <longjin@ringotek.cn>
Date: Thu Dec 8 22:59:51 2022 +0800
signal的处理(kill命令)以及一些其他的改进 (#100)
* 将entry.S中冗余的ret_from_syscall代码删除改为jmp Restore_all
* new: 增加判断pt_regs是否来自用户态的函数
* new: rust的cli和sti封装
* 将原有的判断pt_regs是否来自用户态的代码统一改为调用user_mode函数
* ffz函数获取u64中的第一个值为0的bit
* spinlock增加 spinlock irq spin_unlock_irq
* 临时解决显示刷新线程迟迟不运行的问题
* 更改ffi_convert的生命周期标签
* new: 测试signal用的app
* 解决由于编译器优化导致local_irq_restore无法获取到正确的rflags的值的问题
* new: exec命令增加"&"后台运行选项
* procfs->status增加显示preempt和虚拟运行时间
* 更改引用计数的FFIBind2Rust trait中的生命周期标签
* new: signal处理(kill)
* 更正在review中发现的一些细节问题
commit f8b55f6d3fcbf152a1cb6d6fc722bf1607418b28
Author: TingHuang <92705854+TingSHub@users.noreply.github.com>
Date: Tue Dec 6 22:15:03 2022 +0800
Patch uart (#99)
* 添加UART驱动相关文件
* 添加驱动核心文件将rust编写的驱动代码加入Package中
* 添加glib.h文件生成rust代码添加uart驱动代码
* 添加串口发送及接收相关代码
* 添加字符串发送函数,未实现具体功能
* 为调用uart驱动的代码添加rust接口
* 添加字符串发送函数修改C语言调用接口
* 添加rust串口驱动
* 添加uart.h头文件将串口端口类型改为enum
* 添加注释,规范代码
commit 036acc52ce9d0fb9e7d92768ff74939a29c07f32
Author: login <longjin@ringotek.cn>
Date: Tue Nov 29 21:46:13 2022 +0800
将entry.S中冗余的ret_from_syscall代码删除改为jmp Restore_all (#98)
* 将entry.S中冗余的ret_from_syscall代码删除改为jmp Restore_all
```

View File

@ -0,0 +1,504 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.3.md
- Translation time: 2025-05-19 01:41:49
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.3
:::{note}
Author: Longjin <longjin@RinGoTek.cn>
January 8, 2023
:::
## Contributors
The DragonOS V0.1.3 version was contributed by the following individuals:
- Longjin <longjin@RinGoTek.cn>
- Wu Yujian <wuyujian@DragonOS.org>
- Guan Jinquan <guanjinquan@DragonOS.org>
- Gou Ngai <sujintao@DragonOS.org>
## Sponsors
Thank you to the following individuals for their support. We will continue to strive for excellence!
- David Wen
- [Seele.Clover](https://github.com/seeleclover)
- TerryLeeSCUT
- Wu
- slientbard
## Update Content - Kernel
- syscall: new: Add getpid system call (#_translated_label__120_en)
- signal: update: Add all signals except SIGKILL to SigQueue (#_translated_label__120_en)
- rtc: refactor: Refactor RTC driver using Rust (#_translated_label__118_en)
- doc: new: Add documentation for signal (#_translated_label__126_en)
- Spinlock: new: Add Rust-written RawSpinlock (#_translated_label__127_en)
- arch: update: Change the path of the arch module in lib.rs, so that other modules can use the code in arch without specifying arch::x86_64 (#_translated_label__128_en)
- mm: bugfix: Fix the bug where ZONE_NORMAL_INDEX was always 0 during initialization of the page allocator (#_translated_label__129_en)
- scheduler: new: Refactor CFS scheduler using Rust (#_translated_label__131_en)
- smp: Remove the HPET interrupt forwarding function that has been deprecated in smp (#_translated_label__131_en)
- process: bugfix: Fix the issue where the init process forgot to set the fs and gs registers. (#_translated_label__132_en)
- vfs: update: Rename the VFS folder to vfs (#_translated_label__133_en)
- lockref: new: Add Rust version of lockref (#_translated_label__135_en)
- cpu: new: Rust wrapper for cpu_relax(), using the pause instruction to let the CPU rest for a while, reducing idle power consumption. (#_translated_label__135_en)
- Refactor softirq mechanism using Rust (#_translated_label__138_en)
## Update Content - User Environment
- libc: bugfix: Always register sigkill when registering signal handlers (#_translated_label__120_en)
- libc: new: Add raise, kill, abort (#_translated_label__120_en)
- libc: new: Add an arch folder, and add crt0, crti, crtn files under it (#_translated_label__134_en)
- libc: new: Add `fflush()`, `fprintf()`, `stdin`, `stdout`, `stderr`, `ferror()`, `fopen()`, `fclose()`, `putchar()`, `puts()` (#_translated_label__136_en)
- libc: new: Simply add `fopen()` for handling the mode parameter. Please note that it does not fully comply with POSIX, and is inconsistent with Linux. It will be improved when using Rust in the future. (#_translated_label__141_en)
- Porting: new: Add porting and build scripts for gmp, mpfr, and mpc (#_translated_label__136_en)
- Porting: new: Add cross-compilation build scripts for gcc and binutils, as well as patches for gcc-11.3.0 and binutils-2.38 (in the DragonOS-community repository) (#_translated_label__136_en)
- compile: update: Update the include path for the compiler, so that includes do not need the `<libc/src/include/>` prefix (#_translated_label__124_en)
## Update Content - Others
- bugfix: Fix the bug where Docker installation would exit abnormally (#_translated_label__116_en)
- new: Add a new GCC bare-metal compiler targeting x86_64-elf, and use it to compile DragonOS (#_translated_label__111_en)
- update: Update the Docker build image to version `dragonos/dragonos-dev:v1.2`, and support building this build image from a Dockerfile (#_translated_label__111_en)
- bugfix: Fix the bug where the MBR disk image did not set the boot flag (#_translated_label__111_en)
- update: Update the GitHub workflow, add cache, and speed up build checks
- bugfix: Fix the error message when downloading grub2.06 (#_translated_label__125_en)
## Update Content - Software Porting
- new: gcc 11.3.0 userland cross-compiler, commit: `64a5b1cbf28e3305560e166c1b6624e99745c720`, repository: [https://github.com/DragonOS-Community/gcc](https://github.com/DragonOS-Community/gcc)
- new: binutils 2.38 cross-compile tools, commit: `a0ae560e0065862a9867b9e1f8364749ef38d99e`, repository: [https://github.com/DragonOS-Community/binutils](https://github.com/DragonOS-Community/binutils)
- new: gmp 6.2.1, commit: `dd9eee5778fb6027fafa4fe850aff21b1a71c18e`, repository: [https://github.com/DragonOS-Community/gmp-6.2.1](https://github.com/DragonOS-Community/gmp-6.2.1)
- new: mpfr 4.1.1, commit: `fa8e30cdc2e838fdd82b60fec31fcfc5e118aad6`, repository: [https://github.com/DragonOS-Community/mpfr](https://github.com/DragonOS-Community/mpfr)
- new: mpc 1.2.1, (can be ported without applying patches), repository: [https://github.com/DragonOS-Community/mpc](https://github.com/DragonOS-Community/mpc)
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can download the release code and the compiled, runnable disk image from [https://github.com/fslongjin/DragonOS/releases](https://github.com/fslongjin/DragonOS/releases).
- We also have a mirror repository on Gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To address the slow and unstable access to GitHub in China, and to make it convenient for developers to download the code of each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the DragonOS source code archive and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
- Domestic mirror acceleration: [https://mirrors.ringotek.cn/](https://mirrors.ringotek.cn/)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the DragonOS source code and corresponding software products (including but not limited to binary copies and documentation) can enjoy the rights granted by us through the GPLv2 protocol, while you also need to comply with the obligations stipulated in the protocol.
This is a rather strict protocol that protects the healthy development of open source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others or violate the GPLv2 protocol.
Please pay special attention to the fact that violations of the open source license, especially **commercial closed-source usage and any acts of plagiarism or academic misconduct**, will be subject to serious accountability. (This is the easiest scenario to violate our open source license.)
Also, please note that according to the requirements of the GPLv2 protocol, software modified or developed based on DragonOS must also be open-sourced under the GPLv2 protocol and must indicate that it is based on DragonOS. It must also ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must allow the DragonOS developers to obtain the source code of your modified version through the same method from public channels; otherwise, you will violate the GPLv2 protocol.
For detailed information about the protocol, please read the **LICENSE** file in the root directory of the project. Please note that, according to the requirements of the GPLv2 protocol, **only the English original version has legal effect**. Any translated version is for reference only.
:::
### Usage of Open Source Software
&emsp;&emsp;During the development of DragonOS, we have referenced the design of some open source projects, or introduced parts of their code, or been inspired by them. Below is a list of these open source projects. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - "A Design and Implementation of a 64-bit Operating System" by Tian Yu; People's Posts and Telecommunications Press
- chcore - "Modern Operating Systems: Design and Implementation" by Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
- rcore-fs - https://github.com/rcore-os/rcore-fs.git - MIT
## All Commit Records of the Current Version
```text
commit a8b621c8d1fe77251b8e4eafe258dc0ee7366dd5
Author: login <longjin@ringotek.cn>
Date: Sun Jan 8 15:47:44 2023 +0800
修正由于libc中具有crti.S和crtn.S造成的与x86_64-elf-gcc不兼容的问题 (#144)
commit 9358ff0f6f7daa18d6fab4497de025736b3d6725
Author: login <longjin@ringotek.cn>
Date: Sun Jan 8 15:06:52 2023 +0800
Add v0.1.3 changelog (#143)
* new: 0.1.3发行日志
* 新增输出指定时间范围内的贡献者名单的脚本
* 更新bootloader文档
* update: 简介文档
* new: 镜像站文档
* update: 功能特性文档
commit fd91905f022b3ceaa59e666d1ff42d91fb8d40ef
Author: login <longjin@ringotek.cn>
Date: Sun Jan 8 11:38:59 2023 +0800
解决编译gcc、binutils的脚本中变量名称错误的问题 (#142)
commit 62e4613978193aaf5d949a331df0398f2d085a30
Author: Gou Ngai <94795048+AlbertSanoe@users.noreply.github.com>
Date: Sat Jan 7 23:15:37 2023 +0800
使用rust重构softirq机制解决Rtc驱动的编译警告问题 (#138)
* 使用rust重构softirq机制
* 解决Rtc驱动的编译警告问题
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit e9fdc57bf878f1bc5cc5743dfaeeaef743439291
Author: login <longjin@ringotek.cn>
Date: Sat Jan 7 22:36:49 2023 +0800
简单添加了fopen对mode参数的处理。请注意它没有完全遵循posix也与Linux的不一致将来使用Rust的时候完善它。 (#141)
commit 2224c93ea968bc74621f7e124b4aca04875b3e6a
Author: guanjinquan <1666320330@qq.com>
Date: Fri Jan 6 21:29:23 2023 +0800
完善libc构建了OS-specific工具链编译了基于gcc-11.3.0的DragonOS userland compiler移植了mpfr,gmp,mpc库 (#134)
* 修改include路径
* 添加了创建libsysapi.a和/bin/sysroot/usr/include/+lib/的代码
* 修补.gitignore
* 删除多余项
* 优化脚本可读性
* 新增crt0 crti crtn
* 编译binutils所需的东西
* fflush()和fprintf()的简单实现
* 应用程序启动前调用初始化libc的函数
* 自动创建sysroot
* 添加了stderr的初始化
* 修改了stderr的初始化
* 内核添加对stdio的简略处理
* 格式化代码
* 修正打开stdio文件描述符的问题
* bugfix: 修复fprintf忘记释放buf的问题
* 修复shell错误地把入口设置为main而不是_start的问题
* 新增__cxa_atexit (gcc要求libc提供这个
* 增加putchar puts
* 更新写入磁盘镜像的脚本默认无参数时使用legacy方式安装
* 更新编译脚本
* stdio增加eof的定义
* 新增extern cplusplus
* mpfr gmp mpc 构建脚本
* 更新libsysapi.a为libc.a
* 加上ferror fopen fclose
* 更新移植的软件的构建脚本
* 更改build_gcc_toolchain.sh中的-save参数名为-save-cache
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 61de2cdc3f29cdc6c441f128119e01e003e6f3ca
Author: login <longjin@ringotek.cn>
Date: Tue Jan 3 23:09:25 2023 +0800
新增rust版本的lockref (#135)
* new:Rust封装cpu_relax(),通过pause指令让cpu休息一会儿。降低空转功耗
* new: Rust版本的lockref
* Rust的RawSpinlock新增is_locked()和set_value()方法。
* lockref文档
commit 2726f101b4cc787bbd36a69afffb0112f3a6567f
Author: login <longjin@ringotek.cn>
Date: Tue Jan 3 21:01:56 2023 +0800
删除无用的cfs.h (#136)
commit 587086d3f299f7394559d547c828191be20cfc11
Author: login <longjin@ringotek.cn>
Date: Sun Jan 1 16:53:57 2023 +0800
1、在文件系统目录下增加mod.rs 2、将VFS的路径改为vfs(#133)
2、将VFS的路径改为vfs
commit 843e442971a47693f37a5f8d3452c383f7325359
Author: login <longjin@ringotek.cn>
Date: Sat Dec 31 18:43:05 2022 +0800
修复init进程忘记设定fs gs寄存器的问题。 (#132)
commit 74bde36e014ff501241bf40dd83653db47a2c8e4
Author: guanjinquan <1666320330@qq.com>
Date: Sat Dec 31 17:35:39 2022 +0800
Patch porting gcc v2 (#124)
* 更改编译器的Include路径使得include时不需要加`<libc/src/include/>`前缀
* 修改include路径
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit d4f3de93a23e4bd4f000a3663768d47d094bf188
Author: login <longjin@ringotek.cn>
Date: Sat Dec 31 17:26:12 2022 +0800
使用Rust重构CFS调度器 (#131)
* 新建调度器的文件
* 把softirq vector移动到c文件中原来在.h)
* 将进程切换方式改为“中断返回时切换”
* new:使用rust重构CFS
* 删除已经在smp中废弃的HPET中断转发函数
* 代码格式化
* 删除多余的dunce依赖
commit 156949680c83f2d7e3b21ed68b11698b88eaf396
Author: login <longjin@ringotek.cn>
Date: Sat Dec 31 13:47:49 2022 +0800
bugfix:修复当使用sched()运行调度器,在切换进程的时候,由于不在中断上下文内,导致当前进程的上下文丢失的问题。 (#130)
bugfix:修复当使用sched()运行调度器,在切换进程的时候,由于不在中断上下文内,导致当前进程的上下文丢失的问题。
bugfix:修复切换进程的宏的汇编代码的损坏部分未声明rax寄存器从而导致的编译器未定义行为问题。
commit 882f0b7e7498dbff8de527b2b9159b7f6e6359c9
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Wed Dec 28 19:35:17 2022 +0800
修复内存bug与grub安装脚本的错误 (#129)
* 修复内存bug与grub安装脚本的错误
* 修改小bug
commit adc1846b06fb862caed049f435fc0061488a6ff9
Author: login <longjin@ringotek.cn>
Date: Mon Dec 26 13:13:12 2022 +0800
内核在lib.rs中将arch模块的路径进行更改使得其他模块使用arch的代码时不需要指定arch::x86_64 (#128)
commit ac643d420b22f9d454ecefccd51ed34a9664586b
Author: login <longjin@ringotek.cn>
Date: Sun Dec 25 23:53:35 2022 +0800
new:新增rust写的RawSpinlock (#127)
commit 998390210549b47e6bdcc3fdab49eff4086ad18b
Author: login <longjin@ringotek.cn>
Date: Sat Dec 24 23:30:26 2022 +0800
新增signal文档 (#126)
* 新增signal文档
commit a7f5ca7b67160557abf84a1169dd60093220aeb0
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Sat Dec 24 23:29:36 2022 +0800
修复下载grub2.06时的提示错误 (#125)
* 修复grub下载显示提示显示错误
commit 82762007da41148e1ed1df465211eb5c8ba2c15e
Author: login <longjin@ringotek.cn>
Date: Fri Dec 23 18:11:47 2022 +0800
Update makefile.yml
commit b975025ec8854ca232152f4ee44cc2226891a34c
Author: login <longjin@ringotek.cn>
Date: Fri Dec 23 11:45:19 2022 +0800
Update makefile.yml
commit ad2bb74d949bfcb2935e43ac7b261d7ecce23389
Author: login <longjin@ringotek.cn>
Date: Fri Dec 23 11:21:22 2022 +0800
Update makefile.yml
commit 6b7776d189ab5f19fbab20d6c5c9ed3ab20c7ab6
Author: login <longjin@ringotek.cn>
Date: Fri Dec 23 10:59:15 2022 +0800
修正smp的makefile中没有替换AS的问题
commit beb12a188b6c6bc4196796ac2ae1ecd7d8ed8223
Author: login <longjin@ringotek.cn>
Date: Fri Dec 23 10:57:39 2022 +0800
Update makefile.yml
commit d65c527730e5c8a75f6dad0f996c093040699ee3
Author: login <longjin@ringotek.cn>
Date: Thu Dec 22 22:58:28 2022 +0800
Update makefile.yml (#121)
commit 5ed4cd460200cb19aae8c3c67dfd77e1e9f0e105
Author: guanjinquan <75822481+guanjinquan@users.noreply.github.com>
Date: Thu Dec 22 21:09:12 2022 +0800
Patch gcc toolchain (#111)
* 添加了GCC_cross_compile——tool_chain
* - 解决环境变量路径拼接时,多了`/`的问题
- apt安装时增加-y,不需用户确认
* 解决添加环境变量的命令有误的问题
* 修正编译错误时,还会执行下一步的问题
* new: 编译完成后清理临时文件
* 更新makefile
* 调整把grub安装在 $HOME/opt/dragonos-grub下
* new: 新增dockerfile
* 将镜像源换成中科大的原因是清华的总是ban掉用于构建镜像的服务器的ip
* 修改为基于debian bullseye构建
* 取消指定版本
* 修复MBR磁盘镜像未设置启动标志的bug
* 取消在docker中安装grub
* 安装grub的过程改到客户机上进行
* bootstrap.sh 添加--no-docker
* 使用新版的docker编译镜像
* 修补, 添加了一些关于gcc的check
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit ba0d93d8b26034abc54bcaf3f0ff04863bbd076e
Author: Gou Ngai <94795048+AlbertSanoe@users.noreply.github.com>
Date: Mon Dec 19 15:04:37 2022 +0800
refactor rtc module in rust (#118)
* 用rust重构rtc模块
* refactor the rtc module by rust
* rtc-updated
* rtc-updated-4
* rtc
commit c588d6f77f4b38939701b946228218ea81a7c8dc
Author: login <longjin@ringotek.cn>
Date: Mon Dec 19 15:03:44 2022 +0800
Patch add abort func (#120)
* 对于除了sigkill以外的信号也加入队列
* bugfix:libc中注册信号处理函数时总是注册sigkill的问题
* 增加getpid系统调用
* 增加了raise、kill、abort
commit 47f0d12a1f1a1aa11be8e751ecdbf76f0cb596d9
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Mon Dec 19 14:53:51 2022 +0800
修复docker安装时异常退出的bug (#119)
* 修复docker安装时异常退出的bug
* 修复grub编译脚本的小bug
commit 978043e47d1143ca2d5cf22b20793f032e8eb5a5
Author: login <longjin@ringotek.cn>
Date: Sun Dec 18 15:09:15 2022 +0800
修复当系统中不存在dosfstools时无法正确格式化磁盘镜像的问题 (#117)
* 修复当系统中不存在dosfstools时无法正确格式化磁盘镜像的问题
commit f9127772dc372a2e607388fdd6818d3f9c4c6d28
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Sat Dec 17 23:43:23 2022 +0800
修复docker安装时异常退出的bug (#116)
```

View File

@ -0,0 +1,279 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.4.md
- Translation time: 2025-05-19 01:42:41
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.4
:::{note}
Author: Longjin <longjin@RinGoTek.cn>
February 4, 2023
:::
## Contributors List
The DragonOS V0.1.4 version was contributed by the following developers:
- Longjin <longjin@RinGoTek.cn>
- Gou Ngai <sujintao@DragonOS.org>
- Kong Weichao <kongweichao@DragonOS.org>
- Hou Jiaying <houjiaying@DragonOS.org>
## Sponsors List
Thank you to the following individuals for their support. We will continue to strive for excellence!
- David Wen (2000 RMB)
- [Seele.Clover](https://github.com/seeleclover) (500 RMB)
- Ye Jinyi (100 RMB)
- Lin (50 RMB)
- Albert (9.99 RMB)
- TerryLeeSCUT (6.66 RMB)
- slientbard (6.66 RMB)
- Wu (2.00 RMB)
- [Other anonymous contributors] (1.00 RMB)
## Update Content - Kernel
- Spinlock: new: Added SpinLock with guards, supporting compile-time checking of lock usage. (#_translated_label__148_en)
- Spinlock: feature: Added lock_irqsave and unlock_irqrestore for raw spin lock (#_translated_label__151_en)
- Mutex: new: Rust version of Mutex (#_translated_label__157_en)
- doc: new: Rust code style document (#_translated_label__161_en)
- WaitQueue: new: Rust version of WaitQueue (#_translated_label__162_en)
- WaitQueue: update: For the C version of wait_queue, changed to immediate wake-up (#_translated_label__158_en)
- block io: new: Block IO scheduler. When there are multiple cores, the IO scheduler runs on core 1. (#_translated_label__158_en)
- smp: bugfix: Start apic_timer for AP cores, making them able to run scheduling (#_translated_label__158_en)
- smp: new: Added kick_cpu function, supporting making a specific core run the scheduler immediately (#_translated_label__158_en)
- smp: new: Added process migration functionality between cores (#_translated_label__158_en)
- scheduler: new: Added real-time process scheduler (supporting FIFO and RR strategies) (#_translated_label__139_en)
- scheduler: update: CFS scheduler sets a separate IDLE process pcb (pid is 0) for each core (#_translated_label__158_en)
- scheduler: bugfix: When process_wakeup, reset the virtual runtime for CFS processes. Solves the problem of other processes starving due to small virtual runtime of sleeping processes. (#_translated_label__158_en)
- process: new: Added migrate_to field in pcb (#_translated_label__158_en)
## Update Content - User Environment
None
## Update Content - Others
None
## Update Content - Software Porting
None
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can visit [https://github.com/fslongjin/DragonOS/releases](https://github.com/fslongjin/DragonOS/releases) to download the release code, as well as the compiled and runnable disk image.
- We also have a mirror repository on gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To solve the problem of slow and unstable access to GitHub in China, and to make it convenient for developers to download the code of each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can get the DragonOS code package and the compiled and runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
- Domestic mirror acceleration: [https://mirrors.ringotek.cn/](https://mirrors.ringotek.cn/)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the DragonOS source code and corresponding software products (including but not limited to binary copies and documents) will enjoy the rights granted by us through the GPLv2 license, and you must also comply with the obligations stipulated in the agreement.
This is a rather strict license that protects the healthy development of open source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others and do not violate the GPLv2 license.
Please pay special attention to the fact that violations of the open source license, especially **commercial closed-source use and any acts of plagiarism or academic misconduct**, will be subject to serious accountability. (This is the easiest scenario to violate our open source license.)
Also, please note that according to the requirements of the GPLv2 license, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 license and must clearly indicate that it is based on DragonOS. It must also ensure that users of these modified versions can conveniently obtain the original version of DragonOS.
You must make it possible for the DragonOS developers to obtain the source code of your modified version through public channels in the same way, otherwise you will violate the GPLv2 license.
For detailed information about the license, please read the **LICENSE** file in the root directory of the project. Please note that according to the GPLv2 license, **only the English original version is legally binding**. Any translated version is for reference only.
:::
### Open Source Software Usage
&emsp;&emsp;During the development of DragonOS, we have referenced the design of some open source projects, or introduced parts of their code, or been inspired by them. Below is a list of these open source projects. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - "A Design and Implementation of a 64-bit Operating System" by Tian Yu; People's Posts and Telecommunications Press
- chcore - "Modern Operating Systems: Design and Implementation" by Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
- rcore-fs - https://github.com/rcore-os/rcore-fs.git - MIT
## All Commit Records of the Current Version
```text
commit f6ba114bb0420e848ef7fc844c96c0d7a0552d93
Author: houmkh <100781004+houmkh@users.noreply.github.com>
Date: Sat Feb 4 12:31:15 2023 +0800
Block IO Scheduler (#158)
* Block io调度器
* process_wakeup时对cfs的进程重设虚拟运行时间。解决由于休眠的进程其虚拟运行时间过小导致其他进程饥饿的问题
* 1、为AP核启动apic_timer,使其能够运行调度
2、增加kick_cpu功能支持让某个特定核心立即运行调度器
3、wait_queue的唤醒改为立即唤醒。
4、增加进程在核心间迁移的功能
5、CFS调度器为每个核心设置单独的IDLE进程pcbpid均为0
6、pcb中增加migrate_to字段
7、当具有多核时io调度器在核心1上运行。
* io调度器文件位置修改
* 修改io的makefile
* 更新makefile中的变量名
* 修改io调度器函数名
---------
Co-authored-by: login <longjin@ringotek.cn>
commit 151251b50b7ed55596edd32ffec49a4041010e2a
Author: login <longjin@ringotek.cn>
Date: Tue Jan 31 19:27:02 2023 +0800
Patch add rust waitqueue (#162)
* new: rust版本的waitqueue
* new:等待队列的文档
commit 3c369b1430e8d571bcc74a8ef7fefc1c4cae5dd2
Author: login <longjin@ringotek.cn>
Date: Mon Jan 30 15:43:42 2023 +0800
new:新增rust代码风格 (#161)
commit c28bd540ac856cd9d8d5597852af8f2588a660e4
Author: login <longjin@ringotek.cn>
Date: Mon Jan 30 15:10:24 2023 +0800
更新赞助者名单 (#160)
* 更新赞赏者列表
commit 935f40ec174fec217aed4553d45996327443bc0e
Author: login <longjin@ringotek.cn>
Date: Tue Jan 17 21:30:16 2023 +0800
new: Rust版本的Mutex (#157)
commit d8a064128a8a06b90ff4c7b87c193518d9572641
Author: Gou Ngai <94795048+AlbertSanoe@users.noreply.github.com>
Date: Mon Jan 16 19:58:50 2023 +0800
Raw spin lock 增加lock_irqsave、unlock_irqrestore(#151)
Raw spin lock 增加lock_irqsave、unlock_irqrestore
commit 06b09f34ed64a006a80ae8df383e3c8b176f02e0
Author: kong <45937622+kkkkkong@users.noreply.github.com>
Date: Sat Jan 14 22:38:05 2023 +0800
Patch sched rust (#139)
* update
* 添加rt调度器的rust初步实现
* 完善rt调度逻辑
* 调试rt调度器
* 修改sched的返回值
* cargo fmt 格式化
* 删除无用代码修补rt bug
* 删除无用的代码,和重复的逻辑
* 软中断bugfix
* 删除一些代码
* 添加kthread_run_rt文档
* 解决sphinix警告_static目录不存在的问题
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit ec53d23ed03347854189d92b7e175f309779321b
Author: login <longjin@ringotek.cn>
Date: Sat Jan 14 10:35:49 2023 +0800
new: 新增具有守卫的自旋锁SpinLock支持编译期对锁的使用进行检查。 (#148)
commit 41474ba3df99b6822ce452dc94dc53a4da62cba1
Author: login <longjin@ringotek.cn>
Date: Tue Jan 10 22:07:41 2023 +0800
更新Readme中关于DragonOS的介绍部分 (#146)
commit 8ad2e358fd3b05eed2919de50640682e51687fb5
Author: login <longjin@ringotek.cn>
Date: Sun Jan 8 15:51:59 2023 +0800
更新about app中的版本号 (#145)
* 更新about app中的版本号
commit a8b621c8d1fe77251b8e4eafe258dc0ee7366dd5
Author: login <longjin@ringotek.cn>
Date: Sun Jan 8 15:47:44 2023 +0800
修正由于libc中具有crti.S和crtn.S造成的与x86_64-elf-gcc不兼容的问题 (#144)
commit 9358ff0f6f7daa18d6fab4497de025736b3d6725
Author: login <longjin@ringotek.cn>
Date: Sun Jan 8 15:06:52 2023 +0800
Add v0.1.3 changelog (#143)
* new: 0.1.3发行日志
* 新增输出指定时间范围内的贡献者名单的脚本
* 更新bootloader文档
* update: 简介文档
* new: 镜像站文档
* update: 功能特性文档
```

View File

@ -0,0 +1,321 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.5.md
- Translation time: 2025-05-19 01:44:14
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.5
:::{note}
Author: Longjin <longjin@RinGoTek.cn>
March 13, 2023
:::
## Contributors List
The DragonOS V0.1.5 version is contributed by the following developers:
- Longjin <longjin@DragonOS.org>
- Guan Jinquan <guanjinquan@DragonOS.org>
- Su Jintao <sujintao@DragonOS.org>
- Kong Weichao <kongweichao@DragonOS.org>
- Hou Jiaying <houjiaying@DragonOS.org>
- Wu Yujian <wuyujian@DragonOS.org>
- Zhou Yuzhe <zhouyuzhe@DragonOS.org>
- Satin Wuker <74630829+SatinWuker@users.noreply.github.com>
## Sponsors List
Thank you to the following contributors for their support. We will keep working hard!
- Wan Xiaolan
- David Wen
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- Ye Jinyi
- Lin
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- Wu
## Update Content - Kernel
- scheduler: doc: Real-time process scheduler documentation (#_translated_label__163_en)
- scheduler: rt: RTQueue now uses a doubly linked list for storage (#_translated_label__174_en)
- scheduler: load balance: Multi-core load balancing (#_translated_label__193_en)
- Semaphore: new: Added a Rust implementation of the semaphore (#_translated_label__183_en)
- mm: refactor: Refactored the MMIO address allocator (#_translated_label__184_en)
- RwLock: new: Added a Rust implementation of the read-write lock (#_translated_label__186_en)
- driver: update: Improved PCI functionality (#_translated_label__194_en)
- driver: new: VirtIO network card driver (still has issues) (#_translated_label__194_en)
- driver: refactor: Rust version of the AHCI driver (#_translated_label__198_en)
- block io: delete: Removed the Block IO scheduler. (#_translated_label__196_en)
- filesystem: refactor: New version of VFS (#_translated_label__198_en)
- filesystem: refactor: New version of ProcFS (#_translated_label__198_en)
- filesystem: refactor: New version of DevS (#_translated_label__198_en)
- filesystem: new: RamFS memory file system (#_translated_label__198_en)
- filesystem: new: FAT12/FAT16/FAT32 file system (#_translated_label__198_en)
- filesystem: new: New device and block device abstraction (#_translated_label__198_en)
## Update Content - User Environment
- libc: Adjusted, all apps are now directly linked to libc.a, instead of going through the "search.o" process (#_translated_label__171_en)
## Update Content - Others
- bootstrap: Fixed the issue with Ubuntu2210 not being able to compile GRUB correctly, and properly install QEMU (#_translated_label__176_en)
- toolchain: Added a Rust bare bone toolchain (#_translated_label__197_en)
## Update Content - Software Porting
None
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can download the release code and the compiled, runnable disk image by visiting [https://github.com/DragonOS-Community/DragonOS/releases](https://github.com/DragonOS-Community/DragonOS/releases).
- We also have a mirror repository on Gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To address the slow and unstable access to GitHub in China, and to make it easier for developers to download the code for each version of DragonOS, we have specifically set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the DragonOS source code archive and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
- Domestic mirror acceleration: [https://mirrors.ringotek.cn/](https://mirrors.ringotek.cn/)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the DragonOS source code and related software products (including but not limited to binary copies and documentation) is entitled to the rights granted by us through the GPLv2 license, and you must also comply with the obligations stipulated in the agreement.
This is a rather strict license that protects the healthy development of open-source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open-source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others or violate the GPLv2 license.
Please pay special attention to the fact that violations of the open-source license, especially **commercial closed-source usage and any acts of plagiarism or academic misconduct**, will be subject to serious accountability. (This is the most common scenario where the open-source license is violated.)
Also, please note that according to the requirements of the GPLv2 license, any software that is modified or developed based on DragonOS must also be open-sourced under the GPLv2 license and must clearly indicate that it is based on DragonOS. It is also necessary to ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must make it possible for the DragonOS developers to obtain the source code of your modified version through public channels, otherwise you will violate the GPLv2 license.
For detailed information about the license, please read the **LICENSE** file in the root directory of the project. Please note that according to the requirements of the GPLv2 license, **only the English original version has legal effect**. Any translated versions are for reference only.
:::
### Usage of Open Source Software
&emsp;&emsp;During the development of DragonOS, some open-source projects were referenced, or parts of their code were introduced, or they inspired us. Below is a list of these open-source projects. We sincerely thank the contributors of these open-source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - 《A Design and Implementation of a 64-bit Operating System》 by Tian Yu; People's Posts and Telecommunications Press
- chcore - 《Modern Operating Systems: Design and Implementation》 by Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
- rcore-fs - https://github.com/rcore-os/rcore-fs.git - MIT
- redox - https://gitlab.redox-os.org/redox-os/redox - MIT
## All Commit Records of the Current Version
```text
commit 84407d360511c7699938a0f245ae33ff76f16b17
Author: login <longjin@DragonOS.org>
Date: Mon Mar 13 00:26:04 2023 +0800
bugfix解决touch命令失败的问题 (#199)
* bug fix : 解决touch命令失败的问题
commit 004e86ff19727df303c23b42c7a271b9214c6898
Author: login <longjin@DragonOS.org>
Date: Sun Mar 12 22:36:11 2023 +0800
新版文件系统重构完成 (#198)
1.重构VFS
2. 重构ProcFS
3. 重构DevFS
4. 重构FAT32
5. 重构AHCI驱动
6. 新增RamFS
7. 新增MountFS
8. 新增FAT12
9. 新增FAT16
10. 重构:设备抽象
Co-authored-by: guanjinquan <1666320330@qq.com>
Co-authored-by: DaJiYuQia <88259094+DaJiYuQia@users.noreply.github.com>
commit 17041e0e307eaf9e8d8ddbddfa186cd1f10f1bc0
Author: login <longjin@DragonOS.org>
Date: Sun Mar 12 21:04:37 2023 +0800
添加rust的bare bone工具链 (#197)
commit 26d84a31393c50063ff416bc509316e8d342028c
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Sat Mar 11 21:09:50 2023 +0800
新增VirtIO网卡驱动 (#194)
* 修复内存bug与grub安装脚本的错误
* 修改小bug
* PCI增加功能与virtio-net驱动
* little fix
* virtio-net小修改
commit 1d48996375149279a721777b2c600e1b5c3ee1b5
Author: kong <45937622+kkkkkong@users.noreply.github.com>
Date: Sat Mar 11 18:17:35 2023 +0800
多核负载均衡(#193)
* feat(sched)CPU负载检测初步实现
* fix(smp):调整smp中的apic的头文件声明
* fix(smp):简单的负载均衡算法实现
* fix(sched):抽离负载均衡方法
* fix(sched):修改rt中的运行队列bug调整负载均衡逻辑
* fix(process):移除无用测试代码
* reformat code
commit ef9f9732b09f78d7192f1d0dd3b41be655fb0914
Author: houmkh <100781004+houmkh@users.noreply.github.com>
Date: Thu Mar 9 23:31:25 2023 +0800
修复了mmio buddy的bug (#189)
* 修改buddy_query
commit c1396d277115b371d09ad6d39a1c419f9224ffd0
Author: Gou Ngai <sujintao@dragonos.org>
Date: Mon Mar 6 11:28:32 2023 +0800
Rwlock文档 (#186)
* Rwlock文档
commit a7eb62a47a8d701b90a14f83cc9028cfed07c268
Author: houmkh <100781004+houmkh@users.noreply.github.com>
Date: Mon Mar 6 11:21:29 2023 +0800
修改mmiobuddy代码结构和函数名 (#184)
* 修改mmio-buddy结构和函数名
commit c2481452f81750ec02adec627ab2edbc93d9cd9c
Author: houmkh <100781004+houmkh@users.noreply.github.com>
Date: Sat Mar 4 18:36:55 2023 +0800
rust重构mmio_buddy和mmio (#178)
* rust重构mmio_buddy和mmio
* mmio-buddy文档
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit f1284c35717a2f9f8cee7cecfc835ba1d23a1161
Author: Gou Ngai <sujintao@dragonos.org>
Date: Sat Mar 4 17:47:17 2023 +0800
新增了rust实现的信号量 (#181)
* 新增了rust实现的信号量
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 83b9512c1c1e8289000084adcafddebee6a23f16
Author: Gou Ngai <sujintao@dragonos.org>
Date: Sat Mar 4 16:54:42 2023 +0800
新增了rust实现的信号量 (#183)
* 新增了rust实现的信号量
commit e532a536a0b244f4590e6eb7910084bd63049704
Author: login <longjin@ringotek.cn>
Date: Thu Mar 2 22:50:07 2023 +0800
添加赞助者FengWangHao (#179)
commit b66beefd4e9ead61ee55f335246ebeb8277d3011
Author: login <longjin@ringotek.cn>
Date: Mon Feb 27 01:00:35 2023 +0800
解决ubuntu2210版本无法正确编译grub以及正确安装qemu的问题 (#176)
commit 4177d0327c3eacdc606f0b22f99f208fd48cfff3
Author: kong <45937622+kkkkkong@users.noreply.github.com>
Date: Mon Feb 20 17:03:37 2023 +0800
RTQueue改用双向链表存储(#174)
* RTQueue改用双向链表存储
commit 2bf5ee0e3cac3a91dee6a13b71c86a9477c07d9b
Author: login <longjin@ringotek.cn>
Date: Sat Feb 11 13:04:24 2023 +0800
修改libc的编译相关内容(#171)
1.将libc的include文件夹分为export和internal
2.将所有app都直接链接libc.a,而不是都执行一遍"搜索.o"的过程
commit 90b077f9d3ecd48ca46f8bbb32363620db6ddbe6
Author: kong <45937622+kkkkkong@users.noreply.github.com>
Date: Thu Feb 9 15:24:37 2023 +0800
Sched rt doc (#163)
* update
* 完善调度器文档
* 更新RT调度器文档
* 更新实时调度文档
commit 009f92d50fe2e52e425bce397801d3fa204daecd
Author: Satin Wuker <74630829+SatinWuker@users.noreply.github.com>
Date: Tue Feb 7 19:29:09 2023 -0800
fix typos 改正README_EN的错别字和语法错误 (#167)
```

View File

@ -0,0 +1,319 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.6.md
- Translation time: 2025-05-19 01:44:51
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.6
:::{note}
Author: Longjin <longjin@DragonOS.org>
April 2, 2023
:::
## Contributors List
The DragonOS V0.1.6 version was contributed by the following developers:
- Longjin <longjin@DragonOS.org>
- Guan Jinquan <guanjinquan@DragonOS.org>
- Su Jintao <sujintao@DragonOS.org>
- Hou Jiaying <houjiaying@DragonOS.org>
- Wu Yujian <wuyujian@DragonOS.org>
- Mork <91721145+MorkCarpenter@users.noreply.github.com>
- WaferJay <17383312+WaferJay@users.noreply.github.com>
- HoshuChiu <129569557+HoshuChiu@users.noreply.github.com>
## Sponsors List
Thank you to the following individuals for their support. We will continue to strive for excellence!
- Wan Xiaolan
- David Wen
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- Ye Jinyi
- Lin
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- Wu
- Anonymous Kind-hearted Person
## Update Content - Kernel
- softirq: Refactored softirq (#_translated_label__223_en)
- timer: Refactored system timer (#_translated_label__223_en)
- stdio: Added tty device for standard input and output (#_translated_label__202_en) (#_translated_label__217_en)
- lib: First set of keyboard scan code state machine (#_translated_label__216_en) (#_translated_label__219_en)
- syscall: Added dup and dup2 system calls (#_translated_label__224_en)
- syscall: Added SystemError enum type to make error handling clearer (#_translated_label__205_en)
- driver: Added support for x87 floating-point processor (#_translated_label__212_en)
- driver: VirtIO network card can now send and receive data normally (#_translated_label__204_en)
- filesystem: Fixed FAT32 judgment logic, resolving the issue where the system could not boot normally when the file system was FAT12/16. (#_translated_label__211_en)
- filesystem: Added VFS document and modified document configuration (#_translated_label__209_en)
- textui: Fixed the issue where the process scheduler did not run when "processes output characters continuously" due to textui locking and changes in preempt_count. (#_translated_label__203_en)
- scheduler: Solved the issue of double locking in cpu_queue caused by not disabling interrupts during sched_enqueue outside of interrupt context. (#_translated_label__201_en)
## Update Content - User Environment
### New Repositories
- Added a sub-project: [dsc](https://github.com/DragonOS-Community/dsc.git)
- Transplanted relic: [DragonOS-relibc](https://github.com/DragonOS-Community/relibc.git)
## Update Content - Others
- build: Added an option for using VNC as the image output for QEMU (#_translated_label__222_en)
## Update Content - Software Porting
None
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can download the release code and the compiled, runnable disk image from [https://github.com/DragonOS-Community/DragonOS/releases](https://github.com/DragonOS-Community/DragonOS/releases).
- We also have a mirror repository on gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To address the slow and unstable access to GitHub in China, and to make it convenient for developers to download the code for each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the DragonOS source code archive and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
- Domestic mirror acceleration: [https://mirrors.ringotek.cn/](https://mirrors.ringotek.cn/)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the DragonOS source code and corresponding software products (including but not limited to binary copies and documentation) can enjoy the rights granted by us through the GPLv2 protocol, while you also need to comply with the obligations stipulated in the protocol.
This is a rather strict protocol that protects the healthy development of open source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others or violate the GPLv2 protocol.
Please pay special attention to the fact that violations of the open source license, especially **commercial closed-source usage and any acts of plagiarism or academic misconduct**, will be subject to serious accountability. (This is the most common scenario of violating our open source license.)
Also, please note that according to the requirements of the GPLv2 protocol, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 protocol and must indicate that it is based on DragonOS. It is also necessary to ensure that users of these modified versions can easily access the original version of DragonOS.
You must make sure that the DragonOS developers can obtain the source code of your modified version through public channels in the same way, otherwise you will violate the GPLv2 protocol.
For detailed information about the protocol, please read the **LICENSE** file in the root directory of the project. Please note that according to the requirements of the GPLv2 protocol, **only the English original version has legal effect**. Any translated version is for reference only.
:::
### Usage of Open Source Software
&emsp;&emsp;During the development of DragonOS, some open source projects were referenced, or parts of their code were introduced, or they inspired us. The following list shows them. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - "Design and Implementation of a 64-bit Operating System" by Tian Yu; People's Posts and Telecommunications Press
- chcore - "Modern Operating Systems: Design and Implementation" by Chen Haibo and Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
- rcore-fs - https://github.com/rcore-os/rcore-fs.git - MIT
- redox - https://gitlab.redox-os.org/redox-os/redox - MIT
## All Commit Records of the Current Version
```text
commit bacd691c9ef0502b5cc618aad50517f9e59df5e0
Author: login <longjin@DragonOS.org>
Date: Sun Apr 2 17:09:33 2023 +0800
软中断&定时器重构 (#223)
* 软中断&定时器重构
Co-authored-by: houmkh<houjiaying@DragonOS.org>
* 修改timer的clock()
* 删除debug信息
---------
Co-authored-by: houmkh <1119644616@qq.com>
commit 6d345b774223b0daaf0ee629c7fb595a1912a9e2
Author: HoshuChiu <129569557+HoshuChiu@users.noreply.github.com>
Date: Sun Apr 2 15:55:24 2023 +0800
添加了qemu使用VNC作为图像输出的选项 (#222)
* 添加了qemu使用VNC作为图像输出的选项
* 设置vnc端口为5900
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 2b771e32f5795e0fdda458e3bb2651ef6b9673ac
Author: Gou Ngai <sujintao@dragonos.org>
Date: Sun Apr 2 15:43:53 2023 +0800
Add dup,dup2 (#224)
* dup,dup2
* fix: sys_dup2语义与posix不一致的问题
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit d7b31a969ff091224a4929496f0278d024f78c77
Author: Gou Ngai <sujintao@dragonos.org>
Date: Fri Mar 31 18:23:58 2023 +0800
Patch keyboard capslock alt (#219)
* keyboard-alt-capslock
* 解决键盘输入'%'字符的时候无法回显的bug
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 20e3152e1eea97f87d644c3023391e172bc83c93
Author: login <longjin@DragonOS.org>
Date: Fri Mar 31 12:54:37 2023 +0800
将TTY与stdio进行连接,实现基本的stdio功能 (#217)
* 将stdio与tty接上
commit 5fb12ce447710edf8566f250655a06cb27519fca
Author: Gou Ngai <sujintao@dragonos.org>
Date: Thu Mar 30 18:19:02 2023 +0800
第一套键盘扫描码的状态机 (#216)
第一套键盘扫描码的状态机
---------
Co-authored-by: guanjinquan <1666320330@qq.com>
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 676b8ef62e1a0a1e52d65b40c53c1636a2954040
Author: Mork <91721145+MorkCarpenter@users.noreply.github.com>
Date: Wed Mar 29 21:24:11 2023 +0800
部分函数从返回值为Result<<>,i32>修改为Result<<>,SystemError> (#210)
* 将Result<<>,i32>替换为Result<<>,SystemError>
* bugfix: 显示双缓冲区初始化的时候连续注册了两次Video Softirq的问题。
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 64aea4b3494bee7375e1c1ee5739c9fab0db0cb7
Author: Gou Ngai <sujintao@dragonos.org>
Date: Tue Mar 28 20:44:26 2023 +0800
增加x87FPU支持 (#212)
* remove `ret_from_syscall`
*修复ps2键盘驱动程序inode在进程fork的时候导致死锁的问题.
*更新: VFS每次拷贝文件描述符的时候,都会去调用inode的open函数
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 2286eda6526ed1b46afd79b47dc701034b9e903d
Author: WaferJay <17383312+WaferJay@users.noreply.github.com>
Date: Mon Mar 27 09:32:43 2023 +0800
修正了FAT32判断逻辑解决了文件系统为FAT12/16时系统无法正常启动的问题。 (#211)
* fix(fat): fix determination of fat type casue crash if fs is fat12/16
* refactor(fat): split BiosParameterBlock.validate() into BiosParameterBlockFAT32.validate() and BiosParameterBlockLegacy.validate()
* 调整“最大允许的簇号”的常量放置的位置。
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 45b8371173b070028457f7ee64be33f68b4f9ada
Author: login <longjin@DragonOS.org>
Date: Sat Mar 25 14:51:16 2023 +0800
新增VFS文档以及修改文档配置 (#209)
* 1.新增vfs设计文档
2.修改文档版权标志为"2022-2023, DragonOS Community"
3.修改电脑版文档页面的宽度为90%
* layout.html末尾加空行
commit 73c607aaddf6e4634cad179a81d3f1bc589f7220
Author: YJwu2023 <119829947+YJwu2023@users.noreply.github.com>
Date: Sat Mar 18 20:43:37 2023 +0800
VirtIO网卡能够正常发送、接收数据 (#204)
* virtio-net小修改
* 移动volatile.rs到libs文件夹
* 使用virtio-drivers 0.3.0
* bugfix: 初始化BAR之后未正确设置command register的问题
---------
Co-authored-by: longjin <longjin@dragonos.org>
commit 4454d1a2dd1f1078750151c028a794cfd9a04a1b
Author: login <longjin@DragonOS.org>
Date: Sat Mar 18 20:26:05 2023 +0800
新增SystemError枚举类型使得错误处理更清晰 (#205)
commit 0d48c3c9c21a2dd470d0e1e58b507db60e0887bb
Author: login <longjin@DragonOS.org>
Date: Thu Mar 16 19:48:59 2023 +0800
new: tty设备尚未与stdio接上 (#202)
commit 790d45764090bce3bbfb96b42b2818100a8cef9a
Author: login <longjin@DragonOS.org>
Date: Wed Mar 15 11:42:41 2023 +0800
修复由于textui加锁更改了preempt_count导致“进程长时间连续输出字符”的情况下进程调度器不运行的问题。 (#203)
commit c2e757d8cbeed01b16f48bea48ed8447685e6f1a
Author: login <longjin@DragonOS.org>
Date: Mon Mar 13 22:22:23 2023 +0800
解决由于在中断上下文以外sched_enqueue时未关中断导致cpu_queue双重加锁的问题 (#201)
```

View File

@ -0,0 +1,359 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.7.md
- Translation time: 2025-05-19 01:43:50
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.7
:::{note}
Author: Longjin <longjin@DragonOS.org>
April 24, 2023
:::
## Contributors List
The DragonOS V0.1.7 version was contributed by the following contributors:
- Longjin <longjin@DragonOS.org>
- Guan Jinquan <guanjinquan@DragonOS.org>
- Huang Ting <huangting@DragonOS.org>
- Hou Jiaying <houjiaying@DragonOS.org>
- Wu Yujian <wuyujian@DragonOS.org>
- Su Jintao <sujintao@DragonOS.org>
- Zhou Hanjie <zhouhanjie@DragonOS.org>
- HoshuChiu <129569557+HoshuChiu@users.noreply.github.com>
- Bullet <93781792+GP-Bullet@users.noreply.github.com>
## Sponsors List
Thank you to the following individuals for their support. We will continue to work hard!
- Wan Xiaolan
- David Wen
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- [ferchiel](https://github.com/ferchiel)
- Ye Jinyi
- Lin
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- Wu
- Anonymous Kind-hearted Person
## Update Content - Kernel
- scheduler: Change CFSqueue from Vec to Red-Black Tree (#_translated_label__229_en)
- new: lazy_init (#_translated_label__230_en) (#_translated_label__236_en)
- pci: pci restructure + pcie support (#_translated_label__235_en)
- net: Add network subsystem, and support programming in user space (#_translated_label__237_en) (#_translated_label__247_en)
- mm: Adjust brk system call to make parameters and return values consistent with Linux (#_translated_label__238_en)
- Modify errno to be consistent with relicb (#_translated_label__234_en)
- pci: Fix the issue of not being able to get MCFG table with ecam (#_translated_label__241_en)
- libs: DowncastArc and its docs (#_translated_label__244_en)
- softirq: Add timer and softirq documentation, modify the C-oriented interface of softirq (#_translated_label__245_en)
- spinlock: Fix the issue of forgetting to restore rflags in spinlock (#_translated_label__247_en)
- waitqueue: Add wakeup_all and sleep_without_schedule functions (#_translated_label__247_en)(#_translated_label__253_en)
- filesystem: Change the PollStatus structure to use the bitflags library (#_translated_label__247_en)
- filesystem: Add iovec support (brute-force implementation) (#_translated_label__247_en)
- filesystem: Add SysFS (#_translated_label__250_en) (#_translated_label__254_en)
- driver: Improve device driver model according to sysfs (#_translated_label__254_en)
- pipe: Pipe restructure (#_translated_label__253_en)
- irq: Add IrqArch abstraction and IrqFlagsGuard to simplify the process of disabling and restoring interrupts (#_translated_label__253_en)
## Update Content - User Environment
### New Repositories
- New subproject: [dsc](https://github.com/DragonOS-Community/dsc.git)
- New subproject: [DADK](https://github.com/DragonOS-Community/DADK.git) DragonOS Application Development Kit
### [DragonOS-relibc](https://github.com/DragonOS-Community/relibc.git)
- Add sys_dup and sys_dup2 support (#_translated_label__2_en)
- Add the original libc memory allocator, fix alignment issues. (#_translated_label__6_en) (#_translated_label__7_en)
- Configure network-related system calls (#_translated_label__8_en)
- Fix the issue of errno not working properly due to DragonOS not supporting TLS (thread local storage). (#_translated_label__8_en)
## Update Content - Others
- build: Fix Issue#220; restore VNC port number to 5900 (#_translated_label__243_en)
- bootstrap: Solve the problem of not being able to directly use the one-click initialization script for installation when using zsh to build DragonOS (#_translated_label__252_en)
## Update Content - Software Porting
None
## Source Code and Release Image Download
&emsp;&emsp;You can obtain the source code through the following ways:
### Get via Git
- You can visit [https://github.com/DragonOS-Community/DragonOS/releases](https://github.com/DragonOS-Community/DragonOS/releases) to download the release code and the compiled, runnable disk image.
- We also have a mirror repository on gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To solve the problem of slow and unstable access to GitHub in China, and to make it convenient for developers to download the code of each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can get the compressed package of DragonOS code and the compiled, runnable disk image through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://mirrors.DragonOS.org.cn](https://mirrors.DragonOS.org.cn)
- Domestic mirror acceleration: [https://mirrors.ringotek.cn/](https://mirrors.ringotek.cn/)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the source code of DragonOS and the corresponding software products (including but not limited to binary copies and documents) can enjoy the rights granted by us through the GPLv2 license, and you must also comply with the obligations stipulated in the agreement.
This is a rather strict license that protects the healthy development of open source software and prevents it from being encroached upon.
For most well-intentioned people, you will not violate our open source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others or violate the GPLv2 license.
Please pay special attention to the fact that violations of the open source license, especially **commercial closed-source use and any acts of plagiarism or academic misconduct**, will be subject to serious accountability. (This is the most common scenario where the open source license is violated.)
Also, please note that according to the requirements of the GPLv2 license, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 license and must indicate that it is based on DragonOS. It is also necessary to ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must make it possible for the developers of DragonOS to obtain the source code of your modified version through the same way from public channels, otherwise you will violate the GPLv2 license.
For detailed information about the license, please read the **LICENSE** file in the root directory of the project. Please note that according to the requirements of the GPLv2 license, **only the English original version has legal effect**. Any translated version is for reference only.
:::
### Usage of Open Source Software
&emsp;&emsp;During the development of DragonOS, some open source projects' designs were referenced, or parts of their code were introduced, or they were inspired by them. The following list shows them. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - "A Design and Implementation of a 64-bit Operating System" by Tian Yu; People's Posts and Telecommunications Press
- chcore - "Modern Operating Systems: Design and Implementation" by Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
- rcore-fs - https://github.com/rcore-os/rcore-fs.git - MIT
- redox - https://gitlab.redox-os.org/redox-os/redox - MIT
## All Commit Records of the Current Version
```text
commit e0de0fd6a52199753a3127cfbb5d12f0a1555aae
Author: TingHuang <92705854+TingSHub@users.noreply.github.com>
Date: Sun Apr 23 22:55:57 2023 +0800
根据sysfs完善设备驱动模型 & 添加sysfs官方文档 (#254)
* 根据sysfs完善设备驱动模型
* 添加sysfs官方文档
commit f678331a3315b7847f08ab32b42d5bf49a9f3a6a
Author: hanjiezhou <zhouhanjie@dragonos.org>
Date: Sun Apr 23 21:05:10 2023 +0800
匿名管道重构&增加IrqArch trait以及IrqFlags及其守卫 (#253)
* 实现匿名管道
* 增加IrqArch trait以及IrqFlags及其守卫
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 8a1e95abb5e4df5e872bb452efc26c9e9631157d
Author: Bullet <93781792+GP-Bullet@users.noreply.github.com>
Date: Fri Apr 21 23:36:54 2023 +0800
解决使用zsh在构建DragonOS时无法直接使用一键初始化脚本进行安装的问题 (#252)
commit dd9f1fc1a42406461e6f0d38cce1e56e22a1a15f
Author: TingHuang <92705854+TingSHub@users.noreply.github.com>
Date: Fri Apr 21 16:03:42 2023 +0800
新增SysFS (#250)
* 添加sysfs
* 注册sysfs
* 添加sysfs相关
* 添加rust-anlyzer辅助配置
* 将设备与sysfs相关联
* 添加单独的文件管理sysfs下的文件夹
commit cde5492f725681ed89abe1e6eb088e05d943d793
Author: login <longjin@DragonOS.org>
Date: Wed Apr 19 18:05:02 2023 +0800
新增网络socket的系统调用接口 (#247)
1.修复spinlock忘记恢复rflags的问题
2.WaitQueue增加wakeup_all的功能
3.完善tcp,udp,raw socket
4.把PollStatus结构体改为使用bitflags
5.新增iovec结构体
6.完成网络的系统调用
7.在bootstrap里面添加dnsmasq bridge-utils iptables
---------
Co-authored-by: guanjinquan <1666320330@qq.com>
commit 8fd71f277271ae68e648f290c67f187b030feae0
Author: houmkh <1119644616@qq.com>
Date: Mon Apr 17 17:17:06 2023 +0800
增加定时器和软中断文档修改了softirq面向c的接口 (#245)
* 增加定时器和软中断文档
* 修改softirq对c的接口和文档
* 修改文档格式
commit 77c928f6ce3192c79ea42ab7bcba2713e289f73b
Author: login <longjin@DragonOS.org>
Date: Sun Apr 16 20:29:04 2023 +0800
new: DowncastArc and its docs (#244)
commit 7149abaa49a4ca70f0e42ad3b61fdfd6a941a092
Author: HoshuChiu <129569557+HoshuChiu@users.noreply.github.com>
Date: Sun Apr 16 14:47:51 2023 +0800
修复Issue#220vnc的端口号恢复5900 (#243)
* 修复Issue#220
* qemu-vnc端口号恢复为5900
commit 5c1e552cc7f0a6ad75c8a1fa2928e3b9cc619657
Author: YJwu2023 <yujianwu2019@gmail.com>
Date: Fri Apr 14 12:21:08 2023 +0800
修复ecam无法获取MCFG table的问题 (#241)
commit 79a452ce8f27ad9c7283ac0bcf4078ed6fa018d7
Author: houmkh <1119644616@qq.com>
Date: Tue Apr 11 17:05:33 2023 +0800
修改errno,使其与relibc的保持一致 (#234)
修改errno,使其与relibc的保持一致
commit ac48398d3f17f24ff9b5da5e400ce912d05f0ba2
Author: login <longjin@DragonOS.org>
Date: Tue Apr 11 16:54:14 2023 +0800
调整brk系统调用使得参数、返回值与Linux一致 (#238)
* 新增用于测试relibc的app
* 为适配relibc,修改do_execve中关于用户栈的内容的设置
* 调整brk系统调用使得参数、返回值与Linux一致
commit 13776c114b15c406b1e0aaeeb71812ea6e471d2e
Author: login <longjin@DragonOS.org>
Date: Mon Apr 10 20:22:39 2023 +0800
增加对dhcpv4的支持tcp、udp socket已写好但由于缺少epoll机制尚未完整测试 (#237)
* 为virtio网卡完成smoltcp的phy层配置
* raw socket
* 初步写完udp和tcp socket
* 能够正常通过dhcp获取ipv4地址具有全局iface btree)
---------
Co-authored-by: guanjinquan <1666320330@qq.com>
commit 78bf93f02f84bf5e024ddfb559f040e68ce39ccf
Author: YJwu2023 <yujianwu2019@gmail.com>
Date: Sun Apr 9 12:30:02 2023 +0800
pci重构+pcie支持 (#235)
* pci重构+pcie支持
* pci重构测试完成
* 修正makefile的问题
* 小修改
* 修改函数名字
commit 5c9a63df836eedaca33c8c4c600b7aaeb2caf9a6
Author: login <longjin@DragonOS.org>
Date: Sat Apr 8 23:53:53 2023 +0800
Patch add lazy init (#236)
* 修正并发安全问题
commit 766127209ee49465a8086cfd0bec90d8b79a96c0
Author: login <longjin@DragonOS.org>
Date: Thu Apr 6 19:01:30 2023 +0800
new: lazy_init (#230)
commit e0dfd4d5d70d1b50fc7ad3ed4bf84b7ba6dad19d
Author: hanjiezhou <zhouhanjie@dragonos.org>
Date: Thu Apr 6 00:50:14 2023 +0800
修改CFSqueue从Vec变成红黑树 (#229)
使用了由tickbh编写的rbtree https://github.com/tickbh/rbtree-rs/blob/master/src/lib.rs
Co-authored-by: tickbh <tickdream125@hotmail.com>
commit 2a7d773d3d39f1cb3d59d6baa817c896c6fd52d1
Author: TingHuang <92705854+TingSHub@users.noreply.github.com>
Date: Wed Apr 5 13:02:05 2023 +0800
新增设备驱动模型,为设备和驱动提供高层视图 (#227)
* 添加base mod
* 添加设备驱动模型相关文件
* 删除单独的mod文件使用mod.rs修改一些格式上的问题
* 移动驱动错误类型到该文件
* 修改一些格式上的问题
commit 5d00b1852818dd4b25952fd6a30deb20e7c7df53
Author: login <longjin@DragonOS.org>
Date: Wed Apr 5 00:53:35 2023 +0800
修复显示刷新线程的空指针问题 (#228)
```

View File

@ -0,0 +1,570 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/V0.1.x/V0.1.8.md
- Translation time: 2025-05-19 01:43:47
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# V0.1.8
:::{note}
Author: Long Jin <longjin@DragonOS.org>
August 16, 2023
:::
## Contributors
The DragonOS V0.1.8 version was contributed by the following developers:
- Long Jin <longjin@DragonOS.org>
- Hou Jiaying <houjiaying@DragonOS.org>
- Wu Yujian <wuyujian@DragonOS.org>
- Huang Ting <huangting@DragonOS.org>
- Kong Weichao <kongweichao@DragonOS.org>
- Cai Jiaxin <caijiaxin@DragonOS.org>
- Chi Kejin <chikejhian@DragonOS.org>
- zhaoyao73 <dragonlinux@gmail.com>
- Zhou Hanjie <zhouhanjie@DragonOS.org>
- Bullet <93781792+GP-Bullet@users.noreply.github.com>
- Sakura Momoka <89176634+TihayaKousaka@users.noreply.github.com>
- Tptogiar <2528891112@qq.com>
## Sponsors
Thank you to the following contributors for their support. We will continue to work hard!
- Wan Xiaolan
- David Wen
- [Seele.Clover](https://github.com/seeleclover)
- [FindWangHao](https://github.com/FindWangHao)
- [ferchiel](https://github.com/ferchiel)
- Ye Jinyi
- Lin
- Albert
- [TerryLeeSCUT · GitHub](https://github.com/TerryLeeSCUT)
- slientbard
- Wu
- Anonymous enthusiastic person
## Update Content - Kernel
### New Features
- refactor: Refactor system call module (#_translated_label__267_en)
- feature: Add AlignBox and int_like macros (#_translated_label__272_en)
- refactor: Rewrite new IPI function & kick_cpu function (#_translated_label__274_en)
- feature: Implement gettimeofday() system call and clocksource+timekeeping sub-module (#_translated_label__278_en)
- refactor: Reconstruct PCI device interrupts and remove USB-related code (#_translated_label__285_en)
- feature: Register serial device, create character device framework (#_translated_label__290_en)
- refactor: New memory management module (#_translated_label__303_en)
- feature: New binary loader, elf parser (#_translated_label__303_en)
- feature: Add ListenTable to detect port occupation (#_translated_label__291_en)
- feature: Replace local_irq_save with IrqFlagsGuard implementation (#_translated_label__317_en)
- feature: Implement system call Fstat (#_translated_label__295_en)
- feature: Implement kernel notifier chain (#_translated_label__316_en)
- feature: Add fcntl system call (#_translated_label__323_en)
- feature: Add support for per CPU variables (#_translated_label__327_en)
- feature: Spinlock guard adds leak, spinlock adds force unlock function (#_translated_label__329_en)
### Bug Fixes
- bugfix: Fix the issue of not being able to read stdin normally (#_translated_label__264_en)
- bugfix: Fix the memory overflow problem when the buffer address passed to the AHCI driver is a user buffer (temporarily solved by allocating a kernel buffer) (#_translated_label__265_en)
- bugfix: Solve the bug caused by the improper assembly of local_irq_save and local_irq_restore functions affecting stack behavior (#_translated_label__303_en)
- bugfix: Solve the error of local_irq_save not disabling interrupts (#_translated_label__303_en)
- bugfix: Solve the error in arch_try_cmpxchg for pointer handling (#_translated_label__307_en)
- bugfix: Fix the exception error in wait4 (#_translated_label__312_en)
- bugfix: Fix the issue of null device and zero device not being able to open and not behaving as expected (#_translated_label__314_en)
- bugfix: Fix the bug in FAT file system not correctly extending file size (#_translated_label__323_en)
- bugfix: Fix the use after free issue caused by not using ManuallyDrop in some places of rwlock (#_translated_label__329_en)
## Update Content - User Environment
### New Features
- feature: Add new HTTP server (#_translated_label__265_en)
### Bug Fixes
- bugfix: Solve the issue of the init segment linking error caused by crt*.o not being sorted in ascending order during linking (#_translated_label__265_en)
## Update Content - Others
- bugfix: Fix the toolchain and resolve errors caused by the new Rust compiler (#_translated_label__258_en)
- feature: Makefile: Add make help command in the root directory (#_translated_label__271_en)
- doc: Update GitHub issue template (#_translated_label__277_en)
- bugfix: Fix the issue where the relibc header file could not recognize the __dragonos__ definition (#_translated_label__315_en)
- feature: Set the remote for the kernel and relibc to the DragonOS Git mirror site to prevent compilation failure due to domestic network issues (#_translated_label__318_en)
- feature: Automatic installation and update of dadk (#_translated_label__319_en)
## Update Content - Software Porting
- feature: Ported sqlite3 (#_translated_label__323_en)
## Source Code and Release Mirror Download
&emsp;&emsp;You can obtain the source code through the following methods:
### Get via Git
- You can visit [https://github.com/DragonOS-Community/DragonOS/releases](https://github.com/DragonOS-Community/DragonOS/releases) to download the source code of the release version, as well as the compiled and runnable disk image.
- We also have a mirror repository on Gitee for download: [https://gitee.com/DragonOS/DragonOS](https://gitee.com/DragonOS/DragonOS)
### Get via DragonOS Software Mirror Site
&emsp;&emsp;To address the slow and unstable access to GitHub in China, and to make it convenient for developers to download the source code of each version of DragonOS, we have specially set up a mirror site. You can access the mirror site through the following address:
&emsp;&emsp;You can obtain the source code package and the compiled and runnable disk image of DragonOS through the mirror site.
- [https://mirrors.DragonOS.org](https://mirrors.DragonOS.org)
- [https://git.mirrors.DragonOS.org](https://git.mirrors.DragonOS.org)
- Domestic mirror acceleration: [https://mirrors.ringotek.cn/](https://mirrors.ringotek.cn/)
## Open Source Declaration
:::{note}
To promote the healthy development of the DragonOS project, DragonOS is released under the GPLv2 open source license. Anyone who can obtain the source code of DragonOS and the corresponding software products (including but not limited to binary copies and documentation) will enjoy the rights granted by us through the GPLv2 license, and you must also comply with the obligations stipulated in the license.
This is a very strict license that protects the healthy development of open source software and prevents it from being infringed.
For most people with good intentions, you will not violate our open source license.
We encourage the free dissemination and promotion of DragonOS, but please ensure that all actions do not infringe on the legitimate rights and interests of others and do not violate the GPLv2 license.
Please pay special attention to the fact that violations of the open source license, especially **commercial closed-source use and any plagiarism or academic misconduct**, will be subject to serious accountability. (This is the easiest scenario to violate our open source license.)
Also, please note that according to the requirements of the GPLv2 license, any software modified or developed based on DragonOS must also be open-sourced under the GPLv2 license and must indicate that it is based on DragonOS. It must also ensure that users of these modified versions can easily obtain the original version of DragonOS.
You must ensure that the developers of DragonOS can obtain the source code of your modified version through the same way from public channels. Otherwise, you will violate the GPLv2 license.
For detailed information about the license, please read the **LICENSE** file in the root directory of the project. Please note that according to the requirements of the GPLv2 license, **only the English original version has legal effect**. Any translated version is for reference only.
:::
### Usage of Open Source Software
&emsp;&emsp;During the development of DragonOS, some open source projects were referenced, or parts of their code were introduced, or they were inspired by them. The following list shows them. We sincerely thank the contributors of these open source projects!
Format: <Project Name> - <Link> - <Open Source License>
- Linux - https://git.kernel.org/ - GPLv2
- skiftOS - https://github.com/skiftOS/skift - MIT
- FYSOS - https://github.com/fysnet/FYSOS - [FYSOS' License](https://github.com/fysnet/FYSOS/blob/9a8968e3d6600de34539c028c843f4c06d134039/license.txt)
- LemonOS - https://github.com/LemonOSProject/LemonOS.git - BSD 2-Clause License
- LZ4 - https://github.com/lz4/lz4 - BSD 2-Clause license
- SerenityOS - https://github.com/SerenityOS/serenity.git - BSD 2-Clause license
- MINE - 《A Design and Implementation of a 64-bit Operating System》 by Tian Yu; People's Posts and Telecommunications Press
- chcore - 《Modern Operating Systems: Design and Implementation》 by Chen Haibo, Xia Yubin; Machinery Industry Press
- SimpleKernel - https://github.com/Simple-XX/SimpleKernel - MIT
- rcore-fs - https://github.com/rcore-os/rcore-fs.git - MIT
- redox - https://gitlab.redox-os.org/redox-os/redox - MIT
## All Commit Records of the Current Version
```text
commit 40176b1c6603d487b7eb66fb81e641f0932ab90a
Author: longjin <longjin@RinGoTek.cn>
Date: Tue Aug 15 15:06:57 2023 +0000
删除无用代码,并把about app的版本号更新为0.1.8
commit 67b481888770c6469f572f244a4f97e42da77d1f
Author: houmkh <1119644616@qq.com>
Date: Mon Aug 14 12:18:46 2023 +0800
移动fstat (#330)
* 移动fstat
commit 90a0a49048fdaf5e31320d0c87f8bed8db1bd882
Author: LoGin <longjin@DragonOS.org>
Date: Mon Aug 14 01:24:49 2023 +0800
修正rwlock有的地方由于未使用ManuallyDrop导致的use after free && spinlock守卫新增leak,spinlock新增force unlock功能.(#329)
1.修正rwlock有的地方由于未使用ManuallyDrop导致的use after free
2. spinlock守卫新增leak,spinlock新增force unlock功能.
commit c3dad0011d331d782670e14723aa48e98fbac787
Author: LoGin <longjin@DragonOS.org>
Date: Sun Aug 13 16:28:24 2023 +0800
添加per cpu变量支持 (#327)
commit 42c97fa7f4fee7eeefeda5d2b7ed14f598a58493
Author: LoGin <longjin@DragonOS.org>
Date: Tue Aug 8 23:45:04 2023 +0800
删除旧的libELF (#324)
commit 6d81180b3b7328466b976b69c5f7782aa66d8a89
Author: LoGin <longjin@DragonOS.org>
Date: Tue Aug 8 23:39:22 2023 +0800
移植sqlite3,并修复一些bug (#323)
* bugfix: 程序加载器映射内存时,计算要映射的大小不正确的问题。
* 修正brk系统调用不符合规范的地方
* bugfix: 修正fat文件系统未能正确的扩展文件大小的bug
* 增加fcntl系统调用
* 移植sqlite3
commit 26887c6334cdca2d13ad71dec27fb69faa0a57be
Author: LoGin <longjin@DragonOS.org>
Date: Mon Aug 7 01:38:52 2023 +0800
bugfix: 解决取消低地址映射时错误的把重映射的物理页释放从而导致的use after free问题。 (#321)
commit 729a96ef47f473d535d8317a2ace5ba141fd282a
Author: Xshine <gshine@m.scnu.edu.cn>
Date: Sun Aug 6 12:53:47 2023 +0800
实现内核通知链 notifier chain (#316)
* 实现通知链块结构
* 实现通知链的基本功能
* 实现 atomic notifier chain
* 实现 blocking notifier chain
* 使用 rust 范式完成功能
* 支持回调次数 nr_to_call
* 移动至 libs 目录
* 完善通知链相关方法
* 修正相关格式
* 文档编写
* 更改文档路径
commit be63f3b2b6b472daa3ee17180aa607409cb9d182
Author: houmkh <1119644616@qq.com>
Date: Sat Aug 5 18:52:46 2023 +0800
实现系统调用Fstat (#295)
* fstat
* 修改syscall.rs中的verify_area
commit 9550910ae1de900e0291a84d268e8873fa142902
Author: Chiichen <39649411+Chiichen@users.noreply.github.com>
Date: Sat Aug 5 18:30:55 2023 +0800
替换 local_irq_save 为 IrqFlagsGuard 实现 (#317)
commit abf3f634bf7e13e829556e962e7c73a85d163335
Author: LoGin <longjin@DragonOS.org>
Date: Sat Aug 5 15:30:06 2023 +0800
自动安装、更新dadk (#319)
* auto install/auto update dadk
commit d6fd9c1e8025dd679339f9156477cb7d26d3db0d
Author: LoGin <longjin@DragonOS.org>
Date: Sat Aug 5 15:04:08 2023 +0800
设置内核、relibc的远程为dragonos的git镜像站防止国内网络问题导致编译失败 (#318)
commit 1a62e7767c1215f9668915b42de770e7993711bf
Author: LoGin <longjin@DragonOS.org>
Date: Wed Aug 2 18:11:05 2023 +0800
解决relibc的头文件没能识别__dragonos__定义的问题 (#315)
commit 06500303303ec14711b4f995e2058e12703f0f2c
Author: LoGin <longjin@DragonOS.org>
Date: Wed Aug 2 17:33:16 2023 +0800
修正null设备以及zero设备无法open、行为不符合预期的问题 (#314)
commit 4da3758acf0327d429dfce3d313b50c2e0fc7723
Author: Chiichen <39649411+Chiichen@users.noreply.github.com>
Date: Wed Aug 2 14:29:59 2023 +0800
修复了wait4的异常报错 (#312)
* 修复了wait4的异常报错
commit 821bb9a2dcfd28f9878d53ba722bdf164cf00f69
Author: Xshine <caijiaxin@dragonos.org>
Date: Fri Jul 28 17:51:05 2023 +0800
增加 ListenTable 来检测端口占用 (#291)
* 增加 ListenTable 来检测端口占用
* 使用Arc封装GlobalSocketHandle
* 删除 listen 处的端口检测逻辑,延至实现端口复用时完成
* 设立两张表分别记录TCP和UDP的端口占用
* 实现 meatadata 相关逻辑
* 实现socket关闭时端口在表中移除
* 使用端口管理器重构端口记录表
* 修正与RawSocket相关的端口管理逻辑
* 补充测试文件
* 修正 unbind_port 在逻辑错误
* 修正格式问题
---------
Co-authored-by: longjin <longjin@RinGoTek.cn>
commit 7cc4a02c7ff7bafd798b185beb7b0c2986b9f32f
Author: zhaoyao73 <zhaoyao73@users.noreply.github.com>
Date: Fri Jul 28 03:44:45 2023 -0400
fix arch_try_cmpxchg macro declaration (#307)
fix arch_try_cmpxchg in atomic_cmpxchg
Co-authored-by: Yao Zhao <dragonlinux@gmail.com>
commit a30434f5201ca4c60b9515c8c23444fea3b5a8c6
Author: zhaoyao73 <zhaoyao73@users.noreply.github.com>
Date: Tue Jul 25 10:02:42 2023 -0400
fix some script bugs (#304)
add arch linux prerequisited packages
Co-authored-by: Yao Zhao <dragonlinux@gmail.com>
commit 40fe15e0953f989ccfeb74826d61621d43dea6bb
Author: LoGin <longjin@DragonOS.org>
Date: Sat Jul 22 16:27:02 2023 +0800
新的内存管理模块 (#303)
&emsp;&emsp;实现了具有优秀架构设计的新的内存管理模块,对内核空间和用户空间的内存映射、分配、释放、管理等操作进行了封装,使得内核开发者可以更加方便地进行内存管理。
&emsp;&emsp;内存管理模块主要由以下类型的组件组成:
- **硬件抽象层MemoryManagementArch** - 提供对具体处理器架构的抽象,使得内存管理模块可以在不同的处理器架构上运行
- **页面映射器PageMapper**- 提供对虚拟地址和物理地址的映射以及页表的创建、填写、销毁、权限管理等操作。分为两种类型内核页表映射器KernelMapper和用户页表映射器位于具体的用户地址空间结构中
- **页面刷新器PageFlusher** - 提供对页表的刷新操作(整表刷新、单页刷新、跨核心刷新)
- **页帧分配器FrameAllocator** - 提供对页帧的分配、释放、管理等操作。具体来说包括BumpAllocator、BuddyAllocator
- **小对象分配器** - 提供对小内存对象的分配、释放、管理等操作。指的是内核里面的SlabAllocator SlabAllocator的实现目前还没有完成
- **MMIO空间管理器** - 提供对MMIO地址空间的分配、管理操作。目前这个模块待进一步重构
- **用户地址空间管理机制** - 提供对用户地址空间的管理。
- VMA机制 - 提供对用户地址空间的管理包括VMA的创建、销毁、权限管理等操作
- 用户映射管理 - 与VMA机制共同作用管理用户地址空间的映射
- **系统调用层** - 提供对用户空间的内存管理系统调用包括mmap、munmap、mprotect、mremap等
- **C接口兼容层** - 提供对原有的C代码的接口是的C代码能够正常运行。
除上面的新增内容以外,其它的更改内容:
- 新增二进制加载器以及elf的解析器
- 解决由于local_irq_save、local_irq_restore函数的汇编不规范导致影响栈行为的bug。
- 解决local_irq_save未关中断的错误。
- 修复sys_gettimeofday对timezone参数的处理的bug
---------
Co-authored-by: kong <kongweichao@dragonos.org>
commit bb5f098a864cee36b7d2c1ab9c029c0280d94a8a
Author: LoGin <longjin@DragonOS.org>
Date: Sat Jul 22 16:24:55 2023 +0800
Revert "新的内存管理模块 (#301)" (#302)
This reverts commit d8ad0a5e7724469abd5cc3cf271993538878033e.
commit d8ad0a5e7724469abd5cc3cf271993538878033e
Author: LoGin <longjin@DragonOS.org>
Date: Sat Jul 22 16:22:17 2023 +0800
新的内存管理模块 (#301)
&emsp;&emsp;实现了具有优秀架构设计的新的内存管理模块,对内核空间和用户空间的内存映射、分配、释放、管理等操作进行了封装,使得内核开发者可以更加方便地进行内存管理。
&emsp;&emsp;内存管理模块主要由以下类型的组件组成:
- **硬件抽象层MemoryManagementArch** - 提供对具体处理器架构的抽象,使得内存管理模块可以在不同的处理器架构上运行
- **页面映射器PageMapper**- 提供对虚拟地址和物理地址的映射以及页表的创建、填写、销毁、权限管理等操作。分为两种类型内核页表映射器KernelMapper和用户页表映射器位于具体的用户地址空间结构中
- **页面刷新器PageFlusher** - 提供对页表的刷新操作(整表刷新、单页刷新、跨核心刷新)
- **页帧分配器FrameAllocator** - 提供对页帧的分配、释放、管理等操作。具体来说包括BumpAllocator、BuddyAllocator
- **小对象分配器** - 提供对小内存对象的分配、释放、管理等操作。指的是内核里面的SlabAllocator SlabAllocator的实现目前还没有完成
- **MMIO空间管理器** - 提供对MMIO地址空间的分配、管理操作。目前这个模块待进一步重构
- **用户地址空间管理机制** - 提供对用户地址空间的管理。
- VMA机制 - 提供对用户地址空间的管理包括VMA的创建、销毁、权限管理等操作
- 用户映射管理 - 与VMA机制共同作用管理用户地址空间的映射
- **系统调用层** - 提供对用户空间的内存管理系统调用包括mmap、munmap、mprotect、mremap等
- **C接口兼容层** - 提供对原有的C代码的接口是的C代码能够正常运行。
除上面的新增内容以外,其它的更改内容:
- 新增二进制加载器以及elf的解析器
- 解决由于local_irq_save、local_irq_restore函数的汇编不规范导致影响栈行为的bug。
- 解决local_irq_save未关中断的错误。
- 修复sys_gettimeofday对timezone参数的处理的bug
commit 0663027b111ffb6ff93becd60ffef1e2b8fbd4c6
Author: TingHuang <92705854+TingSHub@users.noreply.github.com>
Date: Wed Jul 12 12:49:45 2023 +0800
注册串口设备,创建字符设备框架(#290)
* 按照rust规范修改两个函数名称
* 修改一些函数句柄以符合rust规范
* 添加字符设备相关
* 添加字符设备相关文件
* 添加字符设备驱动框架代码
* 将串口注册
* 规范代码
commit cc36cf4a186be834e6c2ab857b9b9501ddb8b1eb
Author: YJwu2023 <yujianwu2019@gmail.com>
Date: Sat Jul 8 17:22:42 2023 +0800
PCI设备中断重构删去USB相关代码 (#285)
* 修复ecam无法获取MCFG table的问题
* 完善pcie
* 完善irq的错误检测机制
commit 2311e2f30048d09250afc3e2e4e7029627996655
Author: 櫻井桃華 <89176634+TihayaKousaka@users.noreply.github.com>
Date: Fri Jul 7 22:50:46 2023 +0800
修改makefile通过编译 (#287)
commit 36fd013004ee0bd5fc7cfb452ba22531a83a859c
Author: houmkh <1119644616@qq.com>
Date: Sat Jun 17 22:48:15 2023 +0800
实现gettimeofday()系统调用和clocksource+timekeeping子模块 (#278)
- 实现gettimeofday()系统调用
- 实现clocksource+timekeeping子模块部分功能
- 实现了timespec转换成日期时间
commit a55ac7b928a6ca08483bbb3355bea55f1446ccab
Author: LoGin <longjin@DragonOS.org>
Date: Tue Jun 6 17:44:54 2023 +0800
Update issue templates (#277)
commit 5f57834372f6cb720ba14103effa4799e195a963
Author: Tptogiar <2528891112@qq.com>
Date: Tue Jun 6 16:41:02 2023 +0800
Makefile: 根目录下添加make help命令 (#271)
* Makefile: 根目录下添加make help命令
* Makefile: 补充根目录Makefile的help命令
commit aa0367d69e15989684109c5b454e85da9ecb1975
Author: LoGin <longjin@DragonOS.org>
Date: Tue May 30 10:21:11 2023 +0800
新的ipi功能&kick_cpu功能的重写 (#274)
commit bb24249faabc5006784aa98ca17b4cbdcb788c65
Author: LoGin <longjin@DragonOS.org>
Date: Sun May 28 23:00:37 2023 +0800
添加AlignBox和int_like宏 (#272)
commit ab5c8ca46db8e7d4793a9791292122b0b9684274
Author: login <longjin@DragonOS.org>
Date: Wed May 24 17:05:33 2023 +0800
重构系统调用模块 (#267)
* 完成系统调用模块重构
* 更新github workflow
commit 660a04cef803fd73e9b294b30a96421b021a4b9b
Author: login <longjin@DragonOS.org>
Date: Sat May 13 21:17:12 2023 +0800
新增http server (#265)
* 1.修复了当传入ahci驱动的缓冲区地址为用户缓冲区时,产生的内存越界问题.(采用分配内核缓冲区的方式临时解决)
2.新增http server
* 把libssl-dev添加到bootstrap.sh
* http_server增加对父级相对路径的安全检查防止访问系统内的其他文件
* 检查空指针情况
* 解决由于链接时crt*.o未按照升序排列导致init段链接错误的问题
commit 49249f4ec94fad7baf923aed68d9a7b2da3de3d4
Author: Bullet <93781792+GP-Bullet@users.noreply.github.com>
Date: Sat May 13 09:55:24 2023 +0800
把调度器实例的裸指针改为Option (#262)
commit bfafc102798ab1968ccf6b04315d8d3359a70ca8
Author: login <longjin@DragonOS.org>
Date: Thu May 11 17:41:42 2023 +0800
修复读取stdin时无法正常读取的问题。 (#264)
commit 7285c927d95bb4b5c692c51a8f86c47009d07667
Author: login <longjin@DragonOS.org>
Date: Thu May 11 16:17:58 2023 +0800
添加dadk支持 (#263)
* 引入dadk使用dadk0.1.1来编译test-relibc程序
* 由于gitee仓库体积限制导致无法继续使用gitee上的rust索引因此更换为清华源
* github workflow的环境中安装dadk
* Auto configure dragonos rust toolchain
commit b11bb1b25676f528ec1b0e1da0af82b4652f70c4
Author: login <longjin@DragonOS.org>
Date: Sun May 7 22:20:33 2023 +0800
固定编译工具链、修复由于新版rust编译器问题导致的报错。 (#258)
* 固定编译工具链、修复由于新版rust编译器问题导致的报错。
* 完善github workflow环境配置
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/ChangeLog/index.rst
- Translation time: 2025-05-19 01:41:22
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
Release Notes
=====================
This is the release log for DragonOS, which records the update content of every version of DragonOS.
.. toctree::
:maxdepth: 1
V0.1.x/V0.1.10
V0.1.x/V0.1.9
V0.1.x/V0.1.8
V0.1.x/V0.1.7
V0.1.x/V0.1.6
V0.1.x/V0.1.5
V0.1.x/V0.1.4
V0.1.x/V0.1.3
V0.1.x/V0.1.2
V0.1.x/V0.1.1
V0.1.x/V0.1.0

View File

@ -0,0 +1,173 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/code_contribution/c-coding-style.md
- Translation time: 2025-05-19 01:42:01
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# C Language Code Style
&emsp;&emsp;This document will briefly introduce the C language code style used in DragonOS. It is completely normal for each person to have their own code style. However, for the maintainability of an open-source project, we hope to establish some code standards so that every developer, including you, can feel more comfortable when reading the code. A project filled with various code styles is difficult to maintain.
&emsp;&emsp;We propose some recommendations here, and we hope you will follow them as much as possible. These recommendations are similar to those of Linux, but with some differences. DragonOS uses Linux's style for variable naming; for indentation, DragonOS uses Microsoft's style.
## 0. Code Formatter
&emsp;&emsp;Before we present the following recommendations, we recommend that you use the `C/C++ Extension Pack` plugin in Visual Studio Code as a code formatter during development. These plugins provide good auto-formatting functionality, ensuring that your code's basic format meets DragonOS's requirements.
&emsp;&emsp;Pressing `Ctrl+shift+I` or your set code formatting shortcut frequently while coding can help you maintain good code formatting consistently.
## 1. Indentation
&emsp;&emsp;The width of a tab is equal to 4 spaces. Code indentation is based on the tab width (usually 4 characters in most editors).
&emsp;&emsp;This makes your code more readable and helps better identify the control structures in the code. This can avoid many unnecessary troubles!
For example: In a switch statement, place the switch and case on the same indentation level. And indent each case's code by one tab to the right. This improves code readability.
```c
switch (cmd)
{
case AHCI_CMD_READ_DMA_EXT:
pack->blk_pak.end_handler = NULL;
pack->blk_pak.cmd = AHCI_CMD_READ_DMA_EXT;
break;
case AHCI_CMD_WRITE_DMA_EXT:
pack->blk_pak.end_handler = NULL;
pack->blk_pak.cmd = AHCI_CMD_WRITE_DMA_EXT;
break;
default:
pack->blk_pak.end_handler = NULL;
pack->blk_pak.cmd = cmd;
break;
}
```
## 2. Line Breaks
&emsp;&emsp;We recommend that each line should not exceed 120 characters. If it does, unless there is a necessary reason, it should be split into two lines.
&emsp;&emsp;When breaking lines, we need to indent the second line by one level from the first line's starting part to indicate that it is a sub-line. Using the code formatting shortcut can quickly accomplish this.
&emsp;&emsp;For log strings, we do not recommend breaking them into multiple lines for easier retrieval.
&emsp;&emsp;For code line breaks, do not try to place several statements on the same line, as this provides no benefit to code readability:
```c
// 错误示范(1)
if(a) return 1;
// 错误示范(2)
if(b)
do_a(),do_b();
```
## 3. Braces and Spaces
### 3.1 Braces
&emsp;&emsp;The placement of braces is a matter of personal preference, mainly due to habit rather than technical reasons. We recommend placing the opening and closing braces on new lines, as shown below:
```c
while(i<10)
{
++i;
}
```
&emsp;&emsp;This rule applies to all code blocks.
&emsp;&emsp;The reason for this choice is that, in some editors, placing the braces in this way will result in **a semi-transparent vertical line appearing in the editor, with the line ends being the braces**. This helps developers better understand the hierarchical relationships of the code blocks.
Let's demonstrate this with some examples:
&emsp;&emsp;In the following code block, we need to note that the `else if` statement should be on a new line, not after the previous `}`. This is because we require `{` to be at the start of each line and maintain the indentation level.
```c
if (*fmt == '*')
{
++fmt;
}
else if (is_digit(*fmt))
{
field_width = skip_and_atoi(&fmt);
}
```
&emsp;&emsp;When there are multiple simple statements in a loop, braces should be used.
```c
while (condition)
{
if (test)
do_something();
}
```
&emsp;&emsp;When there is only one simple statement, we do not need to use braces.
```c
if(a)
return 1;
```
### 3.2 Spaces
&emsp;&emsp;For most keywords, we need to add a space after them to improve code readability.
&emsp;&emsp;Please add a space after all of these keywords:
```c
if, switch, case, for, do, while
```
&emsp;&emsp;Keywords such as sizeof, typeof, alignof, and __attribute__ do not require a space after them, as they are used like functions.
&emsp;&emsp;For pointer-type variables, the asterisk should be close to the variable name rather than the type name. As shown below:
```c
char *a;
void *func(char* s, int **p);
```
&emsp;&emsp;Use a space on both sides of most binary and ternary operators, as shown below:
```c
= + - < > * / % | & ^ <= >= == != ? :
```
&emsp;&emsp;There is no space after these unary operators:
```c
& * + - ~ ! sizeof typeof alignof __attribute__ defined
```
&emsp;&emsp;Special cases: no space is needed before or after the following operators:
```c
++ -- . ->
```
## 4. Naming
&emsp;&emsp;DragonOS does not use the camelCase naming convention for function names, but instead uses concise and clear names like `tmp`.
&emsp;&emsp;Note that this refers to our entire project not using the camelCase naming convention. It does not mean that programmers can use obscure abbreviations for variable names.
&emsp;&emsp;For global variables or globally visible functions and structures, we need to follow the following naming conventions:
- The name should be easy to understand and not ambiguous. For example, for a function that calculates folder size, we recommend using `count_folder_size()` instead of `cntfs()`, which can confuse others.
- For global, non-static names, unless there is a special need, the naming should follow the format: `模块名缩写前缀_函数/变量名`. This naming convention helps others distinguish which module the name belongs to and reduces the risk of naming conflicts.
- Global names that do not need to be visible to other code files must be prefixed with the `static` modifier.
&emsp;&emsp;For local variables within functions, the naming convention should be concise. Long names for local variables have little significance.
[Document not completed, to be continued]

View File

@ -0,0 +1,62 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/code_contribution/conventional-commit.md
- Translation time: 2025-05-19 01:41:57
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Code Commit Guidelines
&emsp;&emsp;This document will briefly introduce the code commit guidelines for the DragonOS GitHub repository, mainly providing the naming conventions based on Conventional Commit, as well as a brief introduction to the DragonOS Bot.
## Conventional Commit (Conventional Commit)
&emsp;&emsp;For detailed specifications on Conventional Commit, please refer to the website [Conventional Commit/Conventional Commit](https://www.conventionalcommits.org/zh-hans/v1.0.0/). At the end of this section, we will provide examples (taken from the [Conventional Commit/Conventional Commit](https://www.conventionalcommits.org/zh-hans/v1.0.0/) website), which are optional to read. We make the following special notes:
1. Since the DragonOS kernel ensures external usability primarily through system call interfaces, and up to now (April 22, 2024), considering the software ecosystem, DragonOS has chosen to implement system calls consistent with Linux. Therefore, there is no special explanation for `破坏性变更(BREAKING CHANGES)`, or in the current development environment, there will not be any destructive changes that significantly affect users. Therefore, unless there is a special need, the DragonOS kernel should not use `feat!` to indicate destructive changes. (Outside the kernel, such as dadk, the guidelines still apply.)
2. The DragonOS community strictly follows a squash-based workflow, so we do not require each individual commit in a PR to conform to [Conventional Commit/Conventional Commit](https://www.conventionalcommits.org/zh-hans/v1.0.0/). However, we still strongly recommend using it.
3. Regarding scope: If not specified otherwise, the scope should be the name of the submodule/system/directory. For example, if the code change is adding a feature in `kernel/src/driver/net`, it should be named as `feat(driver/net):`; if it is in `kernel/src/mm/allocator`, it should be named as `feat(mm)`. In short, the scope should be as short as possible to indicate the module it belongs to. Most of the time, it should not use more than two levels of scope identifiers. For example, `fix(x86_64/driver/apic)` is incorrect and should be named as `fix(x86_64/apic)`.
4. In the DragonOS kernel code repository, `issue checker` will perform a simple review of the title format. If it does not conform to the format, it will be marked as `ambiguous`. Contributors are advised to modify it as needed.
5. Use lowercase.
### Examples
#### Commit message with a description and a footnote indicating a breaking change
```
feat: allow provided config object to extend other configs
BREAKING CHANGE: `extends` key in config file is now used for extending other config files
```
#### Commit message with the ! character to alert about a breaking change
```
feat!: send an email to the customer when a product is shipped
```
#### Commit message with scope and a breaking change !
```
feat(api)!: send an email to the customer when a product is shipped
```
#### Commit message with ! and BREAKING CHANGE footnote
```
chore!: drop support for Node 6
BREAKING CHANGE: use JavaScript features not available in Node 6.
```
#### Commit message without a body
```
docs: correct spelling of CHANGELOG
```
#### Commit message with scope
```
feat(lang): add polish language
```
## DragonOS Bot
&emsp;&emsp;DragonOS uses triagebot to implement automatic labeling and reviewer assignment. Contributors can also interact with triagebot through some commands. For more details, see [triagebot](https://forge.rust-lang.org/triagebot/index.html)

View File

@ -0,0 +1,29 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/code_contribution/index.rst
- Translation time: 2025-05-19 01:41:37
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Contributing to Development
====================================
DragonOS community warmly welcomes your participation! While learning technology is important, the following documents will help you understand what DragonOS community needs.
Reading these documents will help you get involved in development and make your code merge into the mainline more quickly.
.. toctree::
:maxdepth: 1
how-to-contribute <https://community.dragonos.org/contributors/>
c-coding-style
rust-coding-style
conventional-commit

View File

@ -0,0 +1,107 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/code_contribution/rust-coding-style.md
- Translation time: 2025-05-19 01:41:39
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Rust Language Code Style
&emsp;&emsp;This document will introduce the Rust language code style used in DragonOS. As development progresses, these styles may change, but we will strive to maintain consistency in the style.
## 1. Naming
&emsp;&emsp;This section is based on the naming conventions from the Rust language bible, [Naming Guide](https://course.rs/practice/naming.html). For parts not mentioned in this document, please refer to the [Naming Guide](https://course.rs/practice/naming.html) in the Rust language bible.
## 2. Formatting
### 2.1 Indentation
&emsp;&emsp;Please use the `cargo fmt` command to format the code before submitting it.
### 2.2 Function Return Values
&emsp;&emsp;Although Rust allows returning the value of the last line of a function, this approach can reduce code readability. Therefore, we recommend using the `return` statement as the last line of the function, rather than directly returning the value.
```rust
// 不推荐
fn foo() -> i32 {
1 + 2
}
// 推荐
fn foo() -> i32 {
return 1 + 2;
}
```
### 2.3 Error Handling
&emsp;&emsp;DragonOS uses returning POSIX error codes as the **inter-module error handling** method. To ensure consistency in error handling code across modules, we recommend returning the `SystemError` type when an error occurs. This approach is especially beneficial when calling functions across modules, as it allows direct return of a generic error code, thereby reducing the coupling of error handling code.
```rust
// 函数跨越模块边界时(由其他模块调用当前函数),不推荐
fn foo() -> Result<(), CustomErr> {
if 1 + 2 == 3 {
return Ok(());
} else {
return Err(CustomErr::error);
}
}
// 函数跨越模块边界时(由其他模块调用当前函数),推荐
fn foo() -> Result<(), SystemError> {
if 1 + 2 == 3 {
return Ok(());
} else {
return Err(SystemError::EINVAL);
}
}
```
&emsp;&emsp;Within **modules**, you can either use a custom error enum or return the `SystemError` type. However, we recommend using a custom error enum for error handling within modules, as it makes the error handling code clearer.
&emsp;&emsp;**TODO**: Convert existing code that uses i32 as an error code to use `SystemError`.
## 3. Comments
&emsp;&emsp;The commenting style in DragonOS is consistent with the official Rust style. We also recommend adding as many meaningful comments as possible in your code to help others understand your code. Additionally, variable and function declarations should follow the naming conventions mentioned in Section 1, making them "self-documenting."
### 3.1 Function Comments
&emsp;&emsp;Function comments should include the following:
- The function's purpose
- The function's parameters
- The function's return value
- The function's error handling
- Any side effects or other information that needs to be explained
&emsp;&emsp;The format for function comments is as follows:
```rust
/// # 函数的功能
///
/// 函数的详细描述
///
/// ## 参数
///
/// - 参数1: 参数1的说明
/// - 参数2: 参数2的说明
/// - ...
///
/// ## 返回值
/// - Ok(返回值类型): 返回值的说明
/// - Err(错误值类型): 错误的说明
///
/// ## Safety
///
/// 函数的安全性说明
```

View File

@ -0,0 +1,45 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: community/contact/index.rst
- Translation time: 2025-05-19 02:14:46
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
.. _translated_label__get_contact_with_community_en:
Get in Touch with the Community
====================================================================
Contact Information
-------------------------
Community Public Email: contact@DragonOS.org
Community Management Staff Information: https://community.dragonos.org/governance/staff-info.html
Development Discussion QQ Group: 115763565
DragonOS Official Website: https://DragonOS.org
To learn about development updates and tasks, please visit the DragonOS forum: https://bbs.dragonos.org.cn
Sponsorship and Donations
---------------------------------------------------------
DragonOS is an open-source project, and we welcome any form of sponsorship and donations. Your donations will be used for the development and maintenance of DragonOS, as well as the operation of the community.
You can sponsor or donate through the following methods:
- Visit the DragonOS official website at https://DragonOS.org, click the "Sponsor" button in the top right corner, and make a donation.
- Contact the community leader to discuss specific sponsorship methods. Contact information: longjin@dragonos.org
Financial and Donation Transparency
---------------------------------------------------------
The donation information of the DragonOS community will be made public annually. Sponsorship details and sponsor information will be made public within 15 days after receiving the donation.

68
docs/locales/en/index.rst Normal file
View File

@ -0,0 +1,68 @@
English
==========================================
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: index.rst
- Translation time: 2025-05-22 09:21:59
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
.. DragonOS documentation master file, created by
sphinx-quickstart on Fri Jun 17 23:12:00 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. toctree::
:maxdepth: 1
:caption: Getting Started
introduction/index
introduction/build_system
introduction/mirrors
.. toctree::
:maxdepth: 1
:caption: Kernel Layer
kernel/configuration/index
kernel/boot/index
kernel/core_api/index
kernel/locking/index
kernel/process_management/index
kernel/sched/index
kernel/ipc/index
kernel/memory_management/index
kernel/filesystem/index
kernel/debug/index
kernel/ktest/index
kernel/cpu_arch/index
kernel/container/index
kernel/libs/index
kernel/trace/index
kernel/syscall/index
.. toctree::
:maxdepth: 1
:caption: Userland Layer
userland/appdev/index
.. toctree::
:maxdepth: 1
:caption: Q&A
questions/index
.. toctree::
:maxdepth: 1
:caption: DragonOS Community
community/code_contribution/index
community/contact/index
community/ChangeLog/index

View File

@ -0,0 +1,294 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: introduction/build_system.md
- Translation time: 2025-05-19 01:44:01
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Building DragonOS
## 1. Introduction
&emsp;&emsp;Regardless of which method you use to compile DragonOS in the following sections, you must first follow the steps in this section to initialize your development environment.
&emsp;&emsp;Before you start, you need a computer running Linux or macOS with an X86-64 processor architecture.
&emsp;&emsp;For Linux distributions, it is recommended to use newer distributions such as Ubuntu 22, Debian, or Arch Linux, which can save you a lot of trouble.
### 1.1 Downloading the DragonOS Source Code
Use `https` to clone:
```shell
git clone https://github.com/DragonOS-Community/DragonOS.git
cd DragonOS
# 使用镜像源更新子模块
make update-submodules-by-mirror
```
For convenience in subsequent development, we recommend using `ssh` to clone (please configure your GitHub SSH Key first) to avoid cloning failures due to network issues:
Use `ssh` to clone (please configure your GitHub SSH Key first):
```shell
# 使用ssh克隆
git clone git@github.com:DragonOS-Community/DragonOS.git
cd DragonOS
# 使用镜像源更新子模块
make update-submodules-by-mirror
```
## 2. Installation Using One-Click Initialization Script (Recommended)
&emsp;&emsp;We provide a one-click initialization script that can install everything with a single command. Just run the following command in the terminal:
```shell
cd DragonOS
cd tools
bash bootstrap.sh # 这里请不要加上sudo, 因为需要安装的开发依赖包是安装在用户环境而非全局环境
```
:::{note}
The one-click configuration script currently supports the following systems:
- Ubuntu/Debian/Deepin/UOS and other derivatives based on Debian
- Gentoo, due to the characteristics of the Gentoo system, when Gentoo encounters USE or circular dependency issues, please handle them according to the emerge prompt information. Official dependency handling examples [GentooWiki](https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Working/zh-cn#.E5.BD.93_Portage_.E6.8A.A5.E9.94.99.E7.9A.84.E6.97.B6.E5.80.99)
We welcome you to improve the build script for other systems!
:::
**If the one-click initialization script runs normally and outputs the final "Congratulations" interface (as shown below), please close the current terminal and then reopen it.**
```shell
|-----------Congratulations!---------------|
| |
| 你成功安装了DragonOS所需的依赖项! |
| |
| 请关闭当前终端, 并重新打开一个终端 |
| 然后通过以下命令运行: |
| |
| make run |
| |
|------------------------------------------|
```
**Then, please directly jump to {ref}`编译命令讲解 <_build_system_command>` for reading!**
## 3. Manual Installation
### 3.1 Dependency List
&emsp;&emsp;If the automatic installation script does not support your operating system, you need to manually install the required packages. The following is the list of dependencies:
&emsp;&emsp;Among the following dependencies, except for `docker-ce` and `Rust及其工具链`, the rest can be installed using the system's built-in package manager. For the installation of Docker and Rust, please refer to the following sections.
- docker-ce
- llvm-dev
- libclang-dev
- clang
- gcc-multilib
- qemu qemu-system qemu-kvm
- build-essential
- fdisk
- lsb-release
- git
- dosfstools
- unzip
- Rust and its toolchain
**Please note that if your Linux system is running in a virtual machine, please make sure to enable the Intel VT-x or AMD-V option in the processor settings of your VMware/Virtual Box virtual machine, otherwise DragonOS will not be able to run.**
:::{note}
*In some Linux distributions, the Qemu built from the software repository may be incompatible with DragonOS due to an outdated version. If you encounter this issue, uninstall Qemu and reinstall it by compiling from source.*
Download the Qemu source code from this address: https://download.qemu.org/
After decompression, enter the source code directory and execute the following command:
```shell
# 安装编译依赖项
sudo apt install -y autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev \
git tmux python3 python3-pip ninja-build
./configure --enable-kvm
make -j 8
sudo make install
# 编译安装完成
```
Please note that the compiled QEMU will be linked via VNC mode, so you also need to install a VNC viewer on your computer to connect to the QEMU virtual machine.
:::
### 3.2 Installing Docker
&emsp;&emsp;You can download and install docker-ce from the Docker official website.
> For detailed information, please visit: [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
### 3.3 Installing Rust
:::{warning}
**[Common Misconception]**: If you plan to compile using Docker, although the Docker image already includes a Rust compilation environment, to enable code hints in VSCode using Rust-Analyzer and for the `make clean` command to run normally, you still need to install the Rust environment on your client machine.
:::
&emsp;&emsp;You can install Rust by entering the following command in the terminal.
```shell
# 这两行用于换源加速Rust的安装过程
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
# 安装Rust
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly
# 把Rustup加到环境变量
echo "export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> ~/.bashrc
source ~/.cargo/env
source "$HOME/.cargo/env"
# 更换cargo的索引源
touch ~/.cargo/config
echo -e "[source.crates-io] \n \
registry = \"https://github.com/rust-lang/crates.io-index\" \n \
\n \
replace-with = 'dragonos-gitee' \n \
[source.dragonos-gitee] \n \
registry = \"https://gitee.com/DragonOS/crates.io-index.git\" \n \
" > ~/.cargo/config
# 安装DragonOS所需的工具链
cargo install cargo-binutils
rustup toolchain install nightly
rustup default nightly
rustup component add rust-src
rustup component add llvm-tools-preview
rustup target add x86_64-unknown-none
# Rust安装完成
```
**At this point, the public dependencies have been installed. You can proceed to read the subsequent sections according to your needs.**
**For the usage of the compilation command, please refer to: {ref}`编译命令讲解 <_build_system_command>`**
## 4. Building from Docker (Not Recommended)
&emsp;&emsp;DragonOS provides a Docker compilation environment for developers to run DragonOS. However, since the coding process still needs to be performed on the client machine, you need to install the Rust compilation environment on your client machine.
&emsp;&emsp;This section assumes that all operations are performed under Linux.
### 4.1 Installing QEMU Virtual Machine
&emsp;&emsp;In this section, we recommend installing QEMU via the command line:
```shell
sudo apt install -y qemu qemu-system qemu-kvm
```
### 4.2 Creating a Disk Image
&emsp;&emsp;First, you need to use the `create_hdd_image.sh` script in the `tools` folder to create a virtual disk image. You need to run this command in the `tools` folder.
```shell
bash create_hdd_image.sh
```
### 4.3 Running DragonOS
&emsp;&emsp;If everything goes well, this will be the final step to run DragonOS. You just need to execute the following command in the DragonOS root directory to run DragonOS.
```shell
make run-docker
```
&emsp;&emsp;Wait a moment, DragonOS will be started.
&emsp;&emsp;After the QEMU virtual machine is started, you need to input the letter `c` in the console and press Enter. This will start the virtual machine.
:::{note}
1. During the first compilation, since it requires downloading Rust-related indexes (hundreds of MB in size), it will take some time. Please be patient!
2. Entering commands may require adding `sudo`
:::
**For the usage of the compilation command, please refer to: {ref}`编译命令讲解 <_build_system_command>`**
## 5. Other Notes
### 5.1 Creating a Disk Image
&emsp;&emsp;First, you need to run `tools/create_hdd_image.sh` with **normal user** permissions to create a disk image file for DragonOS. This script will automatically complete the creation of the disk image and move it to the `bin/` directory.
&emsp;&emsp;Please note that due to permission issues, you must run this script with **normal user** permissions. (After running, the system may prompt you to enter a password when you need to elevate permissions.)
### 5.2 Compiling and Running DragonOS
1. Install the compilation and runtime environment
2. Enter the DragonOS folder
3. Input `make run` to compile and write to the disk image, and run
&emsp;&emsp;After the QEMU virtual machine is started, you need to input the letter `c` in the console and press Enter. This will start the virtual machine.
:::{note}
During the first compilation, since it requires downloading Rust-related indexes (hundreds of MB in size), it will take some time. Please be patient!
:::
**For the usage of the compilation command, please refer to: {ref}`编译命令讲解 <_build_system_command>`**
(_translated_label___build_system_command_en)=
## 6. Explanation of Compilation Commands
- Local compilation, no execution: `make all -j 您的CPU核心数`
- Local compilation, write to disk image, no execution: `make build`
- Local compilation, write to disk image, and run in QEMU: `make run`
- Local compilation, write to disk image, and run in headless mode:
`make run-nographic`
- Docker compilation, write to disk image: `make docker`
- Docker compilation, write to disk image, and run in QEMU: `make run-docker`
- Start directly from an existing disk image without compilation: `make qemu`
- Start directly from an existing disk image without compilation (headless mode): `make qemu-nographic`
- Clean up compiled files: `make clean`
- Compile documentation: `make docs` (requires manual installation of sphinx and dependencies in `requirements.txt`)
- Clean up documentation: `make clean-docs`
- Format code: `make fmt`
:::{note}
If you need to run DragonOS in VNC, add the `-vnc` suffix to the above command. For example: `make run-vnc`
The QEMU virtual machine will listen on port 5900 for VNC connections. You can connect to the QEMU virtual machine using a VNC viewer or Remmina.
:::
## 7. Compiling for riscv64
Since DragonOS has not been fully ported to riscv64 yet, the compilation needs to be done as follows:
1. Modify `env.mk` and `.vscode/settings.json`
Change the value of `ARCH` in `env.mk` to `riscv64`, and in `setting.json`, comment out `"rust-analyzer.cargo.target": "x86_64-unknown-none",` and change it to the line enabling riscv64.
2. Restart rust-analyzer
3. Clean up the compilation cache
Due to the differences between x86_64 and riscv64 architectures, there may be compilation issues caused by cache. Ensure that you clean up the cache before running.
```shell
make clean
```
4. Compile and run for riscv64
```shell
# 下载DragonStub
git submodule update --init --recursive --force
make run
```
Please note that since you are running QEMU in the console, when you want to exit, input `Ctrl+A` and press `X` to do so.

View File

@ -0,0 +1,154 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: introduction/features.md
- Translation time: 2025-05-19 01:42:30
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
(_translated_label___genreal_features_en)=
# Features of DragonOS
## Specifications
- [x] Bootloader: Multiboot2
- [x] Interface: POSIX 2008
## Kernel Layer
### Memory Management
- [x] Page Frame Allocator
- [x] Small Object Allocator
- [x] VMA (Virtual Memory Area)
- [x] Automatic MMIO Address Space Allocation
- [x] Page Mapper
- [x] Hardware Abstraction Layer
- [x] Independent User Address Space Management Mechanism
- [x] C Interface Compatibility Layer
### Multicore
- [x] Multicore Boot
- [x] IPI (Inter-Processor Interrupt) Framework
### Process Management
- [x] Process Creation
- [x] Process Reclamation
- [x] Kernel Threads
- [x] Fork
- [x] Exec
- [x] Process Sleep (Supports High-Precision Sleep)
- [x] Kthread Mechanism
- [x] Extensible Binary Loader
#### Synchronization Primitives
- [x] Mutex
- [x] Semaphore
- [x] Atomic Variables
- [x] Spinlock
- [x] Wait Queue
### Scheduling
- [x] CFS Scheduler
- [x] Real-Time Scheduler (FIFO, RR)
- [x] Single-Core Scheduling
- [x] Multi-Core Scheduling
- [x] Load Balancing
### IPC (Inter-Process Communication)
- [x] Anonymous Pipe
- [x] Signal
### File System
- [x] VFS (Virtual File System)
- [x] FAT12/16/32
- [x] Devfs
- [x] RamFS
- [x] Procfs
- [x] Sysfs
### Exception and Interrupt Handling
- [x] APIC
- [x] Softirq (Soft Interrupt)
- [x] Kernel Stack Traceback
### Kernel Utility Library
- [x] String Operation Library
- [x] ELF Executable Support
- [x] printk
- [x] Basic Math Library
- [x] Screen Manager
- [x] TextUI Framework
- [x] CRC Function Library
- [x] Notification Chain
### System Calls
&emsp;&emsp;[See System Call Documentation](https://docs.dragonos.org/zh_CN/latest/syscall_api/index.html)
### Test Framework
- [x] ktest
### Drivers
- [x] ACPI (Advanced Configuration and Power Interface) Module
- [x] IDE Hard Disk
- [x] AHCI Hard Disk
- [x] PCI, PCIe Bus
- [x] XHCI (USB 3.0)
- [x] PS/2 Keyboard
- [x] PS/2 Mouse
- [x] HPET (High Precision Event Timer)
- [x] RTC (Real-Time Clock)
- [x] Local APIC Timer
- [x] UART Serial Port
- [x] VBE (Video BIOS Extension) Display
- [x] VirtIO Network Card
- [x] x87 FPU
- [x] TTY Terminal
- [x] Floating Point Processor
## User Layer
### LibC
- [x] Basic System Calls
- [x] Basic Standard Library Functions
- [x] Partial Mathematical Functions
### Shell Command Line Programs
- [x] Parsing Based on String Matching
- [x] Basic Commands
### Http Server
- A simple Http Server written in C, capable of running static websites.
## Software Portability
- [x] GCC 11.3.0 (Currently only supports x86_64 Cross Compiler) [https://github.com/DragonOS-Community/gcc](https://github.com/DragonOS-Community/gcc)
- [x] binutils 2.38 (Currently only supports x86_64 Cross Compiler) [https://github.com/DragonOS-Community/binutils](https://github.com/DragonOS-Community/binutils)
- [x] gmp 6.2.1 [https://github.com/DragonOS-Community/gmp-6.2.1](https://github.com/DragonOS-Community/gmp-6.2.1)
- [x] mpfr 4.1.1 [https://github.com/DragonOS-Community/mpfr](https://github.com/DragonOS-Community/mpfr)
- [x] mpc 1.2.1 [https://github.com/DragonOS-Community/mpc](https://github.com/DragonOS-Community/mpc)
- [x] relibc [https://github.com/DragonOS-Community/relibc](https://github.com/DragonOS-Community/relibc)
- [x] sqlite3

View File

@ -0,0 +1,34 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: introduction/index.rst
- Translation time: 2025-05-19 01:41:59
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
Introduction to DragonOS
====================================
DragonOS, the Dragon Operating System, is a 64-bit operating system designed for lightweight cloud computing scenarios. It features a fully self-developed kernel and provides Linux binary compatibility. Developed using the Rust programming language, it offers enhanced reliability. Currently, DragonOS ranks among the top three in the Rust operating system field on GitHub.
The DragonOS open-source community was established in July 2022. It is completely neutral in commercial matters. Our goal is to build a fully independent, open-source, high-performance, and highly reliable server operating system, **to create a fully self-controlled digital future!**
DragonOS has an excellent and well-designed architecture. Compared to other systems of similar size, DragonOS supports virtualization and has certain advantages in areas such as device model and scheduling subsystems. Currently, we are actively promoting cloud platform support, RISC-V support, as well as the porting of compilers and application software. We aim to achieve large-scale application in production environments within five years.
DragonOS is currently developing rapidly under the drive of the community. At present, DragonOS has already implemented about 1/4 of the Linux interface. In the future, we will provide 100% compatibility with Linux and introduce new features.
The goal of DragonOS is to build a fully independent, open-source, high-performance, and highly reliable server operating system, providing a completely self-controlled core power for the country's digital infrastructure construction.
As a community-driven open-source operating system, in order to promote the development of the open-source community and avoid potential infringement by commercial companies that do not comply with open-source agreements, we have decided to open the source code under the GPLv2 license, using a strict open-source agreement to protect DragonOS.
You may be interested in the features that have already been implemented in DragonOS. You can visit here: :ref:`功能特性 <_genreal_features>`
.. toctree::
:maxdepth: 1
features

View File

@ -0,0 +1,22 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: introduction/mirrors.md
- Translation time: 2025-05-19 01:41:42
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# DragonOS Mirror Site
You can download the source code and other files of DragonOS from the following mirror sites:
- [DragonOS Mirror Site https://mirrors.dragonos.org/](https://mirrors.dragonos.org/)
- [DragonOS Domestic Mirror Site (RinGoTek)](https://mirrors.RinGoTek.cn)
- [Git Mirror Site](https://git.mirrors.dragonos.org/)

View File

@ -0,0 +1,48 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/boot/bootloader.md
- Translation time: 2025-05-19 01:41:31
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Bootloader
## X86_64
- [x] multiboot2
- [x] HVM/PVH
### HVM/PVH Boot on x86_64
In the DragonOS note segment, there is a PVH header that allows QEMU to boot the DragonOS kernel using the ``-kernel`` parameter.
## RISC-V 64
DragonOS's boot process on RISC-V 64 is as follows:
opensbi --> uboot --> DragonStub --> kernel
This boot process decouples the DragonOS kernel from specific hardware boards, enabling the same binary file to boot and run on different hardware boards.
## Kernel Boot Callbacks
DragonOS abstracts the kernel bootloader, which is represented by the trait ``BootCallbacks``.
Different bootloaders implement the corresponding callback to initialize the kernel's bootParams or other data structures.
When the kernel boots, it automatically registers callbacks based on the type of bootloader. And at the appropriate time, it calls these callback functions.
## References
- [Multiboot2 Specification](http://git.savannah.gnu.org/cgit/grub.git/tree/doc/multiboot.texi?h=multiboot2)
- [GNU GRUB Manual 2.06](https://www.gnu.org/software/grub/manual/grub/grub.html)
- [UEFI/Legacy Boot - yujianwu - DragonOS Community](https://bbs.dragonos.org/forum.php?mod=viewthread&tid=46)

View File

@ -0,0 +1,123 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/boot/cmdline.md
- Translation time: 2025-05-19 01:41:48
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Kernel Boot Command Line Parameters
:::{note}
Author:
- Longjin <longjin@DragonOS.org>
:::
## Overview
&emsp;&emsp;The DragonOS kernel boot command line parameter parsing module aims to provide support for parsing kernel boot command line parameters similar to Linux, enabling more flexible behavior for the kernel. This module allows the kernel to receive and parse command line parameters at boot time, and execute corresponding callback functions or set environment variables based on the type of parameters.
:::{note}
Callback functions are not supported temporarily.
:::
## Design
### Parameter Types
Kernel boot command line parameters are divided into three types:
- Arg type
- KV type
- EarlyKV type
#### Arg Type
Arg type parameters have only a name and no value. They are divided into the following two types:
- ArgNormal: The default value is `false`. If the parameter is present in the command line, it will be set to `true`.
- ArgInv: The default value is `true`. If the parameter is present in the command line, it will be set to `false`.
#### KV Type
KV type parameters are represented in the command line as `name=value`, `value` separated by commas. Kernel modules can provide default values for these parameters.
#### EarlyKV Type
EarlyKV type parameters are similar to KV type parameters, but they are parsed before memory management initialization.
### Module Flags
Module flags are similar to `usbprobe.xxxx`.
### Parameter Declaration
Provides macros to declare kernel command line parameters.
### procfs Support
:::{note}
TODO: Display the current kernel's boot command line parameters under `/proc/cmdline`.
:::
## Macros for Declaring Kernel Boot Command Line Parameters
### Arg Type Parameter Declaration
```rust
kernel_cmdline_param_arg!(varname, name, default_bool, inv);
```
- `varname`: The variable name of the parameter
- `name`: The name of the parameter
- `default_bool`: The default value
- `inv`: Whether to invert
### KV Type Parameter Declaration
```rust
kernel_cmdline_param_kv!(varname, name, default_str);
```
- `varname`: The variable name of the parameter
- `name`: The name of the parameter
- `default_str`: The default value
### KV Type Parameter Declaration Before Memory Management Initialization
```rust
kernel_cmdline_param_early_kv!(varname, name, default_str);
```
- `varname`: The variable name of the parameter
- `name`: The name of the parameter
- `default_str`: The default value
## Example
The following example demonstrates how to declare and use KV type parameters:
```rust
kernel_cmdline_param_kv!(ROOTFS_PATH_PARAM, root, "");
if let Some(rootfs_dev_path) = ROOTFS_PATH_PARAM.value_str() {
.......
} else {
.......
};
```
### Usage
1. In the kernel code, use the `kernel_cmdline_param_kv!` macro to declare the required KV type parameters.
2. During kernel initialization, retrieve the parameter value through the `value_str()` or `value_bool()` method of the parameter.
3. Execute corresponding operations based on the parameter value.
By following these steps, developers can flexibly use kernel boot command line parameters to control kernel behavior.
## TODO
- Support displaying the current kernel's boot command line parameters under `/proc/cmdline` (requires procfs refactoring)
- Support setting callback functions to set parameter values

View File

@ -0,0 +1,22 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/boot/index.rst
- Translation time: 2025-05-19 01:41:19
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
Bootloader
====================================
.. toctree::
:maxdepth: 1
:caption: Contents
bootloader
cmdline

View File

@ -0,0 +1,45 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/configuration/arch.md
- Translation time: 2025-05-19 01:41:24
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Target Architecture Configuration
## Supported Architectures
- x86_64
- riscv64
## Architecture-Specific Configuration
In order to support the debugging functionality of VSCode, we need to modify the following line in the `.vscode/settings.json` file:
```
"rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf",
// "rust-analyzer.cargo.target": "x86_64-unknown-none",
```
If you want to compile for the x86_64 architecture, enable the x86_64 line and comment out the others.
If you want to compile for the riscv64 architecture, enable the riscv64 line and comment out the others.
At the same time, we also need to modify the environment variable configuration in the makefile:
Please modify the following line in the `env.mk` file:
```Makefile
ifeq ($(ARCH), )
# 在这里设置ARCH可选x86_64和riscv64
# !!!!!!!如果不同时调整这里以及vscode的settings.json那么自动补全和检查将会失效
export ARCH=riscv64
endif
```
Please note that changing the architecture requires a recompilation, so please run `make clean` to clean up the compilation results. Then run `make run` to proceed.

View File

@ -0,0 +1,114 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/configuration/config.md
- Translation time: 2025-05-19 01:41:17
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Kernel Compilation Configuration Guide
## Principle
&emsp;&emsp;Within the kernel directory, the kernel configuration is set using `kernel.config`. This file is parsed in a manner similar to a TOML file, and then the configuration of each module's `d.config` is parsed to determine the status of features.
## Example
**kernel.config**
```toml
[[module.include]]
name = "init"
path = "src/init/"
enable = "y"
description = ""
[[module.include]]
name = "mm"
path = "src/mm/"
enable = "y"
description = ""
```
- **[[module.include]]:** Adds the module to the include list
- **name:** Module name
- **path:** Module path, where the `d.config` file is located
- **enable:**
- **y:** Enabled, parse the `d.config` file of the module
- **n:** Disabled, do not parse
- **description:** Description of the module
**src/mm/d.config**
```toml
[module]
name = "mm"
description = ""
[[module.include]]
name = "allocator"
path = "src/mm/allocator/"
enable = "y"
description = ""
[[module.features]]
name = "mm_debug"
enable = "y"
description = ""
```
- **[module]:** Current module
- **name:** Name of the current module
- **description:** Description of the module
- **[[module.include]]:** Modules included in the current module, same as in `kernel.config`
- **[[module.features]]:** Features in the current module
- **name:** Feature name
- **enable:** Whether the feature is enabled
- **y:** Enabled
- **n:** Disabled
- **description:** Description of the feature
*The following are the `d.config` files of other modules:*
**src/mm/allocator/d.config**
```toml
[module]
name = "allocator"
description = ""
[[module.features]]
name = "allocator_debug"
enable = "y"
description = ""
```
**src/init/d.config**
```toml
[module]
name = "init"
description = ""
[[module.features]]
name = "init_debug"
enable = "y"
description = ""
```
All features enabled in the `d.config` files of the activated modules will be ultimately generated into the `D.config` file in the kernel directory. That is, `D.config` is the final kernel compilation configuration, as follows:
**D.config**
```
init_debug = y
allocator_debug = y
mm_debug = y
```

View File

@ -0,0 +1,22 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/configuration/index.rst
- Translation time: 2025-05-19 01:41:17
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
Kernel Compilation Configuration
====================================
.. toctree::
:maxdepth: 1
:caption: Contents
config
arch

View File

@ -0,0 +1,26 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/container/index.rst
- Translation time: 2025-05-19 01:41:19
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Containerization
====================================
This is the documentation related to containerization in DragonOS.
It mainly includes namespace, overlayfs, and cgroup
.. toctree::
:maxdepth: 2
namespaces/index
../filesystem/unionfs/index

View File

@ -0,0 +1,28 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/container/namespaces/index.rst
- Translation time: 2025-05-19 01:41:19
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Namespaces
====================================
DragonOS's namespaces currently support pid_namespace and mnt_namespace, and more features are expected to be added in the future.
Namespaces are an important component in the process of containerization.
Since the current OS is single-user, user_namespace is globally static.
.. toctree::
:maxdepth: 1
pid_namespace
mnt_namespace

View File

@ -0,0 +1,33 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/container/namespaces/mnt_namespace.md
- Translation time: 2025-05-19 01:41:19
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Mount Namespace
## Underlying Architecture
pcb -> nsproxy -> mnt_namespace
Each mounted file system has its own independent mount point, which is represented in the data structure as a red-black tree of mounts. Each namespace has its own independent mounts, so mounting and unmounting file systems will not affect others.
## System Call Interface
- clone
- CLONE_NEWNS is used to create a new MNT namespace. It provides an independent file system mount point.
- unshare
- After calling unshare() with the CLONE_NEWPID flag, all subsequent child processes will run in the new namespace.
- setns
- Adds the process to the specified namespace.
- chroot
- Changes the current process's root directory to the specified path, providing file system isolation.

View File

@ -0,0 +1,38 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/container/namespaces/pid_namespace.md
- Translation time: 2025-05-19 01:41:31
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Process Namespace
:::{note} Author: Cao Fengyi 1553389239@qq.com
October 30, 2024
:::
`pid_namespace` is a type of namespace in the kernel that is used to achieve process isolation. It allows processes running in different namespaces to have independent views of process IDs (PIDs).
## Underlying Architecture
pcb -> nsproxy -> pid_namespace
- `pid_namespace` contains an independent set of process allocators and an orphan process reaper, which independently manages PIDs within the namespace.
- Detailed information about processes is stored in the proc file system. The information corresponding to a specific PID is located within the `pid_namespace`, recording information related to the `pid_namespace`.
- The limitations imposed by `pid_namespace` are controlled and managed by `ucount`.
## System Call Interface
- `clone`
- `CLONE_NEWPID` is used to create a new PID namespace. When this flag is used, the child process will run in the new PID namespace, with the process ID starting from 1.
- `unshare`
- After calling `unshare()` with the `CLONE_NEWPID` flag, all subsequent child processes will run within the new namespace.
- `getpid`
- Calling `getpid()` within a namespace returns the process ID of the process within the current PID namespace.

View File

@ -0,0 +1,112 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/core_api/atomic.md
- Translation time: 2025-05-19 01:41:25
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Atomic Variables
## Introduction
&emsp;&emsp;DragonOS implements atomic variables of type `atomic_t`. Atomic variables are implemented using architecture-specific atomic operation instructions. The specific implementation is located in `kernel/common/atomic.h`.
## API
&emsp;&emsp; Note that all the following APIs are atomic operations.
### `inline void atomic_add(atomic_t *ato, long val)`
#### Description
&emsp;&emsp; Atomically adds a specified value to the atomic variable.
#### Parameters
**ato**
&emsp;&emsp; The atomic variable object.
**val**
&emsp;&emsp; The value to be added to the variable.
### `inline void atomic_sub(atomic_t *ato, long val)`
#### Description
&emsp;&emsp; Atomically subtracts a specified value from the atomic variable.
#### Parameters
**ato**
&emsp;&emsp; The atomic variable object.
**val**
&emsp;&emsp; The value to be subtracted from the variable.
### `void atomic_inc(atomic_t *ato)`
#### Description
&emsp;&emsp; Atomically increments the atomic variable by 1.
#### Parameters
**ato**
&emsp;&emsp; The atomic variable object.
### `void atomic_dec(atomic_t *ato)`
#### Description
&emsp;&emsp; Atomically decrements the atomic variable by 1.
#### Parameters
**ato**
&emsp;&emsp; The atomic variable object.
### `inline void atomic_set_mask(atomic_t *ato, long mask)`
#### Description
&emsp;&emsp; Performs a bitwise OR operation between the atomic variable and the mask variable.
#### Parameters
**ato**
&emsp;&emsp; The atomic variable object.
**mask**
&emsp;&emsp; The variable used for the OR operation with the atomic variable.
### `inline void atomic_clear_mask(atomic_t *ato, long mask)`
#### Description
&emsp;&emsp; Performs a bitwise AND operation between the atomic variable and the mask variable.
#### Parameters
**ato**
&emsp;&emsp; The atomic variable object.
**mask**
&emsp;&emsp; The variable used for the AND operation with the atomic variable.

View File

@ -0,0 +1,77 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/core_api/casting.md
- Translation time: 2025-05-19 01:41:11
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Type Conversion Library API
&emsp;&emsp;The kernel provides some functions to help you convert between different types. These include the following types:
- Numeric type conversion (using the `num-traits` library)
- Arc type conversion
&emsp;&emsp;All functions not specially marked are implemented in `kernel/src/libs/casting.rs`.
## 1. Numeric Type Conversion
### 1.1 Conversion Between Integer Types and Enum Types
&emsp;&emsp;You can use macros provided by the `num-traits` library to convert between enum types and integer types.
The SystemError enum type uses this approach, and you can find its usage in `kernel/src/syscall/mod.rs`.
&emsp;&emsp;It first inherits the `FromPrimitive, ToPrimitive` two traits, and then performs the conversion like this:
```rust
impl SystemError {
/// @brief 把posix错误码转换为系统错误枚举类型。
pub fn from_posix_errno(errno: i32) -> Option<SystemError> {
// posix 错误码是小于0的
if errno >= 0 {
return None;
}
return <Self as FromPrimitive>::from_i32(-errno);
}
/// @brief 把系统错误枚举类型转换为负数posix错误码。
pub fn to_posix_errno(&self) -> i32 {
return -<Self as ToPrimitive>::to_i32(self).unwrap();
}
}
```
&emsp;&emsp;These two functions well illustrate how to use these two traits.
## 2. Arc Type Conversion
### 2.1 Conversion from Arc<dyn U> to Arc<T>
&emsp;&emsp;When we need to convert an `Arc<dyn U>` to a specific type pointer of `Arc<T>`, we need to implement the `DowncastArc` trait for `U`. This trait is defined in `kernel/src/libs/casting.rs`. It requires `trait U` to implement the `Any + Sync + Send` trait.
&emsp;&emsp;To implement the `DowncastArc` trait for `trait U: Any + Send + Sync`, you need to do the following:
```rust
impl DowncastArc for dyn U {
fn as_any_arc(self: Arc<Self>) -> Arc<dyn Any> {
return self;
}
}
```
&emsp;&emsp;Using the `DowncastArc` trait, we can convert like this:
```rust
let arc: Arc<dyn U> = ...;
let arc_t: Arc<T> = arc.downcast_arc::<T>().unwrap();
```
&emsp;&emsp;If the specific type of `arc` is not `Arc<T>`, then `downcast_arc::<T>()` will return `None`.

View File

@ -0,0 +1,28 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/core_api/index.rst
- Translation time: 2025-05-19 01:41:08
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Core API Documentation
====================================
This is the core API documentation for DragonOS.
.. toctree::
:maxdepth: 1
:caption: Kernel Utility Library
kernel_api
atomic
casting
notifier_chain
softirq

View File

@ -0,0 +1,630 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/core_api/kernel_api.md
- Translation time: 2025-05-19 01:43:39
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# DragonOS Kernel Core API
## Circular Linked List Management Functions
&emsp;&emsp;Circular linked list is one of the important data structures in the kernel. It is included in `kernel/common/list.h`.
### `void list_init(struct List *list)`
#### Description
&emsp;&emsp;Initialize a List structure so that its prev and next pointers point to itself.
#### Parameters
**list**
&emsp;&emsp;The List structure to be initialized.
### `void list_add(struct List *entry, struct List *node)`
#### Description
&emsp;&emsp;Insert the node after the entry.
#### Parameters
**entry**
&emsp;&emsp;An existing node in the circular linked list.
**node**
&emsp;&emsp;The node to be inserted.
### `void list_append(struct List *entry, struct List *node)`
#### Description
&emsp;&emsp;Insert the node before the entry.
#### Parameters
**entry**
&emsp;&emsp;An existing node in the circular linked list.
**node**
&emsp;&emsp;The node to be inserted.
### `void list_del(struct List *entry)`
#### Description
&emsp;&emsp;Remove the node from the list.
#### Parameters
**entry**
&emsp;&emsp;The node to be removed.
### `list_del_init(struct List *entry)`
#### Description
&emsp;&emsp;Remove the node from the list and re-initialize the entry using list_init().
#### Parameters
**entry**
&emsp;&emsp;The node to be removed.
### `bool list_empty(struct List *entry)`
#### Description
&emsp;&emsp;Check if the list is empty.
#### Parameters
**entry**
&emsp;&emsp;A node in the list.
### `struct List *list_prev(struct List *entry)`
#### Description
&emsp;&emsp;Get the previous node of the entry.
#### Parameters
**entry**
&emsp;&emsp;A node in the list.
### `struct List *list_next(struct List *entry)`
#### Description
&emsp;&emsp;Get the next node of the entry.
#### Parameters
**entry**
&emsp;&emsp;A node in the list.
### `void list_replace(struct List *old, struct List *new)`
#### Description
&emsp;&emsp;Replace the old node in the list with the new node.
#### Parameters
**old**
&emsp;&emsp;The node to be removed.
**new**
&emsp;&emsp;The new node to be inserted into the list.
(_translated_label___list_entry_en)=
### `list_entry(ptr, type, member)`
#### Description
&emsp;&emsp;This macro can get the address of the structure that contains the List pointed to by ptr.
#### Parameters
**ptr**
&emsp;&emsp;Pointer to the List structure.
**type**
&emsp;&emsp;The type of the structure that contains the List.
**member**
&emsp;&emsp;The name of the List structure member in the structure that contains the List.
### `list_first_entry(ptr, type, member)`
#### Description
&emsp;&emsp;Get the first element in the list. Please note that this macro requires the list to be non-empty, otherwise it will cause an error.
#### Parameters
&emsp;&emsp;Same as {ref}`list_entry() <_list_entry>`
### `list_first_entry_or_null(ptr, type, member)`
#### Description
&emsp;&emsp;Get the first element in the list. If the list is empty, return NULL.
#### Parameters
&emsp;&emsp;Same as {ref}`list_entry() <_list_entry>`
### `list_last_entry(ptr, type, member)`
#### Description
&emsp;&emsp;Get the last element in the list. Please note that this macro requires the list to be non-empty, otherwise it will cause an error.
#### Parameters
&emsp;&emsp;Same as {ref}`list_entry() <_list_entry>`
### `list_last_entry_or_full(ptr, type, member)`
#### Description
&emsp;&emsp;Get the last element in the list. If the list is empty, return NULL.
#### Parameters
&emsp;&emsp;Same as {ref}`list_entry() <_list_entry>`
(_translated_label___list_next_entry_en)=
### `list_next_entry(pos, member)`
#### Description
&emsp;&emsp;Get the next element in the list.
#### Parameters
**pos**
&emsp;&emsp;Pointer to the outer structure.
**member**
&emsp;&emsp;The name of the List structure member in the outer structure.
### `list_prev_entry(pos, member)`
#### Description
&emsp;&emsp;Get the previous element in the list.
#### Parameters
&emsp;&emsp;Same as {ref}`list_next_entry() <_list_next_entry>`
(_translated_label___list_for_each_en)=
### `list_for_each(ptr, head)`
#### Description
&emsp;&emsp;Traverse the entire list (from front to back).
#### Parameters
**ptr**
&emsp;&emsp;Pointer to the List structure.
**head**
&emsp;&emsp;Pointer to the head node of the list (struct List*).
### `list_for_each_prev(ptr, head)`
#### Description
&emsp;&emsp;Traverse the entire list (from back to front).
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each() <_list_for_each>`
(_translated_label___list_for_each_safe_en)=
### `list_for_each_safe(ptr, n, head)`
#### Description
&emsp;&emsp;Traverse the entire list from front to back (supports deletion of the current list node).
&emsp;&emsp;This macro uses a temporary variable to prevent errors that may occur during iteration if the current ptr node is deleted.
#### Parameters
**ptr**
&emsp;&emsp;Pointer to the List structure.
**n**
&emsp;&emsp;Pointer to store the temporary value (List type).
**head**
&emsp;&emsp;Pointer to the head node of the list (struct List*).
### `list_for_each_prev_safe(ptr, n, head)`
#### Description
&emsp;&emsp;Traverse the entire list from back to front (supports deletion of the current list node).
&emsp;&emsp;This macro uses a temporary variable to prevent errors that may occur during iteration if the current ptr node is deleted.
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each_safe() <_list_for_each_safe>`
(_translated_label___list_for_each_entry_en)=
### `list_for_each_entry(pos, head, member)`
#### Description
&emsp;&emsp;Iterate through the list of a given type from the beginning.
#### Parameters
**pos**
&emsp;&emsp;Pointer to a structure of the specific type.
**head**
&emsp;&emsp;Pointer to the head node of the list (struct List*).
**member**
&emsp;&emsp;The name of the List member in the structure pointed to by pos.
### `list_for_each_entry_reverse(pos, head, member)`
#### Description
&emsp;&emsp;Iterate through the list of a given type in reverse order.
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each_entry() <_list_for_each_entry>`
### `list_for_each_entry_safe(pos, n, head, member)`
#### Description
&emsp;&emsp;Iterate through the list of a given type from the beginning (supports deletion of the current list node).
#### Parameters
**pos**
&emsp;&emsp;Pointer to a structure of the specific type.
**n**
&emsp;&emsp;Pointer to store the temporary value (same type as pos).
**head**
&emsp;&emsp;Pointer to the head node of the list (struct List*).
**member**
&emsp;&emsp;The name of the List member in the structure pointed to by pos.
### `list_prepare_entry(pos, head, member)`
#### Description
&emsp;&emsp;Prepare a 'pos' structure for {ref}`list_for_each_entry_continue() <_list_for_each_entry_continue>`.
#### Parameters
**pos**
&emsp;&emsp;Pointer to a structure of the specific type, used as the starting point for iteration.
**head**
&emsp;&emsp;Pointer to the struct List structure to start iteration from.
**member**
&emsp;&emsp;The name of the List member in the structure pointed to by pos.
(_translated_label___list_for_each_entry_continue_en)=
### `list_for_each_entry_continue(pos, head, member)`
#### Description
&emsp;&emsp;Continue iterating through the list from the next element of the specified position.
#### Parameters
**pos**
&emsp;&emsp;Pointer to a structure of the specific type. This pointer is used as the iteration pointer.
**head**
&emsp;&emsp;Pointer to the struct List structure to start iteration from.
**member**
&emsp;&emsp;The name of the List member in the structure pointed to by pos.
### `list_for_each_entry_continue_reverse(pos, head, member)`
#### Description
&emsp;&emsp;Iterate through the list in reverse order, starting from the previous element of the specified position.
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each_entry_continue() <_list_for_each_entry_continue>`
### `list_for_each_entry_from(pos, head, member)`
#### Description
&emsp;&emsp;Continue iterating through the list from the specified position.
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each_entry_continue() <_list_for_each_entry_continue>`
(_translated_label___list_for_each_entry_safe_continue_en)=
### `list_for_each_entry_safe_continue(pos, n, head, member)`
#### Description
&emsp;&emsp;Continue iterating through the list from the next element of the specified position (supports deletion of the current list node).
#### Parameters
**pos**
&emsp;&emsp;Pointer to a structure of the specific type. This pointer is used as the iteration pointer.
**n**
&emsp;&emsp;Pointer to store the temporary value (same type as pos).
**head**
&emsp;&emsp;Pointer to the struct List structure to start iteration from.
**member**
&emsp;&emsp;The name of the List member in the structure pointed to by pos.
### `list_for_each_entry_safe_continue_reverse(pos, n, head, member)`
#### Description
&emsp;&emsp;Iterate through the list in reverse order, starting from the previous element of the specified position (supports deletion of the current list node).
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each_entry_safe_continue() <_list_for_each_entry_safe_continue>`
### `list_for_each_entry_safe_from(pos, n, head, member)`
#### Description
&emsp;&emsp;Continue iterating through the list from the specified position (supports deletion of the current list node).
#### Parameters
&emsp;&emsp;Same as {ref}`list_for_each_entry_safe_continue() <_list_for_each_entry_safe_continue>`
---
## Basic C Function Library
&emsp;&emsp;Kernel programming differs from application layer programming; you will not be able to use functions from LibC. To address this, the kernel implements some commonly used C language functions, trying to make their behavior as close as possible to standard C library functions. It is important to note that the behavior of these functions may differ from standard C library functions, so it is recommended to carefully read the following documentation, which will be helpful to you.
### String Operations
#### `int strlen(const char *s)`
##### Description
&emsp;&emsp;Measure and return the length of the string.
##### Parameters
**src**
&emsp;&emsp;Source string.
#### `long strnlen(const char *src, unsigned long maxlen)`
##### Description
&emsp;&emsp;Measure and return the length of the string. If the string length is greater than maxlen, return maxlen.
##### Parameters
**src**
&emsp;&emsp;Source string.
**maxlen**
&emsp;&emsp;Maximum length.
#### `long strnlen_user(const char *src, unsigned long maxlen)`
##### Description
&emsp;&emsp;Measure and return the length of the string. If the string length is greater than maxlen, return maxlen.
&emsp;&emsp;This function performs address space validation, requiring the src string to be from user space. If the source string is from kernel space, it will return 0.
##### Parameters
**src**
&emsp;&emsp;Source string, located in user space.
**maxlen**
&emsp;&emsp;Maximum length.
#### `char *strncpy(char *dst, const char *src, long count)`
##### Description
&emsp;&emsp;Copy a string of count bytes and return the dst string.
##### Parameters
**src**
&emsp;&emsp;Source string.
**dst**
&emsp;&emsp;Destination string.
**count**
&emsp;&emsp;Length of the source string to copy.
#### `char *strcpy(char *dst, const char *src)`
##### Description
&emsp;&emsp;Copy the source string and return the dst string.
##### Parameters
**src**
&emsp;&emsp;Source string.
**dst**
&emsp;&emsp;Destination string.
#### `long strncpy_from_user(char *dst, const char *src, unsigned long size)`
##### Description
&emsp;&emsp;Copy a string of count bytes from user space to kernel space, and return the size of the copied string.
&emsp;&emsp;This function performs address space validation to prevent address space overflow issues.
##### Parameters
**src**
&emsp;&emsp;Source string.
**dst**
&emsp;&emsp;Destination string.
**size**
&emsp;&emsp;Length of the source string to copy.
#### `int strcmp(char *FirstPart, char *SecondPart)`
##### Description
Compare the sizes of two strings.
***Return Value***
| Situation | Return Value |
| ----------------------- | --- |
| FirstPart == SecondPart | 0 |
| FirstPart > SecondPart | 1 |
| FirstPart < SecondPart | -1 |
##### Parameters
**FirstPart**
&emsp;&emsp;First string.
**SecondPart**
&emsp;&emsp;Second string.
### Memory Operations
#### `void *memcpy(void *dst, const void *src, uint64_t size)`
##### Description
&emsp;&emsp;Copy memory from src to dst.
##### Parameters
**dst**
&emsp;&emsp;Pointer to the destination address.
**src**
&emsp;&emsp;Pointer to the source address.
**size**
&emsp;&emsp;Size of data to be copied.
#### `void *memmove(void *dst, const void *src, uint64_t size)`
##### Description
&emsp;&emsp;Similar to `memcpy()`, but this function prevents data from being incorrectly overwritten when the source and destination memory regions overlap.
##### Parameters
**dst**
&emsp;&emsp;Pointer to the destination address.
**src**
&emsp;&emsp;Pointer to the source address.
**size**
&emsp;&emsp;Size of data to be copied.

View File

@ -0,0 +1,48 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/core_api/notifier_chain.md
- Translation time: 2025-05-19 01:41:30
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Notifier Chain Notification Chain
## 1. Overview of Principles
&emsp;&emsp;The notification chain is an event notification mechanism between subsystems within the kernel or between modules within a subsystem. Essentially, a notification chain is a list of event handling functions. Each notification chain is associated with a specific type of event (e.g., reboot event). When a specific event occurs, the corresponding callback functions in the event's notification chain are called, allowing the subsystem/module to respond to the event and perform the appropriate processing.
&emsp;&emsp;The notification chain is somewhat similar to the subscription mechanism. It can be understood as: there is a "notifier" that maintains a list, and the "subscriber" registers its callback function into this list ("subscriber" can also unregister its callback function). When an event occurs that needs to be notified, the "notifier" traverses all the callback functions in the list and calls them, allowing all registered "subscribers" to respond and handle the event accordingly.
## 2. Core Features
### 2.1 Registering Callback Functions
&emsp;&emsp;The callback function is encapsulated into a specific structure and registered into the designated notification chain. The related method is `register`, which is used by the "subscriber".
### 2.2 Unregistering Callback Functions
&emsp;&emsp;The callback function is removed from the designated notification chain, i.e., it is deleted from the notification chain. The related method is `unregister`, which is used by the "subscriber".
### 2.3 Event Notification
&emsp;&emsp;When an event occurs, the notification chain related to that event performs the event notification through this method. `call_chain` This method traverses all elements in the notification chain and calls the registered callback functions in sequence. This method is used by the "notifier".
## 3. Types of Notification Chains
&emsp;&emsp;Each type of notification chain has corresponding `register`, `unregister`, and `call_chain` interfaces, with functions as described in the core features above.
- `AtomicNotifierChain`: Atomic notification chain, cannot sleep, recommended for use in interrupt context.
- `BlockingNotifierChain`: Blocking notification chain, can sleep, recommended for use in process context.
- `RawNotifierChain`: Raw notification chain, the caller is responsible for thread safety.
## 4. Other Issues
&emsp;&emsp;`BlockingNotifierChain` does not currently support the sleeping functionality.

View File

@ -0,0 +1,178 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/core_api/softirq.md
- Translation time: 2025-05-19 01:41:38
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Soft Interrupt
&emsp;&emsp;Software interrupt, also known as the bottom half of an interrupt, is used to delay the processing of work that was not completed by the hard interrupt (the top half of the interrupt). Dividing the interrupt into two stages can effectively solve the problems of long interrupt handling time and interrupt loss.
## 1. Design Philosophy
&emsp;&emsp;Each CPU has its own pending status. Soft interrupts are "initiated by which CPU, executed by which CPU", and the pending status of each CPU is not shared. The same soft interrupt vector can run concurrently on multiple cores.
&emsp;&emsp;When we need to register a new soft interrupt, we need to implement the `SoftirqVec` feature for the soft interrupt handler, and then call the `register_softirq` function to register the soft interrupt handler within the soft interrupt mechanism.
&emsp;&emsp;Please note that due to the reentrancy and concurrency of soft interrupts, the soft interrupt handler must ensure thread safety itself.
## 2. Soft Interrupt Vector Number
```rust
pub enum SoftirqNumber {
/// 时钟软中断信号
TIMER = 0,
/// 帧缓冲区刷新软中断
VideoRefresh = 1,
}
```
## 3. Soft Interrupt API
### 3.1. SoftirqVec Feature
```rust
pub trait SoftirqVec: Send + Sync + Debug {
fn run(&self);
}
```
&emsp;&emsp;The feature that the soft interrupt handler needs to implement. It needs to implement the `run` function to handle the soft interrupt. When the soft interrupt is executed, the `run` function will be called.
### 3.2. Softirq API
#### 3.2.1. Register Soft Interrupt Vector
```rust
pub fn register_softirq(&self,
softirq_num: SoftirqNumber,
handler: Arc<dyn SoftirqVec>,
) -> Result<i32, SystemError>
```
- Parameters:
- softirq_num: Interrupt vector number
- handler: The structure corresponding to the interrupt function, which needs to point to a structure variable that implements the `SoftirqVec` feature
- Return:
- Ok(i32): 0
- Err(SystemError): Error code
#### 3.2.2. Unregister Soft Interrupt Vector
```rust
pub fn unregister_softirq(&self, softirq_num: SoftirqNumber)
```
- Parameters:
- softirq_num: Interrupt vector number
#### 3.2.3. Execute Soft Interrupt
```rust
pub fn do_softirq(&self)
```
- Purpose: Execute the soft interrupt function (**only called after hard interrupt execution**)
#### 3.2.4. Clear the Pending Flag of Soft Interrupt
```rust
pub unsafe fn clear_softirq_pending(&self, softirq_num: SoftirqNumber)
```
- Purpose: Clear the pending flag of the specified soft interrupt on the current CPU. Please note that this function is unsafe because it directly modifies the pending flag without locking.
- Parameters:
- softirq_num: Interrupt vector number
#### 3.2.5. Mark Soft Interrupt as to be Executed
```rust
pub fn raise_softirq(&self, softirq_num: SoftirqNumber)
```
- Purpose: Mark the specified soft interrupt as to be executed on the current CPU
- Parameters:
- softirq_num: Interrupt vector number
### 3.3. Usage Example
```rust
#[derive(Debug)]
/// SoftirqExample中断结构体
pub struct SoftirqExample {
running: AtomicBool,
}
/// SoftirqExample中断需要处理的逻辑
fn softirq_example_func() {
println!("addressed SoftirqExample");
}
impl SoftirqVec for SoftirqExample {
fn run(&self) {
if self.set_run() == false {
return;
}
softirq_example_func();
self.clear_run();
}
}
impl SoftirqExample {
pub fn new() -> SoftirqExample {
SoftirqExample {
running: AtomicBool::new(false),
}
}
fn set_run(&self) -> bool {
let x = self
.running
.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed);
if x.is_ok() {
return true;
} else {
return false;
}
}
fn clear_run(&self) {
self.running.store(false, Ordering::Release);
}
}
fn main() {
let softirq_example = Arc::new(SoftirqExample::new());
let softirq_num = 2;
// 注册SoftirqExample中断
softirq_vectors()
.register_softirq(SoftirqNumber::from(softirq_num as u64), softirq_example)
.expect("failed to register SoftirqExample");
// 标志SoftirqExample中断需要执行
softirq_vectors().raise_softirq(SoftirqNumber::from(softirq_num as u64));
// 标志SoftirqExample中断不需要执行
softirq_vectors().clear_softirq_pending(SoftirqNumber::from(softirq_num as u64));
// 解注册SoftirqExample中断
softirq_vectors().unregister_softirq(SoftirqNumber::from(softirq_num as u64));
}
```

View File

@ -0,0 +1,23 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/cpu_arch/index.rst
- Translation time: 2025-05-19 01:41:20
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
Processor Architecture
====================================
This section of the documentation provides descriptions of some programming implementation details related to the processor architecture.
.. toctree::
:maxdepth: 1
:caption: Contents
x86_64/index

View File

@ -0,0 +1,21 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/cpu_arch/x86_64/index.rst
- Translation time: 2025-05-19 01:41:18
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
x86-64 Related Documentation
====================================
.. toctree::
:maxdepth: 1
:caption: Contents
usb_legacy_support

View File

@ -0,0 +1,24 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/cpu_arch/x86_64/usb_legacy_support.md
- Translation time: 2025-05-19 01:41:19
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# USB Legacy Support
## Introduction
&emsp;&emsp;USB Legacy Support refers to the support provided by the BIOS for USB mice and USB keyboards. On computers that support and enable USB Legacy Support, the USB mouse and keyboard are simulated by the BIOS, making them appear to the operating system as if they were PS/2 mice and keyboards.
## Related
- When initializing the USB controller, its USB Legacy Support should be disabled.

View File

@ -0,0 +1,375 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/debug/debug-kernel-with-gdb.md
- Translation time: 2025-05-19 01:41:41
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# How to Use GDB to Debug the Kernel
## Introduction
&emsp;&emsp;GDB is a powerful open-source debugging tool that can help you better diagnose and fix errors in programs.
&emsp;&emsp;It provides a rich set of features that allow you to check the execution status of a program, track the execution flow of code, view and modify the values of variables, analyze memory states, and more. It can be used in conjunction with a compiler to allow you to access debugging information during the debugging process.
&emsp;&emsp;This tutorial will guide you on how to use `rust-gdb` to debug the kernel in DragonOS, including how to start debugging and the corresponding debugging commands.
:::{note}
If you are already familiar with the various commands of `rust-gdb`, you only need to read the first part of this tutorial.
:::
---
## 1. Getting Started
### 1.1 Preparation
&emsp;&emsp;Before you start debugging the kernel, you need to enable debug mode in /Kernel/Cargo.toml by changing `debug = false` to `debug = true` in the Cargo.toml file.
```shell
debug = false
```
&emsp;&emsp;**Change to**
```shell
debug = true
```
### 1.2 Running DragonOS
&emsp;&emsp;After the preparation is complete, you can compile and run DragonOS to proceed with the subsequent debugging work.
&emsp;&emsp;Open a terminal in the root directory of DragonOS and use `make run` to start compiling and running DragonOS. For more help with compilation commands, see
> [Building DragonOS](https://docs.dragonos.org/zh_CN/latest/introduction/build_system.html).
### 1.3 Running GDB
&emsp;&emsp;Once DragonOS has started running, you can start debugging with GDB.
&emsp;&emsp;**You only need to open a new terminal and run `make gdb` to start the GDB debugger.**
```shell
make gdb
rust-gdb -n -x tools/.gdbinit
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
--Type <RET> for more, q to quit, c to continue without paging--
```
:::{note}
If you see the above information, input `c` and press Enter.
:::
---
## 2. Debugging
### 2.1 Start
&emsp;&emsp;After completing the above steps, you can start debugging.
```shell
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0xffff8000001f8f63 in ?? ()
(gdb)
```
:::{note}
The output information from GDB, `0xffff8000001f8f63 in ?? ()`, indicates that DragonOS is still in the process of booting.
:::
&emsp;&emsp;**Input `continue` or `c` to continue the program execution.**
```shell
For help, type "help".
Type "apropos word" to search for commands related to "word".
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0xffff8000001f8f63 in ?? ()
(gdb) continue
Continuing.
```
&emsp;&emsp;While DragonOS is running, you can press `Ctrl+C` at any time to send an interrupt signal to view the current state of the kernel.
```shell
(gdb) continue
Continuing.
^C
Thread 1 received signal SIGINT, Interrupt.
0xffff800000140c21 in io_in8 (port=113) at common/glib.h:136
136 __asm__ __volatile__("inb %%dx, %0 \n\t"
(gdb)
```
### 2.2 Setting Breakpoints and Watchpoints
&emsp;&emsp;Setting breakpoints and watchpoints is the most fundamental step in program debugging.
- **Setting Breakpoints**
&emsp;&emsp;You can use the `break` or `b` command to set a breakpoint.
&emsp;&emsp;Regarding the usage of `break` or `b` commands:
```shell
b <line_number> #在当前活动源文件的相应行号打断点
b <file>:<line_number> #在对应文件的相应行号打断点
b <function_name> #为一个命名函数打断点
```
- **Setting Watchpoints**
&emsp;&emsp;You can use the `watch` command to set a watchpoint.
```shell
watch <variable> # 设置对特定变量的监视点,将在特定变量发生变化的时候触发断点
watch <expression> # 设置对特定表达式的监视点比如watch *(int*)0x12345678会在内存地址0x12345678处
# 的整数值发生更改时触发断点。
```
- **Managing Breakpoints and Watchpoints**
&emsp;&emsp;Once we have set breakpoints, how can we view all the breakpoint information?
&emsp;&emsp;You can use `info b`, `info break`, or `info breakpoints` to view all breakpoint information:
```shell
(gdb) b 309
Breakpoint 12 at 0xffff8000001f8f16: file /home/heyicong/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/thingbuf-0.1.4/src/lib.rs, line 315.
(gdb) watch slots
Watchpoint 13: slots
(gdb) info b
Num Type Disp Enb Address What
12 breakpoint keep y 0xffff8000001f8f16 in thingbuf::Core::pop_ref<u8>
at /home/heyicong/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/thingbuf-0.1.4/src/lib.rs:315
13 watchpoint keep y slots
(gdb)
```
&emsp;&emsp;In the above information, the breakpoint with number 12 is the one we set in line 309 of the active source file. If its `Address` is `<MULTIPLE>`, it indicates that there are identical breakpoints at multiple addresses. This is very common in loops. The breakpoint with number 13 is the watchpoint we set for the `slots` variable.
&emsp;&emsp;We can perform operations on breakpoints or watchpoints using the following commands:
```shell
delete <breakpoint#> # 或 d <breakpoint#> 删除对应编号的断点,在您不再需要使用这个断点的时候可以通过此命令删除断点
delete <watchpoint#> # 或 d <watchpoint##> 删除对应编号的监视点,在您不再需要使用这个监视点的时候可以通过此命令删除监视点
disable <breakpoint#> # 禁用对应编号的断点,这适合于您只是暂时不需要使用这个断点时使用,当您禁用一个断点,下
# 次程序运行到该断点处将不会停下来
disable <watchpoint#> # 禁用对应编号的监视点,这适合于您只是暂时不需要使用这个监视点时使用
enable <breakpoint#> # 启用对应编号的断点
enable <watchpoint#> # 启用对应编号的监视点
#clear命令
clear # 清除当前活动源文件的断点以及监视点
clear <point_number> # 清除对应编号的所有断点或监视点这与delete行为是一致的
clear <file> # 清除指定文件的所有断点与监视点
```
## 2.3 Viewing Variables and Memory
- **print and display**
&emsp;&emsp;You can use `print` or `p` to print variable values.
&emsp;&emsp;The `print` command is used to print the value of a variable or expression. It allows you to view the data in the program during debugging.
```shell
print <variable> # 打印对应变量名的值例如print my_variable 或者 p my_variable
print <expression> # 打印合法表达式的值例如print a+b 或者 p a+b
# 示例输出
(gdb) print order
$3 = core::sync::atomic::Ordering::SeqCst
```
```{note}
如果您不仅想打印值还想显示更多详细信息例如类型信息可以使用ptype命令。
```
&emsp;&emsp;You can use the `display` command to continuously track variables or expressions. The `display` command is used to set expressions that need to be tracked and displayed every time the program stops. It is similar to the print command, but unlike print, the display command automatically prints the value of the specified expression every time the program stops, without requiring manual input of a command.
```shell
display <variable> # 打印对应变量名的值例如display my_variable
display <expression> # 打印合法表达式的值例如display a+b
# 示例输出
(gdb) display order
1: order = core::sync::atomic::Ordering::SeqCst #其中1表示display编号
#您可以通过info display命令来查看所有display编号
```
```{note}
一旦您设置了display命令每当程序停止例如在断点处停止GDB将自动打印指定表达式的值。
display命令非常有用因为它允许您在调试过程中持续监视表达式的值而无需每次都手动输入print命令。它特别适用于那些您希望持续跟踪的变量或表达式。
```
&emsp;&emsp;**To cancel an already set display command and stop automatically displaying the value of an expression, you can use the undisplay command:**
```shell
undisplay <display编号> # 如果不指定<display编号>则将取消所有已设置的display命令
# 您可以通过info display命令来查看所有display编号
```
```{note}
请注意print和display命令只会在程序暂停执行时评估变量或表达式的值。如果程序正在运行您需要通过设置断点或使用其他调试命令来暂停程序然后才能使用print命令查看数据的值,display命令设置的值将会在程序暂停时自动输出。
```
- **Output Format**
&emsp;&emsp;You can set the output format to get more information you need, for example: `print /a var`
> Refer to [GDB Cheat Sheet](https://darkdust.net/files/GDB%20Cheat%20Sheet.pdf)
```shell
Format
a Pointer.
c Read as integer, print as character.
d Integer, signed decimal.
f Floating point number.
o Integer, print as octal.
s Try to treat as C string.
t Integer, print as binary (t = „two“).
u Integer, unsigned decimal.
x Integer, print as hexadecimal.
```
### 2.4 Viewing the Call Stack
- **Viewing the Call Stack**
&emsp;&emsp;When the program is paused at a breakpoint, how should you trace the program's behavior?
&emsp;&emsp;You can use the `backtarce` command to view the call stack. The `backtrace` command is used to print the backtrace information of the current call stack. It displays all the active function call chains during program execution, including the function names, parameters, and line numbers in the source files.
```shell
# 示例输出
(gdb) backtrace
#0 function1 (arg1=10, arg2=20) at file1.c:15
#1 function2 () at file2.c:25
#2 xx () at xx.c:8
```
&emsp;&emsp;Each line of backtrace information starts with #<frame_number>, indicating the frame number. Then comes the function name and parameter list, followed by the source file name and line number.
By viewing the backtrace information, you can understand in which functions the program is executing and the position of each function in the call stack. This is very useful for debugging the program and locating problems.
- **Switching the Stack**
&emsp;&emsp;You can use the `frame` or `f` command to switch to the corresponding stack frame to get more information and perform operations.
```shell
frame <frame_number>
f <frame_number>
```
&emsp;&emsp;In addition to simply executing the backtrace command, you can also use some options to customize the output of the backtrace information. For example:
```shell
backtrace full #显示完整的符号信息,包括函数参数和局部变量。
backtrace <frame_count> #限制回溯信息的帧数,只显示指定数量的帧。
backtrace <frame_start>-<frame_end> #指定要显示的帧范围
backtrace thread <thread_id> #显示指定线程的回溯信息
```
### 2.5 Multi-core
&emsp;&emsp;When debugging the kernel, you may need to view the running status of each core.
&emsp;&emsp;You can use the `info threads` command to view the running status of each core.
```shell
(gdb) info threads
Id Target Id Frame
1 Thread 1.1 (CPU#0 [halted ]) 0xffff800000140a3e in Start_Kernel () at main.c:227
* 2 Thread 1.2 (CPU#1 [running]) thingbuf::Core::pop_ref<u8> ()
at /home/heyicong/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/thingbuf-0.1.4/src/lib.rs:315
(gdb)
```
&emsp;&emsp;You can use the `thread <thread_id>` command to switch to the context of a specific core to view and debug the status of that core. For example:
```shell
(gdb) thread 1
[Switching to thread 1 (Thread 1.1)]
#0 0xffff800000140a3e in Start_Kernel () at main.c:227
227 hlt();
```
### 2.6 More
&emsp;&emsp;Next, I will introduce more commands that you may find useful during debugging:
```shell
step #或者s,逐行执行程序并进入到函数调用中。可以在step命令后加执行次数step 3 表示要连续执行3个步骤
step <function> #进入指定的函数,并停止在函数内的第一行。
next #或者n,逐行执行程序,但跳过函数调用,直接执行函数调用后的下一行代码。
#它允许你在不进入函数内部的情况下执行代码,从而快速跳过函数调用的细节。
#同样next也可以在命令后加执行次数
finish #用于从当前函数中一直执行到函数返回为止,并停在调用该函数的地方。
#它允许你快速执行完当前函数的剩余部分,并返回到调用函数的上下文中。
continue #用于继续程序的执行,直到遇到下一个断点或
#程序正常结束或者程序暂停
quit #退出调试
list #或者l,显示当前活动源文件源代码的片段,以及当前执行的位置。
list <filename>:<function> #显示<filename>文件里面的<funtion>函数的源代码片段
list <filename>:<line_number> #显示<filename>文件里面的<line_number>附近的源代码片段
list <first>,<last> #显示当前活动源文件的<first><last>之间的源代码片段
set listsize <count> #设置list命令显示的源代码行数。默认情况下list命令显示当前行和其周围的几行代码。
info args #显示当前函数的参数及其值
info breakpoints #显示断点以及监视点信息
info display #显示当前设置的display列表
info locals #显示当前函数/栈帧中的局部变量及其值
info sharedlibrary #显示当前已加载的共享库shared library信息
info signals #显示当前程序所支持的信号信息。它可以列出程序可以接收和处理的不同信号的列表。
info threads #显示各个核心/线程信息,它可以列出当前正在运行的核心/线程以及它们的状态。
show directories #显示当前源代码文件的搜索路径列表。这些搜索路径决定了GDB在查找源代码文件时的搜索范围。
show listsize #显示打印源代码时的上下文行数。它确定了在使用list命令或其简写形式l时显示的源代码行数。
whatis variable_name #查看给定变量或表达式的类型信息。它可以帮助你了解变量的数据类型。
ptype #显示给定类型或变量的详细类型信息。它可以帮助你了解类型的结构和成员。
#相较于whatis命令ptype命令更加详细。
set var <variable_name>=<value> #设置变量值
return <expression> #强制使当前函数返回设定值
```
---
## Conclusion
&emsp;&emsp;Now, you can use rust-gdb to debug the DragonOS kernel code.
> You can refer to the GDB command documentation for more help: [GDB Cheat Sheet](https://darkdust.net/files/GDB%20Cheat%20Sheet.pdf)

View File

@ -0,0 +1,25 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/debug/index.rst
- Translation time: 2025-05-19 01:41:09
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
Kernel Debug Module
====================================
This is the documentation for the kernel debug module of DragonOS.
.. toctree::
:maxdepth: 1
:caption: Contents
traceback
debug-kernel-with-gdb
profiling-kernel-with-dadk

View File

@ -0,0 +1,109 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/debug/profiling-kernel-with-dadk.md
- Translation time: 2025-05-19 01:41:49
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Performance Analysis of the Kernel Using DADK
## 1. Overview
This document will teach you how to use DADK to perform performance analysis on the DragonOS kernel, in order to identify and resolve potential performance bottlenecks.
### 1.1 Preparation
::: {note}
Before you start, please ensure that you have installed DADK and have set up the compilation environment for the DragonOS kernel.
:::
### 1.2 What is a Flame Graph?
If you haven't heard of flame graphs before, you can read this article: [How to Read Flame Graphs? - Ruanyifeng](https://www.ruanyifeng.com/blog/2017/09/flame-graph.html)
In simple terms, a flame graph is an SVG image generated from performance sampling results, used to display the call stack of the CPU.
![](https://web-static2.dragonos.org.cn//longjin/flame2.svg?imageSlim)
The x-axis represents the number of samples. If a function occupies a wider width on the x-axis, it means it was sampled more frequently, indicating longer execution time. Note that the x-axis does not represent time, but rather all call stacks are merged and sorted alphabetically.
A flame graph is used to identify which function at the top level occupies the largest width. If there is a "plateau" (flat area), it indicates that the function may have performance issues.
Colors have no special meaning, as flame graphs represent the CPU's busy level, so warm tones are generally chosen.
## 2. Configuring the DragonOS Kernel
Since performance analysis requires detailed symbol table data, we need to configure the kernel compilation as follows:
In `kernel/Cargo.toml`'s `[profile.release]` section, set the following two options:
```toml
[profile.release]
debug = true
opt-level = 1
```
This will ensure that the compiled kernel includes symbol table data, making it easier for us to perform performance analysis.
## 3. Using DADK for Performance Analysis
### 3.1 Booting the Kernel
First, we need to boot the DragonOS kernel.
```shell
# 使用你喜欢的方式启动内核,例如:
make run
# 或者
make build && make qemu-nographic
```
### 3.2 Running Your Workload
After booting the kernel, we need to run some workloads in order to perform performance analysis.
This can be an application or something else. Even you can choose to do nothing and simply observe the call stack of the DragonOS kernel when it is idle.
### 3.3 Starting DADK for Performance Analysis
In the DragonOS project directory, run the following command:
```shell
dadk profile sample --format flamegraph --output flame.svg --interval 200ms --duration 20s --cpu-mask 0x1
```
The above command will perform performance analysis on the DragonOS kernel and generate a flame graph.
Detailed explanation:
- `--format flamegraph`: Specifies the output format as a flame graph.
- `--output flame.svg`: Specifies the output filename as `flame.svg`.
- `--interval 200ms`: Specifies the sampling interval as 200ms.
- `--duration 20s`: Specifies the sampling duration as 20 seconds.
- `--cpu-mask 0x1`: Specifies the CPU to be sampled as CPU 0. (This is a bitmask, meaning if you want to sample CPU 0 and 1, the cpu-mask would be 0x3)
*For more parameters, please refer to `dadk profile sample --help`.*
::: {note}
Since sampling will pause vCPU, the sampling time should not be too short, otherwise it may affect the normal operation of the system.
:::
After waiting for a while, you will get a `flame.svg` file.
### 3.4 Analyzing the Flame Graph
Open the `flame.svg` file in a browser, and you will see a flame graph.
You can click on a function in the flame graph to view its call stack.
**You can right-click the image below and open it in a new tab to experience the interactive effects.**
![](https://web-static2.dragonos.org.cn//longjin/flame2.svg?imageSlim)

View File

@ -0,0 +1,50 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/debug/traceback.md
- Translation time: 2025-05-19 01:41:10
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Kernel Stack Traceback
## Introduction
&emsp;&emsp;The functionality of the kernel stack traceback is located in the `kernel/debug/traceback/` folder. It provides traceback capabilities for the kernel mode, printing the call stack to the screen.
---
## API
### `void traceback(struct pt_regs * regs)`
#### Purpose
&emsp;&emsp;This interface is defined in `kernel/debug/traceback/traceback.h`, which will perform a traceback on the given kernel stack and print the trace results to the screen.
#### Parameters
##### regs
&emsp;&emsp;The first stack frame of the kernel stack to start the tracing (i.e., the bottom of the stack)
---
## Implementation Principle
&emsp;&emsp;After the kernel is linked for the first time, the Makefile will run the `kernel/debug/kallsyms` program to extract the symbol table of the kernel file, and then generate `kernel/debug/kallsyms.S`. The rodata segment of this file stores the symbol table of the functions in the text segment. Then, this file will be compiled into `kallsyms.o`. Finally, the Makefile will again call the `ld` command to link the kallsyms.o into the kernel file.
&emsp;&emsp;When the `traceback` function is called, it will traverse the symbol table to find the corresponding symbols and output them.
---
## Future Development Directions
- Add the capability to write to a log file

View File

@ -0,0 +1,29 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/index.rst
- Translation time: 2025-05-19 01:41:15
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
File System
====================================
The file system module of DragonOS consists of VFS (Virtual File System) and specific file systems.
todo: Due to the refactoring of the file system module, the documentation is temporarily unavailable and will be completed by April 10, 2023.
.. toctree::
:maxdepth: 1
:caption: Contents
overview
vfs/index
sysfs
kernfs
unionfs/index

View File

@ -0,0 +1,37 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/kernfs.md
- Translation time: 2025-05-19 01:41:15
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# KernFS
:::{note}
Maintainer:
- Long Jin <longjin@dragonos.org>
:::
## 1. Introduction
&emsp;&emsp;KernFS is a pseudo file system that acts as a container for other kernel file systems, providing a file interface to users. Its core functionality is that when files in KernFS are read/written or trigger callback points, the predefined callback functions will be invoked, triggering operations on other kernel file systems.
&emsp;&emsp;This design decouples the basic operations of SysFS and file systems. KernFS serves as the carrier of SysFS, allowing SysFS to focus more on the management of KObjects, resulting in more elegant code.
&emsp;&emsp;In the future, the kernel subsystem of DragonOS or other kernel file systems can use KernFS as a carrier for file system operations, decoupling the system management logic from specific file system operations.
## 2. Usage
&emsp;&emsp;Taking SysFS as an example, a new KernFS instance is created as the file system interface for SysFS, and then it is mounted under the directory `/sys`. Then, sysfs implements the upper-layer logic to manage KObjects. Each upper-layer KObject must include a KernFSInode. By setting the PrivateData of KernFSInode, KernFS can retrieve the corresponding KObject or sysfs attribute based on the Inode. Furthermore, when creating a KernFSInode, different callbacks are passed to the specific Inode, enabling "different Inodes to trigger different callback behaviors when read or written."
&emsp;&emsp;When a callback occurs, KernFS passes the callback information and private information to the callback function, allowing the callback function to retrieve the corresponding KObject or sysfs attribute based on the input information, thus achieving the high-level functionality provided by sysfs.
&emsp;&emsp;From the above description, we can see that KernFS achieves the purpose of "decoupling specific file operations from high-level management logic" by storing the callback functions and callback information of the upper-layer file systems.

View File

@ -0,0 +1,107 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/overview.md
- Translation time: 2025-05-19 01:41:36
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
:::{note}
Author of this article: Long Jin
Email: <longjin@DragonOS.org>
:::
# Overview
&emsp;&emsp;In this article, we will introduce the architecture design of the DragonOS file system.
## Overview
&emsp;&emsp;As shown in the following diagram, the file system-related mechanisms of DragonOS mainly include the following parts:
- System call interface
- Virtual File System (VFS)
- File abstraction (File)
- Mount file system (MountFS)
- Specific file systems
```text
┌─────────────────────────────────────────────────┐
│ │
Syscall: │ sys_open, sys_read, sys_write, sys_close, │
│ │
│ sys_lseek, etc.. │
│ │
└───────────────────────┬─────────────────────────┘
VFS: ┌──────▼─────┐
│ │
│ File │
│ │
└──────┬─────┘
┌────────▼────────┐
│ │
│ MountFS │
│ │
└────┬────────────┘
Filesystems: ┌─────────────┼─────────────┬────────────┐
│ │ │ │
┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼────┐ ┌─────▼─────┐
│ │ │ │ │ │ │ │
│ FAT │ │ DevFS │ │ ProcFS │ │ RamFS │
│ │ │ │ │ │ │ │
└───────────┘ └───────────┘ └──────────┘ └───────────┘
```
## System Call Interface
&emsp;&emsp;The file system-related system call interfaces of DragonOS mainly include the following:
- `sys_open`: Open file
- `sys_read`: Read file
- `sys_write`: Write file
- `sys_close`: Close file
- `sys_lseek`: Set file pointer position
- `sys_mkdir`: Create directory
- `sys_unlink_at`: Delete file or directory (distinguish between file and directory by parameter `flag`)
- `sys_ioctl`: Control device (not implemented)
- `sys_fstat`: Get file status (not implemented)
- `sys_fsync`: Synchronize file (not implemented)
- `sys_ftruncate`: Truncate file (not implemented)
- `sys_fchmod`: Modify file permissions (not implemented)
- Other system call interfaces (not implemented)
&emsp;&emsp;For the specific meaning of the interfaces, you can refer to the relevant documentation of Linux.
## Virtual File System (VFS)
&emsp;&emsp;VFS is the core of the DragonOS file system, providing a unified set of file system interfaces, allowing DragonOS to support various different file systems. The main functions of VFS include:
- Provide a unified file system interface
- Provide file system mounting and unmounting mechanism (MountFS)
- Provide file abstraction (File)
- Provide file system abstraction (FileSystem)
- Provide IndexNode abstraction
- Provide file system caching and synchronization mechanism (not implemented yet)
&emsp;&emsp;For detailed introduction of VFS, please see [DragonOS Virtual File System](vfs/index.rst).
## Specific File Systems
&emsp;&emsp;The file systems currently supported by DragonOS include:
- FAT file system (FAT12, FAT16, FAT32)
- DevFS
- ProcFS
- RamFS

View File

@ -0,0 +1,124 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/sysfs.md
- Translation time: 2025-05-19 01:41:50
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# SysFS
:::{note}
Author: Huang Ting
Email: <huangting@DragonOS.org>
:::
## 1. SysFS and Device Driver Model
### 1.1. The relationship between devices, drivers, buses, etc., is complex
&emsp;&emsp;If you want the kernel to run smoothly, you must code these functionalities for each module. This will make the kernel very bloated and redundant. The idea of the device model is to abstract these codes into a shared framework for all modules. This not only makes the code concise, but also allows device driver developers to avoid the headache of this essential but burdensome task, and focus their limited energy on implementing the differences of the devices.
&emsp;&emsp;The device model provides a template, an optimal approach and process that has been proven. This reduces unnecessary errors during the development process and clears the way for future maintenance.
### 1.2. sysfs is a memory-based file system, its role is to provide kernel information in the form of files for user programs to use.
&emsp;&emsp;sysfs can be seen as a file system similar to proc, devfs, and devpty. This file system is virtual and can make it easier to manage system devices. It can generate a hierarchical view of all system hardware, similar to the proc file system that provides process and status information. sysfs organizes the devices and buses connected to the system into a hierarchical file structure, which can be accessed from user space, exporting kernel data structures and their attributes to user space.
## 2. Device Driver Model in DragonOS
### 2.1. The basic elements are composed of devices and drivers
#### 2.1.1. Device
```rust
/// @brief: 所有设备都应该实现该trait
pub trait Device: Any + Send + Sync + Debug {}
```
&emsp;&emsp;DragonOS uses a global device manager to manage all devices in the system.
```rust
/// @brief Device管理器
#[derive(Debug, Clone)]
pub struct DeviceManager {
devices: BTreeMap<IdTable, Arc<dyn Device>>, // 所有设备
sys_info: Option<Arc<dyn IndexNode>>, // sys information
}
```
#### 2.1.2. Driver
```rust
/// @brief: 所有驱动驱动都应该实现该trait
pub trait Driver: Any + Send + Sync + Debug {}
```
&emsp;&emsp;Similarly, drivers also use a global driver manager for management.
```rust
/// @brief: 驱动管理器
#[derive(Debug, Clone)]
pub struct DriverManager {
drivers: BTreeMap<IdTable, Arc<dyn Driver>>, // 所有驱动
sys_info: Option<Arc<dyn IndexNode>>, // sys information
}
```
### 2.2. Bus
&emsp;&emsp;Bus is a type of device, and it also needs a driver to initialize. Due to the special nature of buses, a global bus manager is used for management.
```rust
/// @brief: 总线驱动trait所有总线驱动都应实现该trait
pub trait BusDriver: Driver {}
/// @brief: 总线设备trait所有总线都应实现该trait
pub trait Bus: Device {}
/// @brief: 总线管理结构体
#[derive(Debug, Clone)]
pub struct BusManager {
buses: BTreeMap<IdTable, Arc<dyn Bus>>, // 总线设备表
bus_drvs: BTreeMap<IdTable, Arc<dyn BusDriver>>, // 总线驱动表
sys_info: Option<Arc<dyn IndexNode>>, // 总线inode
}
```
&emsp;&emsp;As can be seen, each manager contains a sys_info. The device model establishes a connection with sysfs through this member, and sys_info points to the unique inode in sysfs. For a device, it corresponds to the devices folder under sysfs, and the same applies to other components.
## 3. How to Develop Drivers
&emsp;&emsp;Taking the platform bus as an example, the platform bus is a virtual bus that can match devices and drivers mounted on it and drive the devices. This bus is a type of device and also a type of bus. When programming, you need to create an instance of this device and implement the Device trait and Bus trait for the device instance to indicate that this structure is a bus device. At the same time, the matching rules on the bus should be implemented. Different buses have different matching rules. This bus uses a matching table for matching, and both devices and drivers should have a matching table, indicating the devices supported by the driver and the drivers supported by the device.
```rust
pub struct CompatibleTable(BTreeSet<&'static str>);
```
&emsp;&emsp;For a bus device, you need to call bus_register to register the bus into the system and visualize it in sysfs.
```rust
/// @brief: 总线注册将总线加入全局总线管理器中并根据id table在sys/bus和sys/devices下生成文件夹
/// @parameter bus: Bus设备实体
/// @return: 成功:() 失败:DeviceError
pub fn bus_register<T: Bus>(bus: Arc<T>) -> Result<(), DeviceError> {
BUS_MANAGER.add_bus(bus.get_id_table(), bus.clone());
match sys_bus_register(&bus.get_id_table().to_name()) {
Ok(inode) => {
let _ = sys_bus_init(&inode);
return device_register(bus);
}
Err(_) => Err(DeviceError::RegisterError),
}
}
```
&emsp;&emsp;From the source code of bus_register, we can see that this function not only generates a bus folder under sysfs/bus, but also internally calls device_register. This function adds the bus to the device manager and generates a device folder under sys/devices.

View File

@ -0,0 +1,23 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/unionfs/index.rst
- Translation time: 2025-05-19 01:41:16
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Union Filesystem
====================================
Union Filesystem:
OverlayFS merges multiple filesystems (referred to as "layers") into a single logical filesystem, allowing users to see a unified directory structure.
.. toctree::
:maxdepth: 1
overlayfs

View File

@ -0,0 +1,46 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/unionfs/overlayfs.md
- Translation time: 2025-05-19 01:41:18
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# overlayfs
OverlayFS is currently the most widely used union file system, with a simple principle and convenient usage, mainly used in containers.
In Docker, OverlayFS is one of the default storage drivers. Docker creates an independent upper directory for each container, while all containers share the same lower image file. This design makes resource sharing between containers more efficient and reduces storage requirements.
## Architecture Design
OverlayFS has two layers and a virtual merged layer.
- **Lower Layer (Lower Layer)**: Usually a read-only file system. It can contain multiple layers.
- **Upper Layer (Upper Layer)**: A writable layer. All write operations are performed on this layer.
- **Merged Layer (Merged Layer)**: The logical view of the upper and lower layers is merged, and the final file system presented to the user is shown.
## Working Principle
- **Read Operation**:
- OverlayFS will first read the file from the Upper Layer. If the file does not exist in the upper layer, it will read the content from the Lower Layer.
- **Write Operation**:
- If a file is located in the Lower Layer and an attempt is made to write to it, the system will copy it up to the Upper Layer and then write to it in the upper layer. If the file already exists in the Upper Layer, it will be directly written to that layer.
- **Delete Operation**:
- When deleting a file, OverlayFS creates a whiteout entry in the upper layer, which hides the file in the lower layer.
## Copy-up
- **Copy-on-Write (Write-time Copy)**
When a file in the lower layer is modified, it is copied to the upper layer (called copy-up). All subsequent modifications will be performed on the copied file in the upper layer.
## Implementation Logic
The implementation is achieved by building `ovlInode` to implement the `indexnode` trait to represent the inode of the upper or lower layer. Specific operations related to files and directories are handled accordingly.

View File

@ -0,0 +1,16 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/vfs/api.md
- Translation time: 2025-05-19 01:41:12
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# VFS API Documentation

View File

@ -0,0 +1,72 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/vfs/design.md
- Translation time: 2025-05-19 01:41:33
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
:::{note}
Author of this article: Long Jin
Email: <longjin@DragonOS.org>
:::
# Design
&emsp;&emsp;The architecture design of VFS is shown in the following diagram:
```text
┌─────────┐
│ │
│ read │
File │ │
│ write │
│ │ │
│ │ ioctl │
│ │ │
│ │ lseek │
│ │ │
│ │ etc.. │
│ └─────────┘
▼ ┌──────────────────────────────────────────────────────────────────────────────┐
MountFS │ Maintain the mount tree and handle the mounting of file systems. │
│ │ In particular, it handles the "crossing file system boundaries" condition │
│ │ while doing "lookup" or "find" operations. │
│ └──────────────────────────────────────────────────────────────────────────────┘
Filesystems: │
▼ ┌────────────────────────────────────────────────────────────────────┐
xxxFSInode │ Implement corresponding operations based on different file systems │
└────────────────────────────────────────────────────────────────────┘
```
## 1. File
&emsp;&emsp;The File structure is the most basic abstraction in VFS, representing an opened file. Whenever a process opens a file, a File structure is created to maintain the state information of that file.
## 2. Traits
&emsp;&emsp;For each specific file system, the following traits must be implemented:
- FileSystem: Indicates that a struct is a file system
- IndexNode: Indicates that a struct is an index node
&emsp;&emsp;Generally, there is a one-to-one relationship between FileSystem and IndexNode, meaning that one file system corresponds to one type of IndexNode. However, for some special file systems, such as DevFS, different IndexNodes may exist based on different device types. Therefore, there is a one-to-many relationship between FileSystem and IndexNode.
## 3. MountFS
&emsp;&emsp;Although MountFS implements the FileSystem and IndexNode traits, it is not itself a "file system," but rather a mechanism used to mount different file systems onto the same file system tree.
All file systems that need to be mounted onto the file system tree must go through MountFS to complete the mounting process. In other words, each file system structure in the mount tree is wrapped with a MountFS structure.
&emsp;&emsp;For most operations, MountFS simply forwards the operation to the specific file system without any processing. At the same time, to support cross-file system operations, such as searching in a directory tree, each lookup or find operation will go through the corresponding method of MountFSInode to determine whether the current inode is a mount point and handle it specially. If the operation is found to cross the boundary of a specific file system, MountFS will forward the operation to the next file system and perform an inode replacement. This functionality is implemented by wrapping a regular Inode structure with a MountFSInode structure.

View File

@ -0,0 +1,33 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/filesystem/vfs/index.rst
- Translation time: 2025-05-19 01:41:14
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
VFS Virtual File System
====================================
In DragonOS, VFS acts as an adapter, hiding the differences between specific file systems and providing a unified file operation interface abstraction to the outside.
VFS is the core of the file system in DragonOS. It provides a set of unified file system interfaces, enabling DragonOS to support various different file systems. The main functions of VFS include:
- Providing a unified file system interface
- Providing mount and unmount mechanisms for file systems (MountFS)
- Providing file abstraction (File)
- Providing file system abstraction (FileSystem)
- Providing IndexNode abstraction
- Providing caching and synchronization mechanisms for file systems (not yet implemented)
.. toctree::
:maxdepth: 1
:caption: Directory
design
api

View File

@ -0,0 +1,23 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/ipc/index.rst
- Translation time: 2025-05-19 01:41:19
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Inter-Process Communication
====================================
This is the documentation for DragonOS Inter-Process Communication (IPC).
.. toctree::
:maxdepth: 1
signal

View File

@ -0,0 +1,97 @@
:::{note}
**AI Translation Notice**
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/ipc/signal.md
- Translation time: 2025-05-19 01:41:43
- Translation model: `Qwen/Qwen3-8B`
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
:::
# Signal Signal
:::{note}
This document Maintainer: Longjin
Email: <longjin@RinGoTek.cn>
:::
&emsp;&emsp;Signals are a mechanism for inter-process communication. When a signal is sent to a specific process, it can trigger a specific behavior (such as exiting the program or running a signal handler). Signals are asynchronous notifications sent to a process or a specific thread within the same process, used to notify it that an event has occurred. Common uses of signals include interrupting, suspending, terminating, or ending a process. When sending a signal, the operating system interrupts the normal execution flow of the target process to deliver the signal. Execution can be interrupted at any non-atomic instruction. If the process has previously registered a signal handler, the handler routine is executed. Otherwise, the default signal handler is executed.
&emsp;&emsp;Signals are similar to interrupts, with the difference being that interrupts are mediated by the CPU and handled by the kernel, while signals are generated within the kernel (and can also be generated through system calls) and are handled by the default handlers of individual processes or the kernel.
## 1. Overview of Signal Handling
### 1.1 Signal Sending
&emsp;&emsp;When process A wants to send a signal to process B, it uses the `kill(pid, signal)` interface to send the signal. Then, it enters the `sys_kill()` function in the kernel for processing. The kernel will then add the signal to the `sigpending` in the target process's PCB.
Illustration:
```text
┌────────────┐
│ Process A: │
│ │
│ sys_kill │
└──────┬─────┘
┌──────▼──────┐ ┌────────────────────┐
│ Send Signal ├────►Add to sigpending of│
└─────────────┘ │ process B. │
└────────────────────┘
```
### 1.2 Signal Handling
&emsp;&emsp;When a process exits the kernel mode, it jumps into the `do_signal()` function to check if there are any signals that need to be handled. If there are, the signal handling process is initiated.
Signal handling process illustration:
```text
┌───────────────────────┐
│ Process B: │
│ ◄─────────────────────────────────┐
│ Return from syscall...│ │
└─────────┬─────────────┘ │
│ │
│ │
│ ┌────────────────┐ │
┌─────▼─────┐ default │ │ │
│ do_signal ├────────► │ stop process B.│ │
└─────┬─────┘ action │ │ │
│ └────────────────┘ │
│ custom action │
┌──────▼───────┐ │
│ setup signal │ │
│ frame │ │
└──────┬───────┘ │
│jump to │
┌──────▼───────┐ ┌────────────┐ sys_sigreturn ┌────────┴────────┐
│ userland ├─►sa_restorer ├──────────────►│Restore the stack│
│ sig handler │ └────────────┘ │ frame. │
└──────────────┘ └─────────────────┘
```
- If the kernel checks and finds that the process has not specified a signal handler and the signal handling action is not "ignore", the process will be terminated.
- If the kernel finds that the signal is not ignored, it will:
- Save the current kernel stack
- Set up the user-mode stack frame for signal handling
- Return to user mode and execute the signal handler
- After the signal handler finishes, it will enter the __sa_restorer__ provided by libc, initiating the `sys_sigreturn()` system call to return to kernel mode
- The kernel restores the kernel stack before handling the signal.
- The signal handling process ends, and the kernel continues with the process of returning to user mode.
- If the kernel finds that the current signal is being ignored, it checks the next signal.
- If no signals need to be handled, it returns to user mode.
## 2. Other Issues
&emsp;&emsp;None at present.

View File

@ -0,0 +1,26 @@
.. note:: AI Translation Notice
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
- Source document: kernel/ktest/index.rst
- Translation time: 2025-05-19 01:41:16
- Translation model: `Qwen/Qwen3-8B`
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
====================================
Kernel Testing
====================================
This chapter will introduce how to test the kernel, including manual testing and automated testing.
We need to perform thorough testing on the kernel as much as possible, so that we can better ensure the stability of the kernel and reduce the difficulty of debugging other modules.
Setting up comprehensive test cases can help us detect problems as much as possible, preventing us from being "stabbed" by hidden bugs in existing modules when writing new modules.
Since it is difficult to debug using tools like GDB, manual testing in the kernel is more challenging compared to testing applications.
For some modules, we can write code for unit testing and output error messages. Unfortunately, not all modules can be unit tested. For example, common modules such as memory management and process management cannot be unit tested.

Some files were not shown because too many files have changed in this diff Show More