What do i put in gdt_start and idt_start?

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.
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

What do i put in gdt_start and idt_start?

Post by NunoLava1998 »

I'm trying to load the GDT/IDT using the same method as you would use in Assembly. However, i have no idea what to put in the gdt_start and idt_start sections (I need code this time, since i don't know what are the things that are usually put in there).

Can anyone help?

EDIT: I figured out the idt_start is the one in the struct in the IDT page (dw = uint16_t, db = uint8_t). Only need gdt_start

By "idt_end" and that, i mean:

In Assembly, you only can initialize the IDT or GDT with using lidt or lgdt [gdt_info]/[idt_info]. This needs (g/i)dt_start and (g/i)dt_end. I know what is the value of the _end, but not of the gdt_start one.
I'm trying to implement this in C/C++, however.
Last edited by NunoLava1998 on Mon Jan 02, 2017 3:42 pm, edited 1 time in total.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: What do i put in gdt_start and idt_start?

Post by moondeck »

What exactly are you talking about? gdt_start? idt_start? huh?
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: What do i put in gdt_start and idt_start?

Post by Kevin »

He is just copying code from http://wiki.osdev.org/LGDT without understanding it.

And as the comment there says, what you should put there is "Some GDT entries, like null, kernel code, kernel data, user code, user data, TSS..."
Developer of tyndur - community OS of Lowlevel (German)
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: What do i put in gdt_start and idt_start?

Post by Roman »

Please stop copy-pasting code like a parrot.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: What do i put in gdt_start and idt_start?

Post by moondeck »

faith in humanity is lost
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: What do i put in gdt_start and idt_start?

Post by NunoLava1998 »

Kevin wrote:He is just copying code from http://wiki.osdev.org/LGDT without understanding it.

And as the comment there says, what you should put there is "Some GDT entries, like null, kernel code, kernel data, user code, user data, TSS..."
So? I don't know what those are. I implemented a big part of my IDT/GDT almost-complete loader, not copy pasting.
Besides, i wasn't copy pasting, i was actually chatting with some os devers for 3 hours trying to get IDT to work.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: What do i put in gdt_start and idt_start?

Post by NunoLava1998 »

Roman wrote:Please stop copy-pasting code like a parrot.
i am not in this aspect (tbh just a bit, but not everything).
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: What do i put in gdt_start and idt_start?

Post by moondeck »

Yeah, you were chatting with us, but you didnt wanna understand, and kept telling us GDT isnt needed (LOL).
Please, read and understand before attempting to do this.
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: What do i put in gdt_start and idt_start?

Post by NunoLava1998 »

moondeck wrote:Yeah, you were chatting with us, but you didnt wanna understand, and kept telling us GDT isnt needed (LOL).
Please, read and understand before attempting to do this.
So? I am reading and understanding. It was a while ago actually. And yes, i don't need idt_start (the struct was the idt_start equivalent.). Only gdt_start.

Anyway, can we resume to the question?
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
moondeck
Member
Member
Posts: 56
Joined: Sat Dec 19, 2015 12:18 pm
Libera.chat IRC: moondeck
Location: The Zone, Chernobyl

Re: What do i put in gdt_start and idt_start?

Post by moondeck »

NunoLava1998 wrote: Anyway, can we resume to the question?

NOOOO! WE CANT RESUME! BECAUSE YOU HAVE NO IDEA WHAT YOU'RE DOING!
AND NOOOO! YOU ARE NOT UNDERSTANDING ANYTHING! ALL YOU DO IS COPY THE DAMN CODE!
Last edited by moondeck on Mon Jan 02, 2017 3:51 pm, edited 1 time in total.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: What do i put in gdt_start and idt_start?

Post by iansjack »

Have you no pride whatsoever?
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: What do i put in gdt_start and idt_start?

Post by Roman »

Please read carefully what GDT/IDT and GDTR/IDTR are and what LGDT/LIDT do.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: What do i put in gdt_start and idt_start?

Post by NunoLava1998 »

Roman wrote:Please read carefully what GDT/IDT and GDTR/IDTR are and what LGDT/LIDT do.
GDT: Global Descriptor Table
IDT: Interrupt Descriptor Table

GDTR: Global Descriptor Table Register
IDTR: Interrupt Descriptor Table Register

LGDT: Loads the specified GDT.
LIDT: Loads the specified IDT.
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: What do i put in gdt_start and idt_start?

Post by Love4Boobies »

I think we should calm down a bit. Understanding these data structures means more than just knowing what those acronyms expand to. Their representation and semantics are described in the Intel and AMD manuals. There, you'll find out how they work and if you read their descriptions, you'll know what to put in each entry to get the results you expect in your OS.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
NunoLava1998
Member
Member
Posts: 273
Joined: Sun Oct 09, 2016 4:38 am
Libera.chat IRC: NunoLava1998

Re: What do i put in gdt_start and idt_start?

Post by NunoLava1998 »

moondeck wrote:
NunoLava1998 wrote: Anyway, can we resume to the question?

NOOOO! WE CANT RESUME! BECAUSE YOU HAVE NO IDEA WHAT YOU'RE DOING!
AND NOOOO! YOU ARE NOT UNDERSTANDING ANYTHING! ALL YOU DO IS COPY THE DAMN CODE!
I'm doing this now for several reasons:
  • 1. Later i'll write my own code, i can't write too much code for the very low level of C.
    2. I'm learning, i have to understand code.
    3. I actually have started making code myself.
Can't you just (and other OSDevers in the forum) treat me like a normal user? Can't i just get a nice answer?
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS
Post Reply