招募开发者ArceOS 增加 x86 vga text display #26
Replies: 13 comments 2 replies
|
redox 在pc上启动的前半部分是 bootloader 驱动 vga 显示,要求用户用键盘选择显示分辨率,如下图
搜索源码目录,可以发现打印输出 Redox OS Bootloader 是在 cookbook/recipes/bootloader/source/src/main.rs 文件中 跟踪源码,也可以找到和 vga 显示有关的代码在这里: const VGA_ADDR: usize = 0xB8000;`
pub(crate) static VGA: Mutex<Vga> = Mutex::new(
unsafe { Vga::new(VGA_ADDR, 80, 25) }
);这个基地址和下面这个文件代码里的 0xb8000 是一致的
vga 这个 mod 的实现是在这个文件 顺便说一下,获取键盘输入是 os.get_key() ,也是在这个文件里 fn get_key(&self) -> OsKey {
// Read keypress
let mut data = ThunkData::new();
unsafe { data.with(self.thunk16); }
match (data.eax >> 8) as u8 {
0x4B => OsKey::Left,
0x4D => OsKey::Right,
0x48 => OsKey::Up,
0x50 => OsKey::Down,
0x0E => OsKey::Backspace,
0x53 => OsKey::Delete,
0x1C => OsKey::Enter,
_ => match data.eax as u8 {
0 => OsKey::Other,
b => OsKey::Char(b as char),
}
}
}
这几个键盘的 key 值,和上面代码里的 0x48, 0x50, 0x4B, 0x4D 也是能够对应上的。 |
|
这个我来吧,感觉应该不会很复杂。 |
|
正在添加对颜色的支持,但现在好像还有点问题。另外明天就上班了,可能之后进度会慢一些 代码已提交在 https://github.com/wfly1998/arceos/tree/feature/vga,测试用的命令为 make A=apps/helloworld ARCH=x86_64 LOG=trace GRAPHIC=on run |
|
完成了对vga驱动的颜色显示和等级控制,结果如下: 首先在ulib/axstd/src/macros.rs中添加了pinfo!, pdev!, pdebug!三个宏来支持debug模式的三个等级的输出。 |
|
实现 pinfo ,pdev, pdebug 函数 |


































Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
参考代码
https://github.com/phil-opp/blog_os/blob/post-12/src/vga_buffer.rs
增加到 https://github.com/rcore-os/arceos/tree/main/modules/axhal/src/platform/x86_pc
要求在 x86下grub引导成功并显示文字
All reactions