Hi everyone, I'm new! Sorry for my bad english but I'm Italian and I'm using Google Translator! Returning to the topic, I'm writing this OS and have a good point, I wrote the GDT, IDT, ISR, FPU, Drivers Keyboard and Mouse, Timer, IRQ, floppy drives and FAT file system, the latter with the help of: http: / / http://www.brokenthorn.com/Resources/OSDev22.html, but I have a problem with the filesystem.
The guide is written that to mount the FAT, just do:
p_bootsector_t bootsector = (p_bootsector_t) flp_read_sector (0);
/ / And other code ...
But when I go to start the car sends me into a kernel panic for Division by zero in fact doing a log of all the variables:
bootsector-> Bpb.NumSectors
bootsector-> Bpb.SectorsPerFat
bootsector-> Bpb.NumDirEntries
(Bootsector-> Bpb.NumDirEntries * 32) / bootsector-> Bpb.BytesPerSector
give me all result 0, but I do not understand why, I also did a test by entering the correct values (taken from the internet), but the output is an infinite series of strings "0 @ P` p ', and do not understand the why!
Can you give me a hand?
Thank you very much
PS: I followed the guide only to implement the drivers in C for DMA, FDC and FAT! Maybe there's more to implement?
OSDEV: FAT filesystem problem on my Operating System
Re: OSDEV: FAT filesystem problem on my Operating System
Can you provide content of floppy image?
Re: OSDEV: FAT filesystem problem on my Operating System
Certainly!
os.img:
\kernel.bin
\fil.txt (what I read)
\boot\grub\stage1
\boot\grub\stage2
\boot\grub\menu.cfg
P.S: Here is my github with code: https://github.com/Piso94/MudStorm-OS
os.img:
\kernel.bin
\fil.txt (what I read)
\boot\grub\stage1
\boot\grub\stage2
\boot\grub\menu.cfg
P.S: Here is my github with code: https://github.com/Piso94/MudStorm-OS
Re: OSDEV: FAT filesystem problem on my Operating System
Ok, now I was able to go the fat_mount () thanks to:
But now, when I go to read the fil.txt I do not write anything on the screen! I try to debug and let you know;)
Edit:
I was able to run the floppy ... for the kernel panic was a problem in the code of the driver floppy! But now I have a 'other problem ... that can not recognize me, do you read my files ... that even though I to the "open" the step "0", he wrote to me in a video sequence of "S" endless! How come? He can not understand ... but I double checked the code of the fat and there is no inequality!
I also checked the floppy image ... is formatted in FAT 12 bit ... the same code version of the guide FAT! How can I do? thanks
NB: Now I'm back to the code of guidance, namely:
Code: Select all
p_bs_t bootsector;
uint8_t *sector = flp_read_sector(0);
for (int i=0;i<(sizeof(p_bs_t) - 2);i++)
((uint8_t*)&bootsector)[i] = sector[i];
// Other code...
Edit:
I was able to run the floppy ... for the kernel panic was a problem in the code of the driver floppy! But now I have a 'other problem ... that can not recognize me, do you read my files ... that even though I to the "open" the step "0", he wrote to me in a video sequence of "S" endless! How come? He can not understand ... but I double checked the code of the fat and there is no inequality!
I also checked the floppy image ... is formatted in FAT 12 bit ... the same code version of the guide FAT! How can I do? thanks
NB: Now I'm back to the code of guidance, namely:
Code: Select all
p_bs_t bootsector;
bootsector = (p_bs_t)flp_read_sector(0);