How do i appropiately load the IDT?
-
- Member
- Posts: 273
- Joined: Sun Oct 09, 2016 4:38 am
- Libera.chat IRC: NunoLava1998
How do i appropiately load the IDT?
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
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
Last edited by NunoLava1998 on Wed Dec 21, 2016 5:50 am, edited 1 time in total.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.
https://github.com/NunoLava1998/DixiumOS
https://github.com/NunoLava1998/DixiumOS
-
- Member
- Posts: 273
- Joined: Sun Oct 09, 2016 4:38 am
- Libera.chat IRC: NunoLava1998
Re: How do i appropiately load the IDT?
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.iansjack wrote:http://wiki.osdev.org/Interrupts
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.
https://github.com/NunoLava1998/DixiumOS
https://github.com/NunoLava1998/DixiumOS
-
- Member
- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
Re: How do i appropiately load the IDT?
Hi,
Next time please search better. The article describing IDT is here.
Hope this helps.
Regards,
glauxosdever
Next time please search better. The article describing IDT is here.
Hope this helps.
Regards,
glauxosdever
-
- Member
- Posts: 273
- Joined: Sun Oct 09, 2016 4:38 am
- Libera.chat IRC: NunoLava1998
Re: How do i appropiately load the IDT?
Thank you,glauxosdever wrote:Hi,
Next time please search better. The article describing IDT is here.
Hope this helps.
Regards,
glauxosdever
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
https://github.com/NunoLava1998/DixiumOS
Re: How do i appropiately load the IDT?
Everything that you have posted so far indicates that that is not true.NunoLava1998 wrote:I already know what interrupts are and how they work.
The article I linked to, and the references in it, explain everything.
Re: How do i appropiately load the IDT?
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.
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.
Re: How do i appropiately load the IDT?
There's rather more to it than that. First you have to write the interrupt handlers and then construct the IDT.
-
- Member
- Posts: 273
- Joined: Sun Oct 09, 2016 4:38 am
- Libera.chat IRC: NunoLava1998
Re: How do i appropiately load 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.iansjack wrote:There's rather more to it than that. First you have to write the interrupt handlers and then construct the IDT.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.
https://github.com/NunoLava1998/DixiumOS
https://github.com/NunoLava1998/DixiumOS
Re: How do i appropiately load the IDT?
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.
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.
Re: How do i appropiately load the IDT?
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.
-
- Member
- Posts: 273
- Joined: Sun Oct 09, 2016 4:38 am
- Libera.chat IRC: NunoLava1998
Re: How do i appropiately load the IDT?
Oh, thanks for pointing that out (same as GDT).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.
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
https://github.com/NunoLava1998/DixiumOS
Re: How do i appropiately load the IDT?
I realize that.NunoLava1998 wrote:I meant software interrupts, by the way.
Unfortunately, when considering a keyboard driver, it is hardware interrupts that you need to understand.
-
- Member
- Posts: 273
- Joined: Sun Oct 09, 2016 4:38 am
- Libera.chat IRC: NunoLava1998
Re: How do i appropiately load the IDT?
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.iansjack wrote:I realize that.NunoLava1998 wrote:I meant software interrupts, by the way.
Unfortunately, when considering a keyboard driver, it is hardware interrupts that you need to understand.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.
https://github.com/NunoLava1998/DixiumOS
https://github.com/NunoLava1998/DixiumOS
- crunch
- Member
- Posts: 81
- Joined: Wed Aug 31, 2016 9:53 pm
- Libera.chat IRC: crunch
- Location: San Diego, CA
Re: How do i appropiately load the IDT?
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
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
Ext2/ELF32 bootloader
Lightweight x86 assembler, designed to be portable for osdev
Scheme in under 1000 lines of C