OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 6:39 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: can't set IDT entry twice!!!
PostPosted: Mon Aug 06, 2001 11:00 pm 
Okay guys, I really need some help here... this makes
_NO_ sence to me!

I've defined and set a timer interrupt, and then
enabled IRQ 0. This works fine.

Then I disable IRQ 0, which also works fine.

I then re-define the timer interrupt with
another function, and re-enable IRQ 0.

My problem? When the interrupt starts up again,
the function hasn't changed!!! It's still using
the old function!!!

How is that possible!?
My createGate function seems to be able to set an
interrupt _once_, and only once!!! Huh? The same
thing happens with the keyboard interrupt... I tested it
with that one too.

My createGate code is as follows, if it helps:

void createGate(long table, short desc_num, long offset,
short selector, long control) {
Gate *gate ;
gate = (Gate *)(table + desc_num * 8);

gate->offset_low = offset & 0xffff;
gate->selector = selector;
gate->access = control + D_PRESENT;
gate->offset_high = offset >> 16;

return;
}

Any ideas?


Top
  
 
 Post subject: RE:can't set IDT entry twice - strange!
PostPosted: Mon Aug 06, 2001 11:00 pm 
Sorry guys, didn't mean to post twice...

Anyway, I found a solution, but it doesn't seem
anywhere near adequate!

After re-loading an idt entry (ie, changing it) I'm forced to
reload the idt. I assume this works by invalidating
some cache memory that's used to hold IDT entries.

So, I'm curious... is this in fact necessary, or
is there another way to invalidate the idt cache.

Also, if this is required, will it also be required
if GDT or LDT entries are changed.

Thanks a ton guys,
J.Weeks


Top
  
 
 Post subject: RE:can't set IDT entry twice!!!
PostPosted: Wed Aug 08, 2001 11:00 pm 
>On 2001-08-07 21:16:25, J. Weeks wrote:

>I then re-define the timer interrupt with
>another function, and re-enable IRQ 0.
>
>My problem? When the interrupt starts up again,
>the function hasn't changed!!! It's still using
>the old function!!!

It sounds like these are two different values:
- where you think the IDT is
- where the CPU thinks the IDT is

The code continues to call the old
interrupt function because your changes
to the IDT went off into hyperspace somewhere.

I don't think you need to do LIDT again
after changing the IDT.


Top
  
 
 Post subject: RE:can't set IDT entry twice!!!
PostPosted: Fri Aug 10, 2001 11:00 pm 
>It sounds like these are two different values:
>- where you think the IDT is
>- where the CPU thinks the IDT is
>
>The code continues to call the old
>interrupt function because your changes
>to the IDT went off into hyperspace somewhere.

But the IDT code does work correctly, 'cuz it
sets the interrupts up in the first place... int 0
to 18, and 32, and 33 are setup correctly.

However, when I use that same function to overwrite
my int 32 (the timer), it still uses the old function.

>I don't think you need to do LIDT again
>after changing the IDT.

It doesn't seem like you should have to... but for
some reason I do... I think it clears some IDT
cache or something.

Another possible reason: I'm testing my OS using
the VMWare virtual machine... it might have bugs
when emulating an IDT..

In any event, it all works now.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 154 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