Getting GPF!!

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.
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Getting GPF!!

Post 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
Regards, Bonfra.
Octocontrabass
Member
Member
Posts: 5578
Joined: Mon Mar 25, 2013 7:01 pm

Re: Getting GPF!!

Post by Octocontrabass »

Where does the GPF occur?

Have you tried running your code in a debugger to see where it starts misbehaving?
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Getting GPF!!

Post 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).
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Getting GPF!!

Post 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.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Getting GPF!!

Post by iansjack »

Strange - it looks OK to me now.
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Getting GPF!!

Post 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..
Regards, Bonfra.
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Getting GPF!!

Post 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
Regards, Bonfra.
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Getting GPF!!

Post 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
Regards, Bonfra.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Getting GPF!!

Post 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.
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Getting GPF!!

Post 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?
Regards, Bonfra.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Getting GPF!!

Post by iansjack »

A combination of qemu and gdb is a good tool.

https://wiki.osdev.org/QEMU#GDB-Stub
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Getting GPF!!

Post by Bonfra »

iansjack wrote:A combination of qemu and gdb is a good tool.

https://wiki.osdev.org/QEMU#GDB-Stub
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:
Image

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
Regards, Bonfra.
Octocontrabass
Member
Member
Posts: 5578
Joined: Mon Mar 25, 2013 7:01 pm

Re: Getting GPF!!

Post 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.)
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Getting GPF!!

Post 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?
Regards, Bonfra.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: Getting GPF!!

Post by kzinti »

Which part of "learning to use a debugger" isn't clear to you?
Post Reply