OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 9:20 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 4:13 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
I need to load the Interrupt Descriptor Table in my environment (x86/32bit, compiled with C++, made in C/C++, i686-elf, protected mode).

However, i don't find much code or documentation about loading the IDT in this mode, and i have no idea how to load the IDT in my environment.

How do i?

Possible required info:
LIDT: function is in the kernel, code from Inline Assembly/Examples.
IO_WAIT: function is in the kernel, code from Inline Assembly/Examples.
IRQ1 handler: functions are in the kernel, code from OSDev wiki and mostly myself

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Last edited by NunoLava1998 on Wed Dec 21, 2016 5:50 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 4:34 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
http://wiki.osdev.org/Interrupts


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 5:51 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
iansjack wrote:
http://wiki.osdev.org/Interrupts


That explains absolutely nothing about my question, i already know what interrupts are and how they work, what i need help with is just loading the IDT.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 6:05 am 
Offline
Member
Member

Joined: Wed Jun 17, 2015 9:40 am
Posts: 501
Location: Athens, Greece
Hi,


Next time please search better. The article describing IDT is here.

Hope this helps. :)


Regards,
glauxosdever


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 6:09 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
glauxosdever wrote:
Hi,


Next time please search better. The article describing IDT is here.

Hope this helps. :)


Regards,
glauxosdever


Thank you,
i just have no idea how to insert the data into the LIDT instruction.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 6:46 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
NunoLava1998 wrote:
I already know what interrupts are and how they work.

Everything that you have posted so far indicates that that is not true.

The article I linked to, and the references in it, explain everything.


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 6:51 am 
Offline
Member
Member

Joined: Wed Sep 19, 2012 3:43 am
Posts: 91
Location: The Netherlands
You should write an assembly routine (well, routine.. about 3 lines, actually) that takes a pointer to your IDTR struct (containing base and limit) and load that pointer using LIDT.

I'm not trying to sound mean or insult you, but if you can't figure out how to do this kind of very basic stuff than this is not (yet) the hobby for you.


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 6:54 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
There's rather more to it than that. First you have to write the interrupt handlers and then construct the IDT.


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 7:02 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
iansjack wrote:
There's rather more to it than that. First you have to write the interrupt handlers and then construct the IDT.


The ironic things is that i already made the interrupt handlers, i'm just trying to construct the IDT beacuse if i don't it triple faults.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 7:05 am 
Offline
Member
Member

Joined: Wed Sep 19, 2012 3:43 am
Posts: 91
Location: The Netherlands
Of course there's more to it than that, but there is extensive documentation in the above linked wiki articles about what the IDT should look like.
Also, since those articles were linked, I assume that OP has read them before attempting to actually load an IDT, and understands that it's not as simple as just loading a value into the IDTR and expecting it to work.


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 7:18 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
I'm afraid that everything that the OP has posted so far indicates that he has no understanding of hardware interrupts. Let's face it, if you understand about interrupts and the IDT, loading the register is absolutely trivial. It's just the same as with the GDT.


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 7:22 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
iansjack wrote:
I'm afraid that everything that the OP has posted so far indicates that he has no understanding of hardware interrupts. Let's face it, if you understand about interrupts and the IDT, loading the register is absolutely trivial. It's just the same as with the GDT.


Oh, thanks for pointing that out (same as GDT).

I meant software interrupts, by the way.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 7:53 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
NunoLava1998 wrote:
I meant software interrupts, by the way.
I realize that.

Unfortunately, when considering a keyboard driver, it is hardware interrupts that you need to understand.


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 9:17 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 273
iansjack wrote:
NunoLava1998 wrote:
I meant software interrupts, by the way.
I realize that.

Unfortunately, when considering a keyboard driver, it is hardware interrupts that you need to understand.


And i actually have already made code for hardware interrupts, the only things i don't know about interrupts is how to work with things like lidt, lgdt, etc., but nothing else.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: How do i appropiately load the IDT?
PostPosted: Wed Dec 21, 2016 10:12 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 31, 2016 9:53 pm
Posts: 81
Location: San Diego, CA
Is your plan to just post about every single step in os development? Obviously you are not picking up on the fact that you MUST be able to read documentation and then be able to translate that into code.

There is no problem with asking questions. This stuff can be difficult to grasp. If you're getting stuck here, you're not going to make it much farther (without significant handholding) until you learn how to rtfm

_________________
Some of my open-source projects:
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C


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

All times are UTC - 6 hours


Who is online

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