Long mode VBE
Long mode VBE
Hi all
I was just thinking (after being inspired by Solar OS) is it possible to use VBE in long mode on the AMD x64. Looking through the AMD manuals it makes a reference to call backs to real mode on not being allowed ??? Will this affect calls to the VBE because I'am thinking that VBE uses real mode.
Any help would be appreciated
Thanks :-*
I was just thinking (after being inspired by Solar OS) is it possible to use VBE in long mode on the AMD x64. Looking through the AMD manuals it makes a reference to call backs to real mode on not being allowed ??? Will this affect calls to the VBE because I'am thinking that VBE uses real mode.
Any help would be appreciated
Thanks :-*
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Long mode VBE
indeed, VBE uses realmode. And there's no such thing like a "long mode interface" (and i doubt it will ever have since even "protected mode interface" wasn't a real success).
So you'll have to use a V86 monitor or a software code translator if you want to set up video mode from long mode ...
So you'll have to use a V86 monitor or a software code translator if you want to set up video mode from long mode ...
Re:Long mode VBE
So really I have to switch from long mode to protected mode which will call the vbe routines, which in turn will switch to real mode and back up again....
I wonder how painful this will be in CPU cycles
Urm..... :-\
I wonder how painful this will be in CPU cycles
Urm..... :-\
Re:Long mode VBE
No, you don't have to. You have to program a virtual 8086 monitor, which will allow you to use real mode operations - without switching back and forth to real mode.
Re:Long mode VBE
I thought I had it ???
If I'am using virtual 8086 mode safe I have a large screen 1024x768 32bit which flips between the one that is drawn and displayed. That is alot of memory, wouldn't it be better to switch to protected mode then call vbe? Or am I missing the point since virtual 8086 mode can only address 1 meg of memory!
You see this is hopefully the last hurdle ;D is this particular topic!!!!
If I'am using virtual 8086 mode safe I have a large screen 1024x768 32bit which flips between the one that is drawn and displayed. That is alot of memory, wouldn't it be better to switch to protected mode then call vbe? Or am I missing the point since virtual 8086 mode can only address 1 meg of memory!
You see this is hopefully the last hurdle ;D is this particular topic!!!!
Re:Long mode VBE
Most of the time you only need to make vbe real mode calls to switch the mode. To render graphics you can:
1) Use a linear frame buffer. Easy to use, just a block of memory.
2) if your unlucky enough that 1) isn't support some cards have a protected mode stub you can copy from the bios to a code segment in order to perform bank switching in protected mode.
3) worst case, you drop into real mode to perform bank switching. however, you don't have to do this for every pixel drawn, only when you need to draw outside the current visible window of video memory.
Eddie
1) Use a linear frame buffer. Easy to use, just a block of memory.
2) if your unlucky enough that 1) isn't support some cards have a protected mode stub you can copy from the bios to a code segment in order to perform bank switching in protected mode.
3) worst case, you drop into real mode to perform bank switching. however, you don't have to do this for every pixel drawn, only when you need to draw outside the current visible window of video memory.
Eddie
Re:Long mode VBE
Ok. Was just goung to use one screen resolution anyway (simplicity) 1024x768 32bit. I should really read the vbe 3 specification (so of just skimmed through it).
Anyway thnaks for everybodys help (again)
Anyway thnaks for everybodys help (again)
Re:Long mode VBE
I thought V8086 was disabled in Long Mode, at least I think I read that it in the AMD Docs (Don't have them on hand).
Re:Long mode VBE
According to a table in the AMD docs you have both 16 and 32bit compatibility mode in long mode.
It's possible that 16bit compatibility mode equals V8086 mode.
It's possible that 16bit compatibility mode equals V8086 mode.
Re:Long mode VBE
I have the docs now, page 13 there is a table declaring Long Mode supports 2 submodes, 64bit and Compatibility, Compatibility supports 32 and 16 bit protected mode programs, V8086 is not supported in either variant of long mode.
From "AMD64 Architecture Programmer?s Manual Volume 2: System Programming"Virtual-8086 mode is not supported when the processor is
operating in long mode. When long mode is enabled, any
attempt to enable virtual-8086 mode is silently ignored. (Pg17)
Virtual-8086 Mode?The virtual-8086 mode bit
(EFLAGS.VM) is ignored when the processor is running in
long mode. When long mode is enabled, any attempt to
enable virtual-8086 mode is silently ignored. System
software must leave long mode in order to use virtual-8086
mode. (Pg30)
Re:Long mode VBE
Hi,
Basically a 64 bit CPU has the following modes:
[tt]__Long Mode
|_64 bit code
|_32 bit protected mode code
|_16 bit protected mode code
__Protected Mode
|_32 bit protected mode code
|_16 bit protected mode code
|_16 bit real mode code (via. virtual 8086)
__Real Mode
|_16 bit real mode code
__System Management Mode
|_Modified/32 bit real mode (that none of us should worry about)
__Stopped
|_CPU doesn't execute anything (entered on triple fault)[/tt]
To execute real mode code in long mode you have 3 choices - emulate it (ie. like Bochs), switch back to protected mode and use virtual 8086, or switch back to real mode.
I don't like any of these options - instead I'd set a default video mode during boot (when the CPU is in real mode anyway) and don't allow this video mode to be changed without a (32 bit or 64 bit) video driver.
Cheers,
Brendan
No - within long mode there's 64 bit mode and compatibility mode, where compatibility mode executes code originally designed for 32 bit protected mode and 16 bit protected mode. AMD's documentation explicitly states that both Virtual 8086 and real mode are not supported in long mode (and that any attempt to enable virtual 8086 is silently ignored).zyp wrote: According to a table in the AMD docs you have both 16 and 32bit compatibility mode in long mode.
It's possible that 16bit compatibility mode equals V8086 mode.
Basically a 64 bit CPU has the following modes:
[tt]__Long Mode
|_64 bit code
|_32 bit protected mode code
|_16 bit protected mode code
__Protected Mode
|_32 bit protected mode code
|_16 bit protected mode code
|_16 bit real mode code (via. virtual 8086)
__Real Mode
|_16 bit real mode code
__System Management Mode
|_Modified/32 bit real mode (that none of us should worry about)
__Stopped
|_CPU doesn't execute anything (entered on triple fault)[/tt]
To execute real mode code in long mode you have 3 choices - emulate it (ie. like Bochs), switch back to protected mode and use virtual 8086, or switch back to real mode.
I don't like any of these options - instead I'd set a default video mode during boot (when the CPU is in real mode anyway) and don't allow this video mode to be changed without a (32 bit or 64 bit) video driver.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Long mode VBE
So just to clarify things. Need to drop down from long mode to protected mode then call use vbe. :-\
Re:Long mode VBE
Nasty, you'll also have to turn off paging before you go back into long mode, too much hassle for my liking.Spoon spider wrote: So just to clarify things. Need to drop down from long mode to protected mode then call use vbe. :-\
srg