跳转到内容

OpenOS

使用 Rust 构建的微内核操作系统,专为 x86_64 裸机设计。Channel/Handle IPC,用户空间服务。
v0.3.0Rustx86_64

Channel/Handle IPC · 用户空间服务 · ELF 加载器


Channel/Handle IPC

基于能力的 IPC 机制,支持同步会合、Handle 传递、原子 RPC。

用户空间服务

Console 服务运行在 Ring 3,通过 Channel 与内核通信。

ELF 加载器

从 initrd 加载 ELF64 可执行文件,支持 Ring 3 切换。



=================================
OpenOS Microkernel v0.3.0
=================================
[...] Initializing IPC subsystem
[OK] IPC subsystem initialized
[...] Initializing task scheduler
[OK] Task scheduler initialized
[OK] Kernel initialization complete
[...] Ramdisk loaded (12984 bytes)
[...] Channel: handle_a=0x103ff00000001, handle_b=0x103ff00000002
[...] Kernel sent message to channel
[...] Launching console service (user-space)
[SYSCALL] channel_receive: got 31 bytes
Hello from user-space service!
[SYS_EXIT] status=0
[OK] Kernel halted

编号名称说明
0x01channel_create创建 Channel,返回两个 Handle
0x02channel_send发送消息,同步会合
0x03channel_receive接收消息,阻塞等待
0x04channel_call原子 RPC(send + block for reply)
0x05channel_reply回复消息,解除 call 阻塞
0x10handle_close关闭 Handle
0x11handle_duplicate克隆 Handle,可收窄权限
0x12handle_transfer传递 Handle 到其他进程
0x32process_exit终止当前进程
0x42thread_yield让出 CPU
0xF0console_write调试输出到串口

已完成

  • Channel/Handle IPC 系统
  • 用户空间 Ring 3 切换
  • ELF64 加载器 + initrd
  • Console 用户空间服务
  • Handle 表 + Rights 系统
  • 上下文切换基础设施

计划中

  • Process/Thread 系统调用
  • Event/Timer 系统调用
  • Job 进程组管理
  • Endpoint 服务发现
  • 文件系统
  • 网络栈