招募开发者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 也是能够对应上的。 |
Beta Was this translation helpful? Give feedback.
-
|
这个我来吧,感觉应该不会很复杂。 |
Beta Was this translation helpful? Give feedback.
-
|
现在支持基本的文字输入了,我之后这几天再调整一下 |
Beta Was this translation helpful? Give feedback.
-
|
正在添加对颜色的支持,但现在好像还有点问题。另外明天就上班了,可能之后进度会慢一些 代码已提交在 https://github.com/wfly1998/arceos/tree/feature/vga,测试用的命令为 make A=apps/helloworld ARCH=x86_64 LOG=trace GRAPHIC=on run |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
颜色的问题解决了, 还修了开启分页的时候会 panic 的 bug, 参考图中的命令如下 make A=apps/helloworld ARCH=x86_64 LOG=trace GRAPHIC=on run
make A=apps/fs/shell ARCH=x86_64 GRAPHIC=on BLK=y run |
Beta Was this translation helpful? Give feedback.
-
|
完成了对vga驱动的颜色显示和等级控制,结果如下: 首先在ulib/axstd/src/macros.rs中添加了pinfo!, pdev!, pdebug!三个宏来支持debug模式的三个等级的输出。 |
Beta Was this translation helpful? Give feedback.
-
|
实现vga彩色显示功能和日志级别控制 |
Beta Was this translation helpful? Give feedback.
-
|
实现了 pinfo,pdev,pdebug |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
实现 pinfo ,pdev, pdebug 函数 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.


































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引导成功并显示文字
Beta Was this translation helpful? Give feedback.
All reactions