Crate tg_sbi

Crate tg_sbi 

Source
Expand description

§tg-sbi

为 rCore 教学操作系统提供的 SBI (Supervisor Binary Interface) 调用封装。

§Features

  • nobios: 启用内置的 M-Mode SBI 实现,用于 -bios none 启动模式。 启用此 feature 后,crate 将提供自己的 M-Mode 陷阱处理程序和基本 SBI 服务。

§支持的 SBI 扩展

  • Legacy 控制台 I/O (EID 0x01, 0x02)
  • Timer 扩展 (EID 0x54494D45)
  • System Reset 扩展 (EID 0x53525354)

§Example

use tg_sbi::{console_putchar, set_timer, shutdown};

// 输出字符
console_putchar(b'H');

// 设置定时器中断
set_timer(1000000);

// 关闭系统
shutdown(false);

Functions§

console_getchar
从调试控制台读取一个字符。
console_putchar
向调试控制台输出一个字符。
set_timer
设置下一次定时器中断的时间。
shutdown
关闭系统。