Grub+elf-kernel
Re:Grub+elf-kernel
I'd like to use this chance to make a public appeal for people to respond to advice in the right way.
Wrong way: "It doesn't work."
Right way: "I tried this, and it gives me the error message 'xxx'.".
Merely stating that something doesn't work is useless, and makes the person giving the advice guess what is wrong: "You say it doesn't work? Have you checked your roof? Maybe it's leaking onto your computer."
Wrong way: "It doesn't work."
Right way: "I tried this, and it gives me the error message 'xxx'.".
Merely stating that something doesn't work is useless, and makes the person giving the advice guess what is wrong: "You say it doesn't work? Have you checked your roof? Maybe it's leaking onto your computer."
Re:Grub+elf-kernel
Hi,
KJ, i tried it, but it not works. I think the problem is in my common.asm file, which i posted before.
When GRUB loads my kernel, don't gives me any error only resets the computer. I tried to delete some lines to test any try to find the error but i can't.
Anyone can help me?
KJ, i tried it, but it not works. I think the problem is in my common.asm file, which i posted before.
When GRUB loads my kernel, don't gives me any error only resets the computer. I tried to delete some lines to test any try to find the error but i can't.
Anyone can help me?
Re:Grub+elf-kernel
Hi, elJedi ,
maybe, you can track down your bug with this kind of trick:
move 0xb8000 to register gs. This is ok, unless you load a protected mode selector for video memory.
mov ax,0xb8000
mov gs,ax
then output a character:
mov[gs:0],'a'
mov[gs:2],'b'
...
you can place these moves anywhere in your code to
track, where you are.
you can also put some 'hlt' instructions and check, how far your program runs before reset.
I've seen this nifty trick on some page i do not remember at the moment. it could be on john fines pages.
bye
thomas
www.distantvoices.org
maybe, you can track down your bug with this kind of trick:
move 0xb8000 to register gs. This is ok, unless you load a protected mode selector for video memory.
mov ax,0xb8000
mov gs,ax
then output a character:
mov[gs:0],'a'
mov[gs:2],'b'
...
you can place these moves anywhere in your code to
track, where you are.
you can also put some 'hlt' instructions and check, how far your program runs before reset.
I've seen this nifty trick on some page i do not remember at the moment. it could be on john fines pages.
bye
thomas
www.distantvoices.org
Re:Grub+elf-kernel
Hi Thomas, and Thanks for your suggestion.
I have fixed it!! My kernel is loaded by grub. but I have a new problem, here the steps followed by my kernel:
My kernel is loaded in 0x101000
reallocate the GDT in 0x100900
load GDT
reallocate the IDT in 0x100000
load IDT
start text mode,
clear screen
printf("All ok")
init IDT with firsts ISRs
Enable IRQ 0 and 1
install handlers for PIT and Keyboard
printf("Freezing PC");
and while (1)
The messages are printed on the screen but when i hit a key or when the timer makes an interrupt, it resets my PC.
I've checked the IDT and ISRs codes and steps reallocation code, and even in all code searching if there was any address lower than 0x100000 but there isn't.
If I use Tom's boot loader, the kernel works fine. But with GRUB not.
Any suggestion?
thanks for all
I have fixed it!! My kernel is loaded by grub. but I have a new problem, here the steps followed by my kernel:
My kernel is loaded in 0x101000
reallocate the GDT in 0x100900
load GDT
reallocate the IDT in 0x100000
load IDT
start text mode,
clear screen
printf("All ok")
init IDT with firsts ISRs
Enable IRQ 0 and 1
install handlers for PIT and Keyboard
printf("Freezing PC");
and while (1)
The messages are printed on the screen but when i hit a key or when the timer makes an interrupt, it resets my PC.
I've checked the IDT and ISRs codes and steps reallocation code, and even in all code searching if there was any address lower than 0x100000 but there isn't.
If I use Tom's boot loader, the kernel works fine. But with GRUB not.
Any suggestion?
thanks for all
Re:Grub+elf-kernel
Are you talking about my bootloader?eL JeDi wrote: If I use Tom's boot loader, the kernel works fine. But with GRUB not.
Yes....lets see your ISR code and i'll fix it because that is most likely the problem.eL JeDi wrote: Any suggestion?
Re:Grub+elf-kernel
Hi,
When I load my kernel with your bootloader all works ok. But when using grub not works.
In file atached are my ISrs
--------------------------------------------
Here you have the C ruote all ISRs calls. ( not the IRQs)
void exc0(dword excepcion)
{
asm("cli");
switch (excepcion)
{
case 0: panic("Error de division",3);
break;
case 1: panic("Error de depuracion",3);
break;
case 2: panic("Error: Interrupcion no enmascarable",3);
break;
case 3: panic("Error de Breakpoint",3);
break;
case 4: panic("Error de Overflow",3);
break;
case 5: panic("Bound Exception",3);
break;
case 6: panic("Invalid Opcode",3);
break;
case 7: panic("FPU not available",3);
break;
case 8: panic("Doble Fault",3);
break;
case 9: panic("Coprocessor Segment Overrun",3);
break;
case 10: panic("Invalid TSS",3);
break;
case 11: panic("Segment not present",3);
break;
case 12: panic("Stack exception",3);
break;
case 13: panic("General Protection",3);
break;
case 14: panic("Page fault",3);
break;
case 15: panic("Floating-point error",3);
break;
}
asm("HLT");
}
Yes. If i use it on my p-100 works perfectly. On my p4 not worksAre you talking about my bootloader?
When I load my kernel with your bootloader all works ok. But when using grub not works.
In file atached are my ISrs
--------------------------------------------
Here you have the C ruote all ISRs calls. ( not the IRQs)
void exc0(dword excepcion)
{
asm("cli");
switch (excepcion)
{
case 0: panic("Error de division",3);
break;
case 1: panic("Error de depuracion",3);
break;
case 2: panic("Error: Interrupcion no enmascarable",3);
break;
case 3: panic("Error de Breakpoint",3);
break;
case 4: panic("Error de Overflow",3);
break;
case 5: panic("Bound Exception",3);
break;
case 6: panic("Invalid Opcode",3);
break;
case 7: panic("FPU not available",3);
break;
case 8: panic("Doble Fault",3);
break;
case 9: panic("Coprocessor Segment Overrun",3);
break;
case 10: panic("Invalid TSS",3);
break;
case 11: panic("Segment not present",3);
break;
case 12: panic("Stack exception",3);
break;
case 13: panic("General Protection",3);
break;
case 14: panic("Page fault",3);
break;
case 15: panic("Floating-point error",3);
break;
}
asm("HLT");
}
Re:Grub+elf-kernel
::) jejej, and the file with ISRs... ::)
sorry ;D
[attachment deleted by admin]
sorry ;D
[attachment deleted by admin]
Re:Grub+elf-kernel
:D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D
I fix it!!!!!!!!!
Now my "kernel" works completly. :)
I only have one question:
I use this code to rellocate the IDT:
mov edi, IDT_start
mov esi, idt
mov ecx, (idt_end-idt)
cld
rep movsd
and this for GDT:
mov esi, gdt
mov edi, GDT_start
mov ecx, (gdt_end-gdt)
cld
rep movsd
Why if I choose IDT_start= 0x100000 not works, but it I choose 0x600 it works? It works only when GDT is reallocated to 0x500 and not o 0x100900
I don't understand it.
Thanks for all
I fix it!!!!!!!!!
Now my "kernel" works completly. :)
I only have one question:
I use this code to rellocate the IDT:
mov edi, IDT_start
mov esi, idt
mov ecx, (idt_end-idt)
cld
rep movsd
and this for GDT:
mov esi, gdt
mov edi, GDT_start
mov ecx, (gdt_end-gdt)
cld
rep movsd
Why if I choose IDT_start= 0x100000 not works, but it I choose 0x600 it works? It works only when GDT is reallocated to 0x500 and not o 0x100900
I don't understand it.
Thanks for all
Re:Grub+elf-kernel
I suggest you don't use my bootloader till a new one is made...it is full of logical bugs and some things I didn't look at to fix.... :-[
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Grub+elf-kernel
Instead of that huge switch, why don't you just create an array of strings ?eL JeDi wrote: Hi,
Here you have the C ruote all ISRs calls. ( not the IRQs)
void exc0(dword excepcion)
{
asm("cli");
switch (excepcion)
{
case 0: panic("Error de division",3);
...
case 15: panic("Floating-point error",3);
break;
}
asm("HLT");
}
Code: Select all
char *exception_msg[]={"Error de division", ... ,"Floating-point error" };
Code: Select all
panic(exception_msg[exception],3)
It would be from fare more efficient.
Re:Grub+elf-kernel
Solar ray, ok.
Pype.clicker, i've made the changes yet.
Thanks for suggestions
But now i would like to kwon why if I load my kernel at 0x101000 with GRUB reallocating IDT and GDT at 0x100000 and 0x100900 don't works, but if I choose 0x600 for IDT and 0x500 for GDT it works.
Cananyone explain me it?
Pype.clicker, i've made the changes yet.
Thanks for suggestions
But now i would like to kwon why if I load my kernel at 0x101000 with GRUB reallocating IDT and GDT at 0x100000 and 0x100900 don't works, but if I choose 0x600 for IDT and 0x500 for GDT it works.
Cananyone explain me it?