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.
How does my IDT and entry encoder look?
- beauhefley
- Posts: 13
- Joined: Mon Feb 20, 2017 1:01 am
- Location: The Moon
- Contact:
How does my IDT and entry encoder look?
Developing an OS that is so early in development, it can't do anything because stupid me can't figure out interrupts
- TheCool1Kevin
- Posts: 24
- Joined: Fri Oct 14, 2016 7:37 pm
- Location: Canada
- Contact:
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:
However, it should really be this:
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.
1. Your IDT base high value on line 14 is this:
Code: Select all
idt[entry].hOffset = functionPointer >> 16;
Code: Select all
idt[entry].hOffset = (functionPointer >> 16) & 0xFFFF;
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.
LiquiDOS, my weird hobbyist OS.
"Strive for progress, not perfection" - Anonymous
"Strive for progress, not perfection" - Anonymous
Re: How does my IDT and entry encoder look?
This one is fine as it was, the & 0xFFFF is redundant and not required as the hOffset is uint16_tTheCool1Kevin 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:However, it should really be this:Code: Select all
idt[entry].hOffset = functionPointer >> 16;
Code: Select all
idt[entry].hOffset = (functionPointer >> 16) & 0xFFFF;
line 13:
Code: Select all
idt[entry].lOffset = functionPointer & 0xFFFF;
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.
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
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 =)
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?
Didn't notice it, LOL.
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing
OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.