Page 1 of 3
What should I do before switching to Protected or long-mode
Posted: Fri Oct 07, 2011 9:48 am
by Holus
So far:
1. I checked the memory so I know what limits my memory-manager has.
2. I checked the bootdevice so I can define how to read from it to set-up other hardware.
Is there more main functions I should check using BIOS interrupts, because it's almost impossible in PROTECTED-MODE or LONG-MODE?
Re: What should I do before switching to Protected or long-m
Posted: Fri Oct 07, 2011 10:57 am
by Casm
Holus wrote:So far:
1. I checked the memory so I know what limits my memory-manager has.
2. I checked the bootdevice so I can define how to read from it to set-up other hardware.
Is there more main functions I should check using BIOS interrupts, because it's almost impossible in PROTECTED-MODE or LONG-MODE?
You don't have to use the BIOS to scan the PCI bus, but you can do so. In any case, if you later think of something which should have gone into your real mode boot code, you can simply go back and put it in. I have a structure, containing various pieces of useful information, which I pass to the kernel. So if needed I could just add some extra fields to that, and pass any newly acquired info to the kernel.
Re: What should I do before switching to Protected or long-m
Posted: Fri Oct 07, 2011 11:25 am
by Holus
Casm wrote:
You don't have to use the BIOS to scan the PCI bus, but you can do so. In any case, if you later think of something which should have gone into your real mode boot code, you can simply go back and put it in. I have a structure, containing various pieces of useful information, which I pass to the kernel. So if needed I could just add some extra fields to that, and pass any newly acquired info to the kernel.
I'm the @$$ who still want to "HOPE" the bootloader is 1 stage of 0x200 bytes.
I hope it's small if i find some thing.
Scanning PCI is an already build function. But thanks for the sugestion.
Re: What should I do before switching to Protected or long-m
Posted: Fri Oct 07, 2011 12:32 pm
by Chandra
1. Enable A20
2. Get the memory map
3. Scan for a list of available fundamental devices attached to the system.
4. Switch to some high res graphics, if you need to.
5. Load the 2nd stage loader, modules or the kernel off the disk.
6. ...
The whole setup depends upon your requirement, of course.
Cheers.
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 4:17 am
by Holus
Chandra wrote:1. Enable A20
2. Get the memory map
3. Scan for a list of available fundamental devices attached to the system.
4. Switch to some high res graphics, if you need to.
5. Load the 2nd stage loader, modules or the kernel off the disk.
6. ...
The whole setup depends upon your requirement, of course.
Cheers.
Setting the graphics is a real good one!! Thanks. I try to find some information about setting a propper VESA mode but all articles set it bij INT 0x10.
There must be a way setting the state bij using the ports. I need it somewere in the year 2057 when someone develloped the first programm for my OS. But setting it and not changing the state is a good advise for now.
Thanks
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 11:24 am
by Holus
Chandra wrote:1. Enable A20
2. Get the memory map
3. Scan for a list of available fundamental devices attached to the system.
4. Switch to some high res graphics, if you need to.
5. Load the 2nd stage loader, modules or the kernel off the disk.
6. ...
The whole setup depends upon your requirement, of course.
Cheers.
Does someone know how to switch banks in Pmode (no bios INT 0x10) using the IO PORTS.
Is it a standaard routine or is it card specific?
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 11:35 am
by rdos
The only standard that exists for video-mode switching, and that is widely adopted, is int 0x10 from real-mode / V86 mode. There was an EGA/VGA standard for doing graphics, but not even that standard defined how to switch modes with IO-instructions. It was (and still is) int 0x10 that do that.
If one don't want to have a fixed graphics resolution, there is a need to support V86-mode in order to be able to switch video-mode once the kernel is started. It's not too hard to support on newer processors that has V86 extensions.
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 12:02 pm
by Holus
I found something very usefull ([-X )!!
Good old interupts!!!
http://www.delorie.com/djgpp/doc/rbinter/id/92/2.html
http://www.delorie.com/djgpp/doc/rbinter/id/93/2.html
But the function is not supported on my computer
So i wouldn't use it is you want me as a costumer
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 12:37 pm
by Chandra
Holus wrote:Chandra wrote:1. Enable A20
2. Get the memory map
3. Scan for a list of available fundamental devices attached to the system.
4. Switch to some high res graphics, if you need to.
5. Load the 2nd stage loader, modules or the kernel off the disk.
6. ...
The whole setup depends upon your requirement, of course.
Cheers.
Does someone know how to switch banks in Pmode (no bios INT 0x10) using the IO PORTS.
Is it a standaard routine or is it card specific?
VESA3.0 does provide the protected mode interface but it still doesn't employ the use of ports. On the other hand, bank switching is slow and troublesome so you've better just go on with the Linear Frame Buffer(VESA2.0)
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 1:48 pm
by DavidCooper
Holus wrote:I try to find some information about setting a propper VESA mode but all articles set it bij INT 0x10.
There must be a way setting the state bij using the ports.
ij lijk your Dutch spellings, but whij stop at bij?
Re: What should I do before switching to Protected or long-m
Posted: Sat Oct 08, 2011 3:45 pm
by Combuster
rdos wrote:There was an EGA/VGA standard for doing graphics, but not even that standard defined how to switch modes with IO-instructions.
That's nonsense. The VGA
is the standard, and any device that's compatible with it can be modechanged with the same I/O instructions that work on an original VGA. What you are probably referring to are the few graphics devices from that era that tried to be a VGA wannabe and sucked at it (and therefore are by definition NOT VGA-compatible).
In fact, a VGA driver is the most effective native graphics driver to write due to the abundant information and example code, and the fact that even now practically all machines still have support for it. You just won't be able to get high resolutions or high bitdepths with it. As a nice bonus, PCI video cards will actually tell you if they are VGA compatible.
Re: What should I do before switching to Protected or long-m
Posted: Sun Oct 09, 2011 2:22 am
by Holus
Chandra wrote:
VESA3.0 does provide the protected mode interface but it still doesn't employ the use of ports. On the other hand, bank switching is slow and troublesome so you've better just go on with the Linear Frame Buffer(VESA2.0)
Maybe I'm not capable of searching,.. Can you point me to a URL about these VESA 3.0 functions. My graphical card is VESA 3.0 (should be 2.x+ and support that function BUT NO!!!)
Isn't it that bank-switching is slow because you use DMA and you GPU and with Linear Frame Buffer it's quick because you use your CPU? (isn't that from a time when the Graphical Cards where slow in de 80's)
I'm making an OS for a DATABASE and no full-hd moviestreamer. Isn't bank-switching better for me? (less CPU and more GPU is better for me)
Re: What should I do before switching to Protected or long-m
Posted: Sun Oct 09, 2011 2:51 am
by Combuster
That spec isn't too hard to find
VBE3 supports linear framebuffers just as well as VBE2 cards do. One of the key differences is that the protected mode interface has been overhauled (and therefore, often missing). Not that VBE2 cards did a good job at that either.
Holus wrote:isn't that from a time when the Graphical Cards where slow in de 80's
As for the linear framebuffer, the only difference is that you have limited addressing space to write your memory to, and therefore have to use port IO (which is the actual slow part) to change the video card's internal addressing, as well as having to modify your drawing functions to the framebuffer to move the window where needed, adding more checks. Also, modern framebuffers can be set to be cached, while this can't be safely done for the VGA range, making the advantage of using the LFB even greater.
Therefore, everyone here that's using a 32-bit os and is sane, avoids bankswitching like the plague.
And that has nothing to do with a GPU, you need native drivers to do anything with that, and the BIOS won't do that for you.
EDIT: source got edited away. Nevertheless:
Holus wrote:LOL I speak alle Sprachen door elkaar. Heureusement, il est entendu
Ils are 馬鹿, diesen mensen.
Re: What should I do before switching to Protected or long-m
Posted: Sun Oct 09, 2011 4:50 am
by Holus
Combuster wrote:VBE3 supports linear framebuffers just as well as VBE2 cards do. One of the key differences is that the protected mode interface has been overhauled (and therefore, often missing). Not that VBE2 cards did a good job at that either.
What is the best way to enable the "linear framebuffer"?
So if I anable it and look at the PCI - BAR there is no trobble with VIDEO anymore?
If I set a VIDEO mode like.
1900x1200x32bit
The computer allocates BASE ADDRESS .. BASE ADDRESS + 0x8B2900 for VIDEO memory??
I see it's taken C0000000-CFFFFFFF now.
That's a loss of 100 MB of RAM??
UUUUUUH I don't have C0000000 bytes of ram
Is this actual added DIRECT video memory????
Is there a way to disable all the memory locations I don't want to use. Unlink the DMA at A0000 for example.
Re: What should I do before switching to Protected or long-m
Posted: Sun Oct 09, 2011 6:53 am
by Chandra
Holus wrote:What is the best way to enable the "linear framebuffer"?
Set Bit 14 in BX when calling Int 0x10.
(AX=4F02H, BX=Mode No. with bit 14 set)
Holus wrote:So if I anable it and look at the PCI - BAR there is no trobble with VIDEO anymore?
Not sure what you mean by that. You may want to check spellings and grammar.
Holus wrote:If I set a VIDEO mode like.
1900x1200x32bit
Forget it. It's hardly supported by any VESA Standard.
Holus wrote:I see it's taken C0000000-CFFFFFFF now.
That's a loss of 100 MB of RAM??
UUUUUUH I don't have C0000000 bytes of ram
C0000000 is the virtual address. Even if you have 16 Megabytes of RAM, you may still address this portion of Memory(depending on which portion of the memory is mapped for Input/Output). I recommend you get a comprehensive look at
Memory Mapped Input Output.