Page 1 of 1
How does my IDT and entry encoder look?
Posted: Thu Mar 16, 2017 2:08 pm
by beauhefley
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/bl ... upts/idt.h
idt.c:
https://github.com/beauhefley/beauos/bl ... upts/idt.c
Of course I do not have loadIdt() set up yet.
Re: How does my IDT and entry encoder look?
Posted: Sat May 06, 2017 12:05 pm
by TheCool1Kevin
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: Select all
idt[entry].hOffset = functionPointer >> 16;
However, it should really be this:
Code: Select all
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.
Re: How does my IDT and entry encoder look?
Posted: Sat May 06, 2017 1:01 pm
by mikegonta
TheCool1Kevin wrote: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: Select all
idt[entry].hOffset = functionPointer >> 16;
However, it should really be this:
Code: Select all
idt[entry].hOffset = (functionPointer >> 16) & 0xFFFF;
This one is fine as it was, the
& 0xFFFF is redundant and not required as the
hOffset is
uint16_t
line 13:
Code: Select all
idt[entry].lOffset = functionPointer & 0xFFFF;
Here, the
& 0xFFFF is also redundant and not required as the
lOffset is also
uint16_t
Re: How does my IDT and entry encoder look?
Posted: Sat May 06, 2017 2:52 pm
by osdever
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.
Re: How does my IDT and entry encoder look?
Posted: Sat May 06, 2017 2:59 pm
by LtG
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 =)
Re: How does my IDT and entry encoder look?
Posted: Sun May 07, 2017 12:49 pm
by osdever
Didn't notice it, LOL.