flat assembler
Message board for the users of flat assembler.

Index > DOS > Unreal Mode

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 18 Jul 2004, 08:52
I've heard of protected mode state called 'unreal mode' where you wouldn't have to include prefixes for each 32bit instruction. Does anybody have some source code examples to post?
MadMatt
Post 18 Jul 2004, 08:52
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 18 Jul 2004, 09:08
fasm for DOS uses it (see the MODES.INC file)
Post 18 Jul 2004, 09:08
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 18 Jul 2004, 10:59
you just enable 32bit code in CR0, and install interrupt handlers (on all interrupts) that work for both 16it and 32bit code, in 32bit code they switch to 16bit and execute original handler. Example is in modes.inc
Post 18 Jul 2004, 10:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 18 Jul 2004, 11:41
Ok, thanks, I'll have a look.
Post 18 Jul 2004, 11:41
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 18 Jul 2004, 13:06
The first approach I've used to achieve such mode was a bit different from current - it had universal interrupts handlers, that (thanks to some opcode-tricks) were able to detect whether they are executed as 16-bit or 32-bit code and jump to appropriate code. In current version I the IDTR is different for the 32-bit code, and so there is separate interrupt table for this mode. I've invented this solution after I realized that on all processors I could test the IDT base can be altered even for real mode, and it seems to be much more stable in my tests.
Post 18 Jul 2004, 13:06
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 18 Jul 2004, 20:40
wasn't previous versions (with universal handlers) stable?
Post 18 Jul 2004, 20:40
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 18 Jul 2004, 22:03
Some BIOSes use few of the interrupt vectors in real mode IDT (at address 0) as a pointers to some data structures instead of true interrupt handlers. I had to put code for skipping interrupt numbers that were the most frequently used this way when making wrappers for all the interrupts - because if a wrapper was made, the pointer to data was of course broken and it was causing various errors (on BIOS disk access, for instance). But even with this fix such code could not be sure for all systems.

Also the IDT-base-changing version makes some of things much simpler - there is no need to check whether we are in 16-bit or 32-bit mode when interrupt occurs, if it's 16-bit mode, just the original 16-bit handler is invoked, and if it's 32-bit the wrapper from additional IDT is called.
Post 18 Jul 2004, 22:03
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 19 Jul 2004, 18:17
oh, that, i forgot. Seems I haven't been using DOS for a long time.
Post 19 Jul 2004, 18:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla 15 Sep 2006, 11:30
I heard from Wikipedia that you can do Unreal Mode on a 286. I am writing a device driver and I was wondering if that's a good idea.
Post 15 Sep 2006, 11:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 15 Sep 2006, 15:11
Perhaps someone got it confused. All kinds of unreal modes require 386 at least. 286 introduced the protected mode, but this without 32-bit addressing is not enough.
Post 15 Sep 2006, 15:11
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.