Hi Michal,
Based on this line here, https://github.com/GaloisInc/seL4/commit/caac4b936f2f2f0fb349bd5fdb4ea8d87f0... you use the VGA alphanumeric mode framebuffer's raw physical address for your mini driver. This is fine in the kernel boot process for as long as the kernel maintains its identity mapping of RAM.
Unfortunately, eventually during boot, since it's wasteful for the kernel to maintain the identity mapping, the kernel gets rid of it during `map_kernel_window()`, while it is establishing the kernel window mapping. From that point onward, the kernel has to access RAM as offsets into the kernel's window mapping.
The point at which the code on your branch fails is specifically here: https://github.com/GaloisInc/seL4/blob/master/src/arch/x86/kernel/boot_sys.c...
If you insert the following code:
printf("This line is executed successfully.\n"); for (;;);
Before line 202, it will work fine and you'll see your printf output and execution will halt as the infinite loop gets executed. If you put it after line 202, the kernel will crash. This is because `map_kernel_window()` gets called just before line 202, and the processor "sees" the changes that were made by line `map_kernel_window()` only after line 202.
To solve your issue, you can make your VGA driver work such that inside of map_kernel_window(), you dynamically change the address the driver writes to from 0xB8000 to an address in the kernel window. To get a kernel window address, you can use `ptrFromPAddr()`.
--
Kofi Doku Atuah
Kernel engineer
DATA61 | CSIRO
________________________________
From: Devel
Assuming you are talking about text mode VGA then having the kernel render to such a buffer is not particularly difficult. Instead of the 0xB8000 address though I would consider using the supposed multiboot video mode, and perhaps falling back to the buffer at 0xB8000 if no multiboot video mode provided, that would provide the most reliability. You will need to * Emulate the vt100 codes in the seL4 messages, or disable colored output (which I believe is all we use control codes for) * Handle end of line detection and scrolling Whilst not using multiboot an old slightly bitrotted user level example of what you are proposing is https://github.com/seL4/util_libs/blob/master/libplatsupport/src/plat/pc99/e...
If you want to use a linear graphics mode though (and you don't want to change display modes later on) then obviously it's a little more complicated as you'll have to do font rendering. Not that rendering the equivalent of a monospaced text mode onto a linear graphics mode is particularly difficult though. Note that we currently have not written graphics support beyond the multiboot graphics mode that the kernel can request from its loader, in particular we do not have any code that would allow you to change the screen mode later on at user level.
Like I said before I am planning to exclusively use a linear framebuffer rather than hardware text mode (which is a relic from an era when hardware wasn't powerful enough to do software text modes with reasonable performance, and I believe it's not supported at all under UEFI), and I'm planning to have it just emulate a dumb terminal (i.e. no escape codes; I don't want to bloat the kernel with a VT100 emulator just for displaying early boot messages). I was thinking of using the framebuffer console code from coreboot's libpayload (which only emulates a dumb terminal and is very lightweight).
Asking the kernel to stop using its debug output device, to allow the user to start using wholly for its own purposes, is something that could be useful to add. Probably would have to be another 'debug' syscall, and could function as a dynamic enabling/disabling of kernel printing.
I was going to have the kernel automatically disable the early console immediately before it loads the root server, so there would be no need for an API (at least not under UX/RT). UX/RT's root server will contain its own early console emulator (possibly also based on that of libpayload) that will provide a minimal subset of a Unix terminal device to programs run during early boot (initializing the console emulator will be the first thing that the root server does). A full-featured DRM/DRI graphics driver and console emulator will take over before the root volume is mounted. _______________________________________________ Devel mailing list Devel@sel4.systems https://sel4.systems/lists/listinfo/devel _______________________________________________ Devel mailing list Devel@sel4.systems https://sel4.systems/lists/listinfo/devel