OSDev.org https://forum.osdev.org/ |
|
How does my IDT and entry encoder look? https://forum.osdev.org/viewtopic.php?f=1&t=31428 |
Page 1 of 1 |
Author: | beauhefley [ Thu Mar 16, 2017 2:08 pm ] |
Post subject: | How does my IDT and entry encoder look? |
Working on my IDT, haven't written any ISRs though. How does my code look? I want to make sure I'm doing this right. idt.h: https://github.com/beauhefley/beauos/blob/interrupts/idt.h idt.c: https://github.com/beauhefley/beauos/blob/interrupts/idt.c Of course I do not have loadIdt() set up yet. |
Author: | TheCool1Kevin [ Sat May 06, 2017 12:05 pm ] |
Post subject: | Re: How does my IDT and entry encoder look? |
It's not terribly bad, however, there are 2 things I would like to mention: 1. Your IDT base high value on line 14 is this: Code: idt[entry].hOffset = functionPointer >> 16; However, it should really be this: Code: idt[entry].hOffset = (functionPointer >> 16) & 0xFFFF; 2. The "gateType" data type will cause you some level of headaches when you implement user mode and rings. Personally, I recommend you leave it as "uint8_t flags", and then set the idt[entry].attributes to flags. This way, when time comes for you to implement user mode, you can set the value idt[entry].attributes to flags | 0x60. I dunno, just some opinions. |
Author: | mikegonta [ Sat May 06, 2017 1:01 pm ] |
Post subject: | Re: How does my IDT and entry encoder look? |
TheCool1Kevin wrote: It's not terribly bad, however, there are 2 things I would like to mention: This one is fine as it was, the & 0xFFFF is redundant and not required as the hOffset is uint16_t1. Your IDT base high value on line 14 is this: Code: idt[entry].hOffset = functionPointer >> 16; However, it should really be this:Code: idt[entry].hOffset = (functionPointer >> 16) & 0xFFFF; line 13: Code: idt[entry].lOffset = functionPointer & 0xFFFF; Here, the & 0xFFFF is also redundant and not required as the lOffset is also uint16_t
|
Author: | osdever [ Sat May 06, 2017 2:52 pm ] |
Post subject: | Re: How does my IDT and entry encoder look? |
Welp, looks very organized, it's easy to read, let's forget about more than a half of code being non-present at now because, as you previously stated, it's still WIP. Look at the issues previous poster mentioned though. |
Author: | LtG [ Sat May 06, 2017 2:59 pm ] |
Post subject: | Re: How does my IDT and entry encoder look? |
You do realize this is a two month old thread, right? I don't have a problem with replying to old posts but the OP _might_ not be waiting this long =) |
Author: | osdever [ Sun May 07, 2017 12:49 pm ] |
Post subject: | Re: How does my IDT and entry encoder look? |
Didn't notice it, LOL. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |