-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VESA video mode - 800x600x16bit #60
Conversation
Thanks a lot for tackling this! We don't want to hard code the video mode for the user, but instead make it configurable through cargo features. We currently support vga text mode and a simple vga graphics mode (320x200). Could you place the VESA code in a new file in |
Sure thing! |
Thanks, looks good now! Were you able to print something to the screen through this? I just tried to update the |
I meant to ping you, I actually was hoping to get some help with testing printing with the new video mode. I should be able to get you the framebuffer address. |
Sure! Printing should work similar to the vga_320x200 module, we only need the framebuffer address and the pixel format (i.e. how many bytes per pixel, how are the RGB channels encoded). |
I found the framebuffer address for qemu: 0xFD000000. The pixel format is 5 red bits, 6 green, and 5 blue bits. I'm still having issues trying to modify vga_320x200 to print correctly |
@jabedude Thanks! The problem was that we need to add a page table mapping for the physical address I didn't add any code for color handling, so the colors are a bit strange. I deliberately didn't paint the screen back in |
Here's what I'm wondering: will this bootloader be modified sometime
to make it possible to boot on real hardware? It seems like the
bootloader goes off virtualized/emulated addresses, at least for
anything that's not 0xb8000. I would love to be able to boot my kernel
on real hardware with this thing!
If not, how can I get it to do that?
…On 7/6/19, Philipp Oppermann ***@***.***> wrote:
@jabedude Thanks! The problem was that we need to add a page table mapping
for the physical address `0xFD000000` to the page table. I pushed a commit
(I hope that is fine with you) that maps the framebuffer to the 500th entry
of the level 2 page table. It also adds a new printer, which is the
vga_320x200 printer with some modifications. Now it looks like this:
![image](https://user-images.githubusercontent.com/1131315/60753915-cac2e280-9fd9-11e9-86f1-f3c38388002a.png)
I didn't add any code for color handling, so the colors are a bit strange. I
deliberately didn't paint the screen back in `clear_screen` so that we see
that really the whole screen is blanked.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#60 (comment)
--
Signed,
Ethin D. Probst
|
@ethindp For me the bootloader already works on real hardware. What problems do you have exactly? Also, could you elaborate your statement about "virtualized/emulated addresses"? Since you replied to this pull request, I assume that you mean using the address |
Aha, I see. Well, I was following yorublog_os tutorial and wanted to
make an ISO with it. I might've passed the wrong args to mkisofs, but
I created the IsO and the bootloader got stuck on stage 1 (I think
that there is an issue for this).
…On 7/6/19, Philipp Oppermann ***@***.***> wrote:
@ethindp For me the bootloader already works on real hardware. What problems
do you have exactly?
Also, could you elaborate your statement about "virtualized/emulated
addresses"? Since you replied to this pull request, I assume that you mean
using the address `0xFD000000`? This is just a stop-gap solution for
experimentation, the plan is to query this address from the VESA later.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#60 (comment)
--
Signed,
Ethin D. Probst
|
Have you tried the instructions at https://os.phil-opp.com/minimal-rust-kernel/#real-machine? The As a side note: Can we continue the conversation in a new issue? This issue issue is about adding support for the VESA video mode, so I think a separate issue would fit better. |
@phil-opp That is awesome! Of course, I was hoping to collaborate in this PR (I have no prior experience with VESA/BIOS printing). |
@jabedude Great! I updated the PR description with a todo list. Do you think anything else is missing? |
The TODOs look good to me! I pushed a commit to query the framebuffer address, but I'm not sure the best way to test that. Related to the third TODO, how can I get access to the |
I think we can do the same as in Lines 66 to 77 in b5d43ca
VESAfb and then pass as argument to load_elf . To use it in the printer, we need to initialize it at runtime with the given framebuffer address, e.g. through an init method.
|
} | ||
} | ||
} | ||
_ => panic!("unprintable character"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please dont panic in this case. Maybe print ?
or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
I realise this code doesn't actually contain a Mutex lock on the writer, so my previous comment is misguided, but generally yes - a substitute character is probably the way to go.
Thinking about this, for flexibility we probably want to load an entire VBEModeInfo struct into the kernel space so we have flexibility for choosing different modes in the bootloader. The framebuffer mapping to virtual memory currently hardcodes the framebuffer address for qemu and the size for an 800x600x16 mode, so getting it to work with an arbitrary framebuffer address (e.g. from real hardware) using the vbe mode info is a bit harder. I've been working on it on and off for the last couple weeks and am wondering if it would be easier or even possible to do the memory mapping from the rust code, or if it has to be done while in protected mode stage 3 before we jump to the kernel loading. |
Hate to go OT, but would it be possible for me to boot my kernel using
Grub? Or would that not work (i.e. if I were to use grub-mkrescue)?
…On 8/10/19, Aaron Deadman ***@***.***> wrote:
> I think we can do the same as in
>
> https://github.com/rust-osdev/bootloader/blob/b5d43caa72173b502dd1eabcee29d534ef24741a/src/main.rs#L66-L77
>
> to get access to `VESAfb` and then pass as argument to `load_elf`. To use
> it in the printer, we need to initialize it at runtime with the given
> framebuffer address, e.g. through an `init` method.
Thinking about this, for flexibility we probably want to load an entire
VBEModeInfo struct into the kernel space so we have flexibility for choosing
different modes in the bootloader.
The framebuffer mapping to virtual memory currently hardcodes the
framebuffer address for qemu and the size for an 800x600x16 mode, so getting
it to work with an arbitrary framebuffer address (e.g. from real hardware)
using the vbe mode info is a bit harder. I've been working on it on and off
for the last couple weeks and am wondering if it would be easier or even
possible to do the memory mapping from the rust code, or if it has to be
done while in protected mode stage 3 before we jump to the kernel loading.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#60 (comment)
--
Signed,
Ethin D. Probst
|
@ethindp See https://github.com/rust-osdev/bootloader/blob/master/doc/chainloading.md and #49. In the future, please just open a new issue instead of commenting on an unrelated issue. |
If we don't access it before the mapping, we can probably map it later. However, we need to adjust our panic printer for that (i.e. it shouldn't try to print to the VESA framebuffer before it is mapped). |
Hello all, this PR checks if VESA 2.0 or 3.0 is supported and then enables it with fixed 800x600. This is very rough, so please let me know what else we need to do.
TODO: