Computing.Net > Forums > Programming > Real mode int's in protected mode?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Real mode int's in protected mode?

Reply to Message Icon

Name: Birdman
Date: July 16, 2004 at 12:46:10 Pacific
OS: my own
CPU/Ram: 80x86
Comment:

I'm writing my own operating system, and I want to cheat by avoiding writing my own floppy drive (at least for now). So would this work?

1. Before entering protected mode I save the IDT pointer somewhere, and use it to find the address of int 13.
2. I enter protected mode, and set up my new idt, with faults and everything set up.
3. I add a new interrupt somewhere where it won't get in the way and point it to the old int 13 routine.
4. I then call my new interrupt like I used to call int 13 in real mode.

Will this work? Or does the int 13 code call other interrupts or anything that can't make the switch to protected mode?

Any information is appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: wizard-fred
Date: July 17, 2004 at 16:37:06 Pacific
Reply:

Maybe you should look at some open source OS projects like Linux, FreeDOS, etc.


0

Response Number 2
Name: JackG
Date: July 17, 2004 at 22:14:09 Pacific
Reply:

Answer: NO. That will not work.

INT 13h code is BIOS code that is written for REAL mode. It is using the Segment Registers in their normal REAL mode usage and loading them with fixed values, not as Segment Selectors (protected mode). The INT 13h code will also call other INT xxh routines that do the same, and it access area's of real mode memory directly.

The only way to make that work is to create a Virtual Machine (DOS) and switch control to it and have code in it call the INT 13h in VM Real mode. This is basically what Windows has to do when it is running the disk/diskette drivers in Compatibility mode (using the BIOS). But that is a lot of code. It has to be able to trap out many I/O address and handle all the I/O and DMA in protected mode drivers. Sort of defeats the purpose of why you want it to work.

I once wrote a version of BIOS long ago that would allow you to do the type of thing you want to do with ease (only had to setup a few "special" selectors), but the project was killed before I had the problems with DMA devices (like a NIC card) worked out (had the rest working in PIO mode). It was to be a full dual mode BIOS. That is what all PC systems would have today, if it were not for the fact that some people could only see "their version" of the future coming and nothing else. So Microsoft took over.


0

Response Number 3
Name: Birdman
Date: July 18, 2004 at 06:35:52 Pacific
Reply:

Thanks for the help JackG, I guess I'll have to bite the bullet and write the DMA and fdc code. *sigh*. Do you know any sites for good info on such topics? I'm finding it kind of hard to get any real information for this kind of stuff.

Thanks again


0

Response Number 4
Name: renato_enca
Date: July 28, 2004 at 14:00:46 Pacific
Reply:

There's another way to use BIOS in protected mode, but it's very hard to do.

In the GDT:
- Create a descriptor appropriate for Real Mode;

In the IDT:
- Create a descriptor for PMODE Int 13h;

In the PMODE Int 13h handler:
- Save registers;
- Switch to Real Mode;
- Set segment registers
- Set registers;
- Call the interrupt;
- Switch to Protected Mode
- Set Segment Regs.
- Restore registers.
- Make an IRET.


If you don't want to write a V86 monitor, or write the drivers, this is the only way to use BIOS in Protected Mode.

I'm using this in my OS, so it may work.


0

Response Number 5
Name: dex___
Date: August 8, 2004 at 21:57:50 Pacific
Reply:

Hi, can you put some code to please.



0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

VB Application Wizard FTP C/C++ library



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Real mode int's in protected mode?

protected mode/real mode question www.computing.net/answers/programming/protected-modereal-mode-question/2375.html

Protected Mode And 32-bit Real Mode www.computing.net/answers/programming/protected-mode-and-32bit-real-mode/10917.html

Protected Mode (Assembler) www.computing.net/answers/programming/protected-mode-assembler/4333.html