Emulating BIOS for VBE
Emulating BIOS for VBE
I think I will start on this now that I've solved the USB-issues. In order to be able to boot from UEFI, I first must remove the reliance my VBE driver has on the real BIOS.
One way to do this would be to take some emulator BIOS and run it in an emulator, but I find this both slow and overkill. I don't think the VBE requires many of the fancy BIOS functions. Thus, I instead plan to run a virtual BIOS in VM86-mode.
If I implement the card-detection & startup procedure that the BIOS normally does at boot, and set all interrupts to go to a dummy interrupt handler that contains an "int 3", I can figure out what really is needed. Then I should probably also initialize the BDA to something reasonable.
Somebody should already have done this, but I guess the big OSes either use the emulator approach, or has non-open source code.
One way to do this would be to take some emulator BIOS and run it in an emulator, but I find this both slow and overkill. I don't think the VBE requires many of the fancy BIOS functions. Thus, I instead plan to run a virtual BIOS in VM86-mode.
If I implement the card-detection & startup procedure that the BIOS normally does at boot, and set all interrupts to go to a dummy interrupt handler that contains an "int 3", I can figure out what really is needed. Then I should probably also initialize the BDA to something reasonable.
Somebody should already have done this, but I guess the big OSes either use the emulator approach, or has non-open source code.
Re: Emulating BIOS for VBE
This does not sound very good. Why do you want to have such an unrealiable hack? It will not work very long. Use Graphics Output Protocol (GOP) or write native drivers.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Emulating BIOS for VBE
You'll find the (ratsnest) of code which implements VBE on both PC+BIOS and NonPC at the int10 section of the XOrg source
Re: Emulating BIOS for VBE
I need it in order to be able to boot from UEFI, since my current code depends on it. In addition to that, I want to avoid GOP as long as possible, and hope that video cards will continue to support VBE even in the absence of a BIOS which can enable it.Antti wrote:This does not sound very good. Why do you want to have such an unrealiable hack? It will not work very long. Use Graphics Output Protocol (GOP) or write native drivers.
In fact, I don't see how GOP could work with a random video-card without some kind of code in the video card, which I suspect is the VBE interface today. I don't think that GOP will provide native drivers for every imaginable video-card. It might in laptops, but not in stationary computers that can use an external video-card.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Emulating BIOS for VBE
GOP works the same way VBE does. That is, the card provides the driver in an option ROM!
Just, this time the driver is a UEFI driver rather than a VBE one.
Just, this time the driver is a UEFI driver rather than a VBE one.
Re: Emulating BIOS for VBE
rdos wrote:I think I will start on this now that I've solved the USB-issues. In order to be able to boot from UEFI, I first must remove the reliance my VBE driver has on the real BIOS.
One way to do this would be to take some emulator BIOS and run it in an emulator, but I find this both slow and overkill. I don't think the VBE requires many of the fancy BIOS functions. Thus, I instead plan to run a virtual BIOS in VM86-mode.
If I implement the card-detection & startup procedure that the BIOS normally does at boot, and set all interrupts to go to a dummy interrupt handler that contains an "int 3", I can figure out what really is needed. Then I should probably also initialize the BDA to something reasonable.
Somebody should already have done this, but I guess the big OSes either use the emulator approach, or has non-open source code.
Edit: Wait Nvm, your trying to use UEFI. In that case your only hope is an emulator..
Re: Emulating BIOS for VBE
On my Sony Vaio portable, it works with an empty int 15 handler. The video initialization routine (0xC000:0x0003) calls the int 15 handler with AH=5F a couple of times (which I return unsupported function for), and then gives up. When I call the video mode change, nothing else happens, and it works very well. Will test on some other computers as well to see if it is as simple as that.
Re: Emulating BIOS for VBE
Not so. I map the first page in VM86 mode to default interrupt vectors + a dummy int 15 + a zeroed BDA. Then I provide a BIOS which only calls the video initialization entry-point (C000:0003), and returns.PearOs wrote:Edit: Wait Nvm, your trying to use UEFI. In that case your only hope is an emulator..rdos wrote:I think I will start on this now that I've solved the USB-issues. In order to be able to boot from UEFI, I first must remove the reliance my VBE driver has on the real BIOS.
One way to do this would be to take some emulator BIOS and run it in an emulator, but I find this both slow and overkill. I don't think the VBE requires many of the fancy BIOS functions. Thus, I instead plan to run a virtual BIOS in VM86-mode.
If I implement the card-detection & startup procedure that the BIOS normally does at boot, and set all interrupts to go to a dummy interrupt handler that contains an "int 3", I can figure out what really is needed. Then I should probably also initialize the BDA to something reasonable.
Somebody should already have done this, but I guess the big OSes either use the emulator approach, or has non-open source code.
After that I call int 0x10 with AL=3 to set video mode to text. I do this before PCI initialization. UEFI can do nothing about this as long as there is a video BIOS at C000. UEFI is only software, and thus must initialize the video BIOS itself, which I then redo to my own preferences.
Re: Emulating BIOS for VBE
Interesting. I will have to remember that when I attempt UEFI some day.. *shudder*rdos wrote:Not so. I map the first page in VM86 mode to default interrupt vectors + a dummy int 15 + a zeroed BDA. Then I provide a BIOS which only calls the video initialization entry-point (C000:0003), and returns.PearOs wrote:Edit: Wait Nvm, your trying to use UEFI. In that case your only hope is an emulator..rdos wrote:I think I will start on this now that I've solved the USB-issues. In order to be able to boot from UEFI, I first must remove the reliance my VBE driver has on the real BIOS.
One way to do this would be to take some emulator BIOS and run it in an emulator, but I find this both slow and overkill. I don't think the VBE requires many of the fancy BIOS functions. Thus, I instead plan to run a virtual BIOS in VM86-mode.
If I implement the card-detection & startup procedure that the BIOS normally does at boot, and set all interrupts to go to a dummy interrupt handler that contains an "int 3", I can figure out what really is needed. Then I should probably also initialize the BDA to something reasonable.
Somebody should already have done this, but I guess the big OSes either use the emulator approach, or has non-open source code.
After that I call int 0x10 with AL=3 to set video mode to text. I do this before PCI initialization. UEFI can do nothing about this as long as there is a video BIOS at C000. UEFI is only software, and thus must initialize the video BIOS itself, which I then redo to my own preferences.
Edit: But wait, one Video Bios doesn't work with every board does it?
Thanks, Matt
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Emulating BIOS for VBE
Repeating what I said earlier: the graphics card provides the video BIOS. It also provides the video UEFI.
Re: Emulating BIOS for VBE
Possible. However, if you plug in the video card in a stationary PC in some PCI-slot, then the systems UEFI has no idea about the card, and the card thus cannot provide the GOP. The only thing it provides is a VBE BIOS. Which means the systems UEFI must use VBE to provide GOP.Owen wrote:Repeating what I said earlier: the graphics card provides the video BIOS. It also provides the video UEFI.
Re: Emulating BIOS for VBE
Confirmed that this also works on another laptop with an Intel Atom processor. Seems like most modern video BIOS doesn't use anything else than int 15, AH=5F in their initialization code, which makes it very easy to put them in VBE-mode. On older PCs it doesn't matter as those have no UEFI, and thus has to be booted with BIOS, and then the usual VBE driver which uses the real BIOS is more suitable.
Re: Emulating BIOS for VBE
I was going to make a new thread, but I saw this thread floating at the top and since my question is slightly related I figured why not just ask here.
Question is, anyone know if I can use the uefi setmode services for GOP to get the same resolution that my card offers using vesa/vbe?
Question is, anyone know if I can use the uefi setmode services for GOP to get the same resolution that my card offers using vesa/vbe?
Re: Emulating BIOS for VBE
Adding an error return for int 15, AH=4E, and I can run on two stationary AMD-based computers as well, one of them at least 5 years old. It seems like this is a working concept, and no emulator is needed. The virtual BIOS is only some 50 bytes long
Re: Emulating BIOS for VBE
I don't know, but I suspect the answer should be "yes". At least I don't think GOP will offer more resolutions than VBE, especially if GOP gathers information from VBE.devsau wrote: Question is, anyone know if I can use the uefi setmode services for GOP to get the same resolution that my card offers using vesa/vbe?