Q: Vesa and long mode ?...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
madtirra
Posts: 6
Joined: Tue Nov 04, 2008 4:43 am

Q: Vesa and long mode ?...

Post 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.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Q: Vesa and long mode ?...

Post 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
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Q: Vesa and long mode ?...

Post 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.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Q: Vesa and long mode ?...

Post 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).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
madtirra
Posts: 6
Joined: Tue Nov 04, 2008 4:43 am

Re: Q: Vesa and long mode ?...

Post 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.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Q: Vesa and long mode ?...

Post 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 :wink: .

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
madtirra
Posts: 6
Joined: Tue Nov 04, 2008 4:43 am

Re: Q: Vesa and long mode ?...

Post 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 ...
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Q: Vesa and long mode ?...

Post 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) :(
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
madtirra
Posts: 6
Joined: Tue Nov 04, 2008 4:43 am

Re: Q: Vesa and long mode ?...

Post 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 ;(
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Q: Vesa and long mode ?...

Post 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
madtirra
Posts: 6
Joined: Tue Nov 04, 2008 4:43 am

Re: Q: Vesa and long mode ?...

Post 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.
Post Reply