rust-osdev / bootloader

An experimental pure-Rust x86 bootloader
Apache License 2.0
1.31k stars 204 forks source link

Printing to VGA crashes qemu #198

Closed Brian3647 closed 2 years ago

Brian3647 commented 2 years ago

Sample code: https://github.com/Brian3647/rust-bootloader-issue

bjorn3 commented 2 years ago

Bootloader 0.10 doesn't use vga text mode anymore. It sets up a framebuffer instead whose address is stored in boot_info.framebuffer. You have to rasterize a font and write the raw pixels or use the serial port instead.

Brian3647 commented 2 years ago

@bjorn3 do you know any tutorial or something I can follow to do that?

bjorn3 commented 2 years ago

https://github.com/rust-osdev/bootloader/blob/0f7f78382a8021f81d66fb149ab98a441a47a6c0/src/binary/logger.rs uses the font8x8 crate to write to the framebuffer.

https://github.com/rust-osdev/bootloader/blob/2bdc5ac8e0fd658cc30aecbe7b0aed8d1521cb04/examples/basic/src/main.rs show how to use boot_info.framebuffer to get the framebuffer address.

Brian3647 commented 2 years ago

@bjorn3 thanks!