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.
Sorry for my alot of Question ;D. but I am not a real mode programmer .
I need now to get a list of all supported vesa mode.
I have define the VESA Info structure and got the VESA Signature "VESA" and far pointer for available mode "VideoModePtr" (example 0x100C000, linear 0xD000).
VBE Far Pointers Throughout this specification references will be made to a pointer of the type `vbeFarPtr'.
This isa DWORD pointer that can have two different interpretations depending on whether the BIOS is being called via the real mode INT 10h software interrupt, or via the protected mode entry point.
When functions are called via the real mode INT 10h software interrupt, a `vbeFarPtr' will be a real mode segment:offset style pointer to a memory location below the 1Mb system memory boundary.
When functions are called via the protected mode entry point, a `vbeFarPtr' will be a valid 16-bit protected mode selector:offset style pointer, the selector of which may point to the base of the protected mode BIOS image loaded in memory, user data passed in to the protected mode BIOS or to the information blocks passed in to the protected mode BIOS. In any case the calling application and BIOS can simply reference the pointer as a 32-bit far pointer to access the data, but should avoid doing any real mode specific pointer arithmetic on the selector:offset values.
So it sounds like my assumption on what "modes pointer" was was wrong. Especially if you got the list from the VBE protected mode interface (now how did *GRUB* get it is another tricky question ...)
amirsadig wrote:
(example 0x100C000, linear 0xD000).
waitaminute ... is "0x100c000" a value you actually get for the mode pointer ? if this is the case, i rather expect it to code C000:0100 than 0100:C000, knowing that the video rom is located at C000:xxxx ...
<please ignore>
Yep. That might be it. When you encode some pointer by hand (for instance for the jump far hack at TASM), you always tell the segment DWORD first, so the lowest part of the dword is the realmode segment and the highest part is the offset ...
</ignore>
Sorry. It looks like i was wrong. all encodings put offset first, then segment, including LxS, IVT, etc.
yes my Data Segment base is 0 and 0x100C000 is what I get from the VESA BIOS return. I get also as I said the Signatur "VESA". that mean I get the correct structure.
I could query getting VESA Mode info (function 02) begining from mode number 0x100 to 0x200 or maximum, which can be used. I think 0x200 will be enough.
so I can get what is supported and save them on linked list to use them to switch between modes.
in performance it is not very dramaticaly, becaue I should also query all geting mode from the vbeFarPtr to get Xresolu...., which are not standard. every mode number on different VBE implementation can set different modes.
I do not use now function 00 to get available modes, I use it only to check if VESA is suported.
for geting Modes I query between 0x100 to 0x200 all available mode (function 01 ) and save them on modes database (linked list).
so I can jump between Modes as requered later ( when building the GUI)
CRTCInfoBlock struc
HorizontalTotal dw ? ; Horizontal total in pixels
HorizontalSyncStart dw ? ; Horizontal sync start in pixels
HorizontalSyncEnd dw ? ; Horizontal sync end in pixels
VerticalTotal dw ? ; Vertical total in lines
VerticalSyncStart dw ? ; Vertical sync start in lines
VerticalSyncEnd dw ? ; Vertical sync end in lines
Flags db ? ; Flags (Interlaced, Double Scan etc)
PixelClock dd ? ; Pixel clock in units of Hz
RefreshRate dw ? ; Refresh rate in units of 0.01 Hz
Reserved db 40 dup (?) ; remainder of ModeInfoBlock
CRTCInfoBlock ends
I have not understand this structure, which could be used during setting VBE Mode. now I do not use it. in Bochs and VMWare VBE work fine, but in my real PC by switching to my default Mode Monitor said wrong HF VF frequence.
should I use the above structure to define the frequence? if yes, could someone declare it (VBE documentation was not unstandable for me)
i cannot remember of having to fill such a structure ... could that be that you're trying to set up a video mode that your screen doesn't support ? ...
I have recompiled the kernel. now I receive a double fault.
but I can not catch it correctly because CPU are reset. normaly my OS stay in panic when there an exception I do not implement it.
I stop interrput by "cli" before entrying unreal mode and enable it after return from unreal mode "sti".
why CPU has been reset? I see my Panic Messages for a second and then rebooted :'(. I can not pause here, it is a real PC not Virtual M.
if I have superman Eye I could see it clearly ;D.
I think why setting Mode has not worked is a result of this double fault.
cpu resets because it cannot dispatch the double fault correctly. "dispatching correctly" means that it cannot even execute the first instruction of the double fault: there's a problem *even before* this.
The cleanest way to handle this is to provide a separate TSS for double faults and to use a task gate for that kind of exceptions.
try to keep that Task as simple as possible, give it a dedicated stack segment and pointers.
Chances are that the double fault is issued because of a kernel stack overflow ...