Tired of doing the same gdt things? Here's your answer!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Tired of doing the same gdt things? Here's your answer!

Post by earlz »

Well I did this for myself but because it is so portable I thought a few people may want it so...

the code snipplet and readme file is attached..
Attachments
gdt_stuff.zip
Code snipplet and readme
(4.51 KiB) Downloaded 76 times
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

Looked through it, have no clue what I would use it for. I mean, once my gdt is setup, I really don't need to play with it, that's what paging is for, unless i'm missing something (very possible, i'm a bit tired atm). Just seems like a ton of functions that will bloat my already bloating kernel ;). They would make it a bit simpler on a beginner I suppose, being able to set the bits in a nice logical manner, and it's probably only an extra kb or so, but, for me, I am trying to save as much space as possible for other things.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

meh... guess I was thinking too much of how my kernel multitasking is planned...planning on doing sometghing like this for idt and tss though..maybe a bit more useful to "everyone"
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

Yeah, I can see how it could be useful to people, it simplifies a lot of things that look really ugly when you do them directly multiple times. And if you change your GDT often (call gates?), it would definitely be useful. I have similar code setup for my IDT, except it's all in asm, lol. I have re-written a lot of my kernel in C now, trying to make it more easily compileable on multiple platforms.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

lol, I didn't do call gates as I have no idea how they work...
INF1n1t
Member
Member
Posts: 60
Joined: Fri Dec 22, 2006 5:32 pm
Location: Somewhere Down...

Post by INF1n1t »

hckr83 wrote:lol, I didn't do call gates as I have no idea how they work...
http://www.osdev.org/phpBB2/viewtopic.php?t=12528

I think that clears up the Call Gates Mechanism...
I think, I have problems with Bochs. The biggest one: Bochs hates me!
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Post by JJeronimo »

INF1n1t wrote:
hckr83 wrote:lol, I didn't do call gates as I have no idea how they work...
http://www.osdev.org/phpBB2/viewtopic.php?t=12528

I think that clears up the Call Gates Mechanism...
Call Gates, Interrupt Gates, Control transfers between non-conforming code segments, along with stack switching, TSSs, and things alike are such___a___great___and___very___complex___confusion that I have no idea if I'll ever be mentally capable of understanding it!


I really will need to re-read that chapter of the AMD manual someday...

JJ
Edward
Posts: 13
Joined: Wed Oct 18, 2006 1:12 pm

Post by Edward »

I'm sorry to tell you but intel beat you to some of your functions...
A few similar ones are implemented in microcode on the chip:


http://pdos.csail.mit.edu/6.828/2006/re ... 6/VERR.htm
That one verrifyes a segment is readable or writeable.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

yea, I saw these instructions after I wrote all this..
maybe convert some of them to use asm for faster...
Edward
Posts: 13
Joined: Wed Oct 18, 2006 1:12 pm

Post by Edward »

Somtimes descreete instructions are faster than the single opcodes that are implemented on the chips.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

Somtimes descreete instructions are faster than the single opcodes that are implemented on the chips.
..would've never thought that
Post Reply