OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 2:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: int 13h, can it be used within protected mode of i386?
PostPosted: Tue Feb 12, 2008 3:23 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 12, 2008 3:16 am
Posts: 56
Location: Kashmir - Paradise On Earth
Hi
I am a student working on a multitasking OS over i386 platform.
Well what I wanna know is that can't int13h of real mode be used in protected mode...here is what i think
1. save the ISR address of int 13h from IVT.
2. Load the same vector address into IDT at some other index say 21h.

I think this way can make ISR of int13h be used within prot mode using some other int number say 21h.

Please do correct me
Thanks


Top
 Profile  
 
 Post subject: Re: int 13h, can it be used within protected mode of i386?
PostPosted: Tue Feb 12, 2008 3:29 am 
Offline
Member
Member

Joined: Wed Oct 31, 2007 9:09 am
Posts: 1385
Pitchu wrote:
Please do correct me


You are hereby corrected. All BIOS interrupts are written in real mode assembly. They can not be used in protected mode, ever. If you are thinking about v86 mode, forget that too for int 13h, as you'd need to code proper DMA and IRQ handling, in which case it's easier to just write your own disk handling.


JAL


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 3:47 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 12, 2008 3:16 am
Posts: 56
Location: Kashmir - Paradise On Earth
Thanks a lot
Does it mean that no int of ivt can be used(even keyboard)?
What do u mean by saying that they are coded in real mode assembly, i guess the problem will be adrressing ds:si wont point to correct location.

One more thing i read in Barry B. Brey book the say thing i posted earlier.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 4:03 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

You can use some of the interrupts in v86 mode, but generally using v86 for IO is a Bad Idea (tm). You are alright for things like VBE and switching VGA modes, but for anything which is likely to either fire an IRQ, or which needs DMA (as indicated above), you are better off writing protected mode drivers.

What is meant by real mode assembly, is that the BIOS routines expect to be in an environment where the default operand sizes are 16 bit and that real addressing mode applies.

A word of warning: don't rely on v86 too much if you plan to port your OS to x86-64. In long mode, you can't use v86 at all.

Cheers,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 4:23 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 12, 2008 3:16 am
Posts: 56
Location: Kashmir - Paradise On Earth
Thanks a lot
So i concluded that all INTs in IVT which do I/O using DMA or have IRQs associated cannot be used in PM.
Why DMA understood(16 bit operands);
Why IRQs?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 4:40 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
the DMA chip bypasses the memory management of the processor. Once the bios starts accessing it it might start writing or reading data to where you don't want it to. It's not specific for either 8-bit or 16-bit transfers

In protected mode, IRQs always go to the interrupt table of the kernel, and not to the IVT. Which means you need some way of telling userspace that an interrupt has occurred. Doing that is something that can quickly lead to ugly hacks.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 6:56 am 
Offline
Member
Member

Joined: Wed Oct 31, 2007 9:09 am
Posts: 1385
Pitchu wrote:
What do u mean by saying that they are coded in real mode assembly


You'd do yourself a really big favour if you started reading some Intel documentation about addressing modes.


JAL


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 12:44 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 12, 2008 3:16 am
Posts: 56
Location: Kashmir - Paradise On Earth
Thanks everybody
Nice of u and i wanna mention that i have gone through intel manuals but u know Can it be done like this always clicks me
I learnt;
1. Only int 10h(vbe for SVGA) can be used in PM.
2. I can its ISR address in IDT after raising it to 32 bit.
3. Clearly, DMA and IRQ based INTs are lost in protected mode because of addressing problem.
I wish I am correct


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 2:25 am 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
Pitchu wrote:
Thanks everybody
Nice of u and i wanna mention that i have gone through intel manuals but u know Can it be done like this always clicks me
I learnt;
1. Only int 10h(vbe for SVGA) can be used in PM.
2. I can its ISR address in IDT after raising it to 32 bit.
3. Clearly, DMA and IRQ based INTs are lost in protected mode because of addressing problem.
I wish I am correct


Unfortunately, you don't seem to have picked up on what people have been saying. No BIOS interrupts can be used in (vanilla) protected mode.. You have to create a v8086 task to do that. Then, only BIOS interrupts which do not use the DMA chip or any interrupt requests will work.

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 2:38 am 
Offline
Member
Member

Joined: Wed Oct 31, 2007 9:09 am
Posts: 1385
JamesM wrote:
Unfortunately, you don't seem to have picked up on what people have been saying.


I'm afraid he's beyond salvation. Perhaps his incredibly bad English doesn't help. I can imagine it's difficult reading the Intel manuals with only a very basic grasp of the language. On the other hand, he doesn't even seem to have tried.


JAL


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 5:46 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 12, 2008 3:16 am
Posts: 56
Location: Kashmir - Paradise On Earth
Quote:
I'm afraid he's beyond salvation. Perhaps his incredibly bad English doesn't help. I can imagine it's difficult reading the Intel manuals with only a very basic grasp of the language. On the other hand, he doesn't even seem to have tried.


JAL

Yep U may be right about my 'English' because it isn't my native language and im writing these posts under -13 degree with a lots of things in my mind regarding MultiTasking OS im working on.
While Im thinking about Disk Access Im interrupted by Code Relocation.
Thanks 2 everybody for posting and i really misinterpreted posts and got confused by an earlier thread

Quote:
Warmaster199
Guest

Posted: Sun Oct 06, 2002 4:13 am Post subject: Re:Disk Access Under Pmode

--------------------------------------------------------------------------------

Actually, you can grab a pointer to a function in the VESA BIOS to switch banks. The VESA BIOS Switch Bank function is 32-bit protected mode code, so it's alot faster to get that pointer, rather than use the Bios calls
http://www.osdev.org/phpBB2/viewtopic.php?t=7193&highlight=disk+access+pmode

I thought it can be done without using v86 mode (using the address of ISR).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 9:36 am 
Offline
Member
Member
User avatar

Joined: Tue Apr 10, 2007 4:42 pm
Posts: 224
Quote:
I thought it can be done without using v86 mode (using the address of ISR).


The ISRs have a different purpose - they are pointers to handlers for processor exceptions, IRQs, and your own interrupts (not the BIOS ones).

Quote:
1. Only int 10h(vbe for SVGA) can be used in PM.

Only in v86. No BIOS interrupts are available in PM!!!

Quote:
2. I can its ISR address in IDT after raising it to 32 bit.

No. You can't just set an ISR to the address of the BIOS interrupt handler - the code's memory addressing won't work. Just write your own disk driver (it'd be quicker and easier to do).

Quote:
3. Clearly, DMA and IRQ based INTs are lost in protected mode because of addressing problem.

The DMA and PICs (which manage the IRQs) are not affected by this problem. You just have to configure them to use them in protected mode.

EDIT: Also, the above quote about grabbing a pointer to a function is specific to that single function, not the entire BIOS call

Hope this helps,
Julian

_________________
"Sufficiently advanced stupidity is indistinguishable from malice."


Top
 Profile  
 
 Post subject: Re: int 13h, can it be used within protected mode of i386?
PostPosted: Wed Feb 13, 2008 2:56 pm 
Offline
Member
Member
User avatar

Joined: Fri Dec 15, 2006 5:26 pm
Posts: 437
Location: Church Stretton Uk
Pitchu wrote:
Hi
I am a student working on a multitasking OS over i386 platform.
Well what I wanna know is that can't int13h of real mode be used in protected mode...here is what i think
1. save the ISR address of int 13h from IVT.
2. Load the same vector address into IDT at some other index say 21h.

I think this way can make ISR of int13h be used within prot mode using some other int number say 21h.

Please do correct me
Thanks


The primary reason real mode routines (in the BIOS and elsewhere) can't be used is that they will assume that they can play fast and loose with the segment registers, ignoring what's in the GDT (which doesn't exist in real mode).

_________________
The continuous image of a connected set is connected.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 1:30 am 
Offline
Member
Member

Joined: Wed Jul 25, 2007 8:45 am
Posts: 391
Location: London, UK
Some also assume that they can raise other BIOS interrupts, like while debugging my V86 code a while back I found the BIOS call to be using various int instructions.

_________________
http://alex-smith.me.uk


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 10:17 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 12, 2008 3:16 am
Posts: 56
Location: Kashmir - Paradise On Earth
Thanks everybody
Im not goin to use BIOS interrupts in PM, not even in v86 mode.
Quote:
The DMA and PICs (which manage the IRQs) are not affected by this problem. You just have to configure them to use them in protected mode.

EDIT: Also, the above quote about grabbing a pointer to a function is specific to that single function, not the entire BIOS call

Hope this helps,
Julian


Why to configure PIC?
I mean, wont IRQ0 invoke INT 08 routine i.e. index 9 in IDT.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot] and 88 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group