flat assembler
Message board for the users of flat assembler.

Index > OS Construction > "Forreal" mode

Author
Thread Post new topic Reply to topic
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 01 Sep 2009, 03:16
As mentioned in comp.os.msdos.djgpp (of all places), Rick Hohensee claims there is something called "Forreal" mode (download: Forreal.tgz), which is similar (but not entirely? the same as) to "flat real" or unreal.

doc/actualmodes wrote:

PE=0 Dbit=0 (un)Real Mode
PE=0 Dbit=1 Forreal Mode
PE=1 Dbit=0 Veal Mode (BKA "286 task")
PE=1 Dbit=1 Protected Mode


Rick Hohensee wrote:

Yes Forreal Mode works. I have some code, but it's in my own assembler in Bash. The thing is, you have to handle interrupts in 8086 mode, i.e. you have 66/67h IRET.

Where it might be useful is realtime. No big task switch latency. So for example, you could have a unix-like OS, with real protected mode for guest users, but let the "root" user operate in Forreal mode for video and whatnot. Syncing audio to other stuff might benefit quite noticeably, I suspect.


I don't know all the gory details, but I'm mentioning it here in case someone wants to take a look or can dissect it better. Wink
Post 01 Sep 2009, 03:16
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 01 Sep 2009, 03:21
Tomasz Grysztar wrote:

Hmm, it seems like he implemented the same thing that I called the unREAL mode in my implementation (fasm for DOS and the kelvar example use this mode). This was really a lot of fun implementing it - I did it with help of Leonid Petroff, he was a great comrade in DOS programming. Before I realized that it is possible to relocate IDT for 32-bit code, we had to use a hybrid interrupt handlers, which were able to detect, whether they are executed as 16-bit or 32-bit mode, and behave accordingly. I'm afraid I don't have the copy of those first implementation, but from my memory the beginning of interrupt vector looked like:

Code:
use16 
mov cr3,eax ; bitness-independent instruction; CR3 used as a safe storage, as it's unused in real mode 
mov ax,0 
jmp short int_16bit ; in 32-bit the "mov eax" instruction eats this two-byte jump 
use32 
; here we know we're in 32-bit code, so we have to switch back to 16-bit before calling DOS/BIOS interrupt handler 
; ... 
int_16bit: 
; here just restore EAX from CR3 and jump to the original interrupt handler
    


Of course with separate interrupt tables for 16-bit and 32-bit mode this became much simpler and such implementation you can see in fasm.


Quoted here (from here) since it seems appropriate. Wink
Post 01 Sep 2009, 03:21
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 01 Sep 2009, 09:52
Here's the original thread from 2002, where I first posted the unREAL officially (it was already a final version that uses separate IDTs for 16-bit and 32-bit real modes):
http://www.asmcommunity.net/board/index.php?topic=9564.0
Post 01 Sep 2009, 09:52
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 02 Sep 2009, 08:18
Another important thing to note on this topic is the compatibility. In my tests with Leonid back in 2002 we found only one CPU, which did not support this mode (after coming back to real mode with D bit set in code descriptor, the code still was executed as 16-bit), and it was some old Cyrix x86 clone. However on all Intel and AMD processors this mode works just as excepted.

Still, it is not emulated correctly by virtual machines like Bochs or VMware. They may either still execute code as 16-bit, like that Cyrix did, or panic and stop the execution completely.

Apparently, the newest VMware should allow this mode to run, though with poor performance: http://sanbarrow.com/phpBB2/viewtopic.php?p=6156
Post 02 Sep 2009, 08:18
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.