Page 1 of 1
Q: Vesa and long mode ?...
Posted: Tue Nov 04, 2008 4:51 am
by madtirra
Hello folks,
I have a question to somebody who knowns about vesa and long mode (amd64).
The main thing in vesa - it's a vesa bios calls, but while you are in long mode you not able to call this functions.
So, I have a microkernel OS, microkernel can allow userspace task to become driver - I mean I can handle an hardware interrups, allocate IO pages, allocate IO ports.
The questions is - can I implement vesa driver without VESA bios calls (using io ports and io pages) ?
Thank you.
Re: Q: Vesa and long mode ?...
Posted: Tue Nov 04, 2008 5:12 am
by AJ
Hi,
The most common way of doing this seems to be switching modes at boot time only. If you create a mode with a LFB, you dont need to switch planes.
Another alternative which would need a quite fully fledged OS would be to use emulation or virtualisation to run the necessary BIOS code. This would require some serious thought about security, though (which ports do emulate access to? do you allow any RM code to run outside of the BIOS area?).
My advice to start with is use a LFB!
Cheers,
Adam
Re: Q: Vesa and long mode ?...
Posted: Tue Nov 04, 2008 10:59 am
by Owen
If your system has support for VESA in protected mode, then you could always create GDT entries for 32-bit processes and use 32-bit code to access VESA. How you implement this will be heavily kernel dependent.
Re: Q: Vesa and long mode ?...
Posted: Tue Nov 04, 2008 11:09 am
by Love4Boobies
He mentioned he's using long mode. AFAIK there's no support for VBE in long mode. You DO have compatibility mode, but I'm not sure about changing the video mode. That could proove tricky (but not impossible).
Re: Q: Vesa and long mode ?...
Posted: Wed Nov 05, 2008 4:27 am
by madtirra
AJ wrote:Hi,
The most common way of doing this seems to be switching modes at boot time only. If you create a mode with a LFB, you dont need to switch planes.
Another alternative which would need a quite fully fledged OS would be to use emulation or virtualisation to run the necessary BIOS code. This would require some serious thought about security, though (which ports do emulate access to? do you allow any RM code to run outside of the BIOS area?).
My advice to start with is use a LFB!
Cheers,
Adam
Boot time switching is a not good idea , microkernel shouldn't know anything about hardware as it possible. You can look out my project -
http://jarios.org where you can find general concept.
Virtualization is another thing that makes true microkernel architecture worse (I mean tricks like compatibility mode or smth else).
LFB == Linux Framebuffer ? if yes, I cannot use it anyway.
I've heard that it's possible to use VGA (sVGA) ports to switch mode ...
Maybe some solution can be found in xorg vesa driver, anyway vesa bios calls it's a really worse solution in general case.
Re: Q: Vesa and long mode ?...
Posted: Wed Nov 05, 2008 4:48 am
by AJ
madtirra wrote:
LFB == Linux Framebuffer ? if yes, I cannot use it anyway.
I've heard that it's possible to use VGA (sVGA) ports to switch mode ...
LFB == Linear Frame Buffer, so you can use it

.
I know of ways to switch VGA mode without using the BIOS (
like here), but not SVGA modes. There are also some other links on the wiki and I'm certain there will be some old forum posts that could provide you with some answers.
Combuster tends to be pretty good at this VGA stuff, so maybe he has some ideas...
Cheers,
Adam
Re: Q: Vesa and long mode ?...
Posted: Wed Nov 05, 2008 5:01 am
by madtirra
Oh, sorry ... LFB == Linear frame buffer - so, I can assume how to works with video memory within long mode - it's a trivial.
The main problem it's a mode switching ...
Re: Q: Vesa and long mode ?...
Posted: Wed Nov 05, 2008 8:13 am
by Combuster
Combuster tends to be pretty good at this VGA stuff, so maybe he has some ideas...
VGA isn't quite the same as VESA. VGA isn't good for getting above 640x480x4, let alone higher bit depths.
If you really want to use VESA you'll have to run the BIOS code in some way or another, like running it before entering pmode, or emulating it one way or another. (v8086, hypervisor, interpreter)

Re: Q: Vesa and long mode ?...
Posted: Wed Nov 05, 2008 9:41 am
by madtirra
Combuster wrote:Combuster tends to be pretty good at this VGA stuff, so maybe he has some ideas...
VGA isn't quite the same as VESA. VGA isn't good for getting above 640x480x4, let alone higher bit depths.
If you really want to use VESA you'll have to run the BIOS code in some way or another, like running it before entering pmode, or emulating it one way or another. (v8086, hypervisor, interpreter)

I'm afraid about other video cards drivers. I have a look to xorg video drivers - and I'm not so happy with it - xf86int10 mostly used.
So, I think that microkernel will be extended with faked vm86, anyway most of things can be done via uspace libs.
Hardware design makes software design ugly ;(
Re: Q: Vesa and long mode ?...
Posted: Wed Nov 05, 2008 10:41 am
by AJ
madtirra wrote:Hardware design makes software design ugly ;(
I sometimes get a bit annoyed with that too. The way you can mitigate this is by making your external interfaces neat and clearly defined so that you can take pride in clearing up the mess that is the PC architecture
I know a bit more about your design now (have seen your web site), but are you
really dead set against passing some video mode information from the boot loader to your kernel? If you pre-set a video mode at boot time and pass the info to the kernel? If you did, you could start the HW server with a "command-line parameter" containing mode info. If the HW server detects a dedicated driver for the video card, it can use that. If not, it can use the fall back VESA driver in the known boot-time resolution.
Cheers,
Adam
Re: Q: Vesa and long mode ?...
Posted: Fri Nov 07, 2008 7:54 am
by madtirra
AJ wrote:madtirra wrote:Hardware design makes software design ugly ;(
I sometimes get a bit annoyed with that too. The way you can mitigate this is by making your external interfaces neat and clearly defined so that you can take pride in clearing up the mess that is the PC architecture
I know a bit more about your design now (have seen your web site), but are you
really dead set against passing some video mode information from the boot loader to your kernel? If you pre-set a video mode at boot time and pass the info to the kernel? If you did, you could start the HW server with a "command-line parameter" containing mode info. If the HW server detects a dedicated driver for the video card, it can use that. If not, it can use the fall back VESA driver in the known boot-time resolution.
Cheers,
Adam
Yes, I know, but anyway it's a not so good solution.
The better way is an implementation of vm86 in user space like a library - there are some existing solution (on L4 microkernel) -
http://svn.tudos.org/repos/tudos/trunk/l4/pkg/x86emu/
Idea - port it to Jari OS , looks like a very good idea
thanks anyway
PS you can look out this -
http://jarios.org/doku.php?id=showcase to make a sense of Jari OS progress.