Bran's OS tutorial Exception handling
Bran's OS tutorial Exception handling
Hey All,
Im going through the Bran Os tutorials and i cannot seem to get the idt set up to handle the exceptions.
Im a bit at a loss as to why its not working. The question is, what are some good ways to debug this early boot code, and are there any "normal" mistakes people usually make when trying to install these?
I can post the source, but for the most part its straight from the tutorials.
I am running this in qemu, and my physical cpu is an amd, which from what i can find doesn't seem like it has a GDT, which could be an issue.
Im going through the Bran Os tutorials and i cannot seem to get the idt set up to handle the exceptions.
Im a bit at a loss as to why its not working. The question is, what are some good ways to debug this early boot code, and are there any "normal" mistakes people usually make when trying to install these?
I can post the source, but for the most part its straight from the tutorials.
I am running this in qemu, and my physical cpu is an amd, which from what i can find doesn't seem like it has a GDT, which could be an issue.
Re: Bran's OS tutorial Exception handling
Eh, all x86 CPU have GDT,
and you're running QEMU which simulates the CPU, and in turn GDT,
Plus if you're booting via GRUB, it sets up a GDT for you.
But yeah, check if you're loading the LIDT with proper values.
and you're running QEMU which simulates the CPU, and in turn GDT,
Plus if you're booting via GRUB, it sets up a GDT for you.
But yeah, check if you're loading the LIDT with proper values.
Re: Bran's OS tutorial Exception handling
What do you mean by this ? All 386 compatible CPUs need a GDT. Remember you must build the GDT.and my physical cpu is an amd, which from what i can find doesn't seem like it has a GDT, which could be an issue.
If a trainstation is where trains stop, what is a workstation ?
Re: Bran's OS tutorial Exception handling
Wiki and a few other places say that GDT is intel specific.gerryg400 wrote:What do you mean by this ? All 386 compatible CPUs need a GDT. Remember you must build the GDT.and my physical cpu is an amd, which from what i can find doesn't seem like it has a GDT, which could be an issue.
Not using grub, letting qemu boot the kernel for me....Nessphoro wrote: Plus if you're booting via GRUB, it sets up a GDT for you.
But yeah, check if you're loading the LIDT with proper values.
i will go back through the LIDT code
thanks!
Re: Bran's OS tutorial Exception handling
Grub tells you not to rely on its GDT. It does load some values into the segment regs but you must not try to reload them without your own GDT.Plus if you're booting via GRUB, it sets up a GDT for you.
If a trainstation is where trains stop, what is a workstation ?
Re: Bran's OS tutorial Exception handling
And your AMD is an Intel clone. Rest assured it needs a GDT.Chocrates wrote:Wiki and a few other places say that GDT is intel specific.
If a trainstation is where trains stop, what is a workstation ?
Re: Bran's OS tutorial Exception handling
Nevertheless it works,gerryg400 wrote:Grub tells you not to rely on its GDT. It does load some values into the segment regs but you must not try to reload them without your own GDT.Plus if you're booting via GRUB, it sets up a GDT for you.
And by GRUB I meant Multiboot compliant bootloader - aka QEMU's
Re: Bran's OS tutorial Exception handling
No dice.
in the link.ld file i had to change phys = 0x00100000; to phys = 0x00001000; to allow qemu to load the kernel image
when compiling the the source from the tutorial, with the only modifcations being removing the underscores from function names in the asm file, and the link.ld file change, the exception handlers dont work.
Any ideas as to why the link.ld change is presumably causing this?
in the link.ld file i had to change phys = 0x00100000; to phys = 0x00001000; to allow qemu to load the kernel image
when compiling the the source from the tutorial, with the only modifcations being removing the underscores from function names in the asm file, and the link.ld file change, the exception handlers dont work.
Any ideas as to why the link.ld change is presumably causing this?
Re: Bran's OS tutorial Exception handling
Can we see your LD script.
Re: Bran's OS tutorial Exception handling
OUTPUT_FORMAT("binary")
ENTRY(_start)
phys = 0x00001000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
ENTRY(_start)
phys = 0x00001000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
Re: Bran's OS tutorial Exception handling
Can you give us some more information of the errors you get..
The only thing I can think of right now is that you are overwriting you own code at some point.
The only thing I can think of right now is that you are overwriting you own code at some point.
Re: Bran's OS tutorial Exception handling
Aha!
turns out it was working flawlessly, except that my puts function doesn't like strings, but instead likes an array of chars....
I will look into that and post here if i fix it, for completeness.
I appologize for wasiting your time!
Edit:
apparently i should have looked harder as well:
http://wiki.osdev.org/Bran%27s_Known_Bugs
turns out it was working flawlessly, except that my puts function doesn't like strings, but instead likes an array of chars....
I will look into that and post here if i fix it, for completeness.
I appologize for wasiting your time!
Edit:
apparently i should have looked harder as well:
http://wiki.osdev.org/Bran%27s_Known_Bugs