OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:21 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: How does my IDT and entry encoder look?
PostPosted: Thu Mar 16, 2017 2:08 pm 
Offline
User avatar

Joined: Mon Feb 20, 2017 1:01 am
Posts: 13
Location: The Moon
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.

_________________
Developing an OS that is so early in development, it can't do anything because stupid me can't figure out interrupts
Image


Top
 Profile  
 
 Post subject: Re: How does my IDT and entry encoder look?
PostPosted: Sat May 06, 2017 12:05 pm 
Offline
User avatar

Joined: Fri Oct 14, 2016 7:37 pm
Posts: 24
Location: Canada
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.

_________________
LiquiDOS, my weird hobbyist OS.
"Strive for progress, not perfection" - Anonymous


Top
 Profile  
 
 Post subject: Re: How does my IDT and entry encoder look?
PostPosted: Sat May 06, 2017 1:01 pm 
Offline
Member
Member

Joined: Thu May 19, 2011 5:13 am
Posts: 228
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:
idt[entry].hOffset = functionPointer >> 16;
However, it should really be this:
Code:
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:
idt[entry].lOffset = functionPointer & 0xFFFF;
Here, the & 0xFFFF is also redundant and not required as the lOffset is also uint16_t

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com


Top
 Profile  
 
 Post subject: Re: How does my IDT and entry encoder look?
PostPosted: Sat May 06, 2017 2:52 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 492
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.


Top
 Profile  
 
 Post subject: Re: How does my IDT and entry encoder look?
PostPosted: Sat May 06, 2017 2:59 pm 
Offline
Member
Member

Joined: Thu Aug 13, 2015 4:57 pm
Posts: 384
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 =)


Top
 Profile  
 
 Post subject: Re: How does my IDT and entry encoder look?
PostPosted: Sun May 07, 2017 12:49 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 492
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, Bing [Bot] and 62 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