How to make a GDT?

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.
zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote: That's a triple fault. The QEMU interrupt log may be useful for finding the problem.
I have attached the log below.
Octocontrabass wrote: If you see this warning, your code is broken. Fix this warning before you try to debug anything.
I have fixed this issue.
Attachments
qemu.txt
(22.31 KiB) Downloaded 44 times
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

Your IDT is invalid because this struct is wrong.
zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote:Your IDT is invalid because this struct is wrong.
What would be the correct way to write the struct? I'm using the one from here.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

zap8600 wrote:I'm using the one from here.
Your struct does not match that struct.
zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote: Your struct does not match that struct.
I need to modify ist to be uint8_t and zero to be uint32_t, I believe. I've done that, but it still isn't working.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

Does it change the exceptions that lead up to the triple fault?
zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote:Does it change the exceptions that lead up to the triple fault?
I believe you are taking about the check_exceptions. No, it doesn't.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

In that case, there are probably other IDT issues.

What is the significance of the first parameter to idt_set_gate?
zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote:In that case, there are probably other IDT issues.

What is the significance of the first parameter to idt_set_gate?
I had forgotten about that argument. It was for writing the data to that IDT entry. I've fixed it, but the exceptions haven't changed.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

Has anything in the interrupt log changed?
zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote:Has anything in the interrupt log changed?
Some things have changed. I put the log from an earlier test and the most recent log through diff. I don't think much changes, though. I'll attach the most recent QEMU log and the diff log.
diff.txt
(3.02 KiB) Downloaded 96 times
qemu2.txt
(22.31 KiB) Downloaded 64 times
devc1
Member
Member
Posts: 439
Joined: Fri Feb 11, 2022 4:55 am
Location: behind the keyboard

Re: How to make a GDT?

Post by devc1 »

Reply for need more explanation (Compiling in Windows is easier):

Well, for all the kernel, the drivers and libraries, this is my command line :

Code: Select all

%COMPILE% %srcfiles% %OBJFILES% /Fo:x86_64/ %CFLAGS% /Fe:oskrnlx64.exe /LD /link /OPT:LBR,REF /DLL /MACHINE:x64 /NODEFAULTLIB /SUBSYSTEM:native /ENTRY:KrnlEntry /FIXED:no /DYNAMICBASE /LARGEADDRESSAWARE
I don't have to makefile, linker.ld and all this complicated stuff.

UEFI is just like a library, you can type any function you need at google and it will show, everything is easily setup.


Hey, do you still have the compiling issues ?
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

zap8600
Member
Member
Posts: 195
Joined: Tue Nov 02, 2021 11:26 am
Libera.chat IRC: zap8600

Re: How to make a GDT?

Post by zap8600 »

Octocontrabass wrote:

Code: Select all

     1: v=0d e=0008
The error code has changed. This error code indicates a problem loading a segment descriptor from the GDT.

Maybe the selector in your IDT doesn't correspond to a valid code segment in your GDT. I don't see where or how your GDT is set up, though.
I was trying to use the GDT set up by Limine. Should I make my own GDT?
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to make a GDT?

Post by Octocontrabass »

Limine provides a GDT you can use temporarily. You'll need to set up your own GDT at some point, though.
Post Reply