Page 1 of 2
Getting GPF!!
Posted: Wed Feb 19, 2020 1:22 pm
by Bonfra
It has been a month since i achived to do some progress on my os. I just can't get interrupts to work! I've followed brokenthorn scheme but used GNU compiler since on linux... here is my code pleas help me i don't know what else to do.
https://github.com/Bonfra04/OS-DEV
Re: Getting GPF!!
Posted: Thu Feb 20, 2020 8:38 am
by Octocontrabass
Where does the GPF occur?
Have you tried running your code in a debugger to see where it starts misbehaving?
Re: Getting GPF!!
Posted: Thu Feb 20, 2020 10:18 am
by iansjack
Just saying "I can't get xxx to work" is unlikely to elicit many responses. Have a read of this:
https://wiki.osdev.org/How_To_Ask_Questions
It's not helped by the fact that there seems to be something wrong with your repository. I can't browse your files (and it's full of object files).
Re: Getting GPF!!
Posted: Thu Feb 20, 2020 10:33 am
by PeterX
iansjack wrote:I can't browse your files (and it's full of object files).
I don't have those problems. I can browse the files and it seems to me they are mostly source files.
And you both are totally right: Original poster, please tell more details what you are actually doing and what precisely is causing the problem.
Have you done any sort of debugging? Either with a debugger or by letting your kernel write infos to the screen.
Re: Getting GPF!!
Posted: Thu Feb 20, 2020 12:41 pm
by iansjack
Strange - it looks OK to me now.
Re: Getting GPF!!
Posted: Mon Feb 24, 2020 11:54 am
by Bonfra
Octocontrabass wrote:Where does the GPF occur?
Have you tried running your code in a debugger to see where it starts misbehaving?
Not used a debugger (don't know how) but i think that is something to do with the pit/pic since if the kernel ends in a short time it behaves fine but if i set a loop so keep it running for enough time it throws the exception.. I've been trying since posted to fix but found nothing..
Re: Getting GPF!!
Posted: Mon Feb 24, 2020 11:57 am
by Bonfra
PeterX wrote:iansjack wrote:I can't browse your files (and it's full of object files).
I don't have those problems. I can browse the files and it seems to me they are mostly source files.
And you both are totally right: Original poster, please tell more details what you are actually doing and what precisely is causing the problem.
Have you done any sort of debugging? Either with a debugger or by letting your kernel write infos to the screen.
Yes, i actually forgot to clean the bin-int folder but the sources are present. I've tried to make the kernel print the current state until exception and as i've specified the previous post it happens if the kernel runs for enough time to activate the pit interrupts
Re: Getting GPF!!
Posted: Mon Feb 24, 2020 12:00 pm
by Bonfra
I'd apology to all of you since i'm kinda new to OS-Devving and formus... also english is not my language so i have a little difficulty to express problems XD
Re: Getting GPF!!
Posted: Mon Feb 24, 2020 12:03 pm
by iansjack
Bonfra wrote:
Not used a debugger (don't know how)
Now is the time to learn, whilst you have a trivial problem to track down. The knowledge gained will be invaluable as you run into more intractable problems.
Re: Getting GPF!!
Posted: Mon Feb 24, 2020 2:24 pm
by Bonfra
iansjack wrote:Bonfra wrote:
Not used a debugger (don't know how)
Now is the time to learn, whilst you have a trivial problem to track down. The knowledge gained will be invaluable as you run into more intractable problems.
ok.. really stupid question. How? i mean (following BrokenThorn tutorial) i should create a vfd, partcopy the bootloader in the floppy drive and then boot with bochs. since on windows 10 i did not achive to use vfd or partcopy; i used a windows vista virtual machine to install the bootloader in the vfd and poweriso to create an ISO of the drive. than took the iso to main pc and installed it to a usb-stick in wich i put the kernel bins. i then boot another device from the usb-stick. i know is very impractical but is the only way i fought of. any suggestions?
Re: Getting GPF!!
Posted: Mon Feb 24, 2020 3:03 pm
by iansjack
A combination of qemu and gdb is a good tool.
https://wiki.osdev.org/QEMU#GDB-Stub
Re: Getting GPF!!
Posted: Tue Feb 25, 2020 10:56 am
by Bonfra
Finally achieved to create a .ISO file containing the OS:
dd if=/dev/zero of=floppy.img bs=1024 count=1440
dd if=Boot.bin of=floppy.img seek=0 count=1 conv=notrunc
genisoimage -quiet -V 'BonsOS' -input-charset iso8859-1 -o BonsOS.iso -b floppy.img -hide floppy.img iso-int/
and it works fine... But.. the first stage bootloader does not find the KRNLDR.SYS file (second stage bootloader)..
i think it can't read files
launched qemu with:
qemu-system-i386 -boot d -cdrom BonsOS.iso
EDIT:
tried with hyper-v and got the same problem so i think is that the problem is in the way i generate the iso
inspecting the iso with poweriso:
also updated git-folder with commands to generate iso
EDIT2:
when burning the iso to a usb and booting a real hardware from it, triple-fault and reboot. but if i use the old system explained above with the same code it works fine
Re: Getting GPF!!
Posted: Wed Feb 26, 2020 2:42 am
by Octocontrabass
Bonfra wrote:Finally achieved to create a .ISO file containing the OS:
Why are you creating an ISO? Your bootloader only works with floppy disks, so you should be creating a floppy disk image. Qemu can boot from a floppy disk image, if that's what you're trying to do.
(It's possible to make a CD that will boot as an emulated floppy disk, but you need a working floppy disk image first.)
Re: Getting GPF!!
Posted: Wed Feb 26, 2020 4:35 pm
by Bonfra
Octocontrabass wrote:Bonfra wrote:Finally achieved to create a .ISO file containing the OS:
Why are you creating an ISO? Your bootloader only works with floppy disks, so you should be creating a floppy disk image. Qemu can boot from a floppy disk image, if that's what you're trying to do.
(It's possible to make a CD that will boot as an emulated floppy disk, but you need a working floppy disk image first.)
i think i'm a total idiot! thanks a lot now i can use qemu with the floppy image and debug the os
. But the main problem persist.. GPF how can i fix it? i really have no idea.. is it with the bootloader that messes up something or is the interrupts setup in the kernel?
Re: Getting GPF!!
Posted: Wed Feb 26, 2020 9:30 pm
by kzinti
Which part of "learning to use a debugger" isn't clear to you?