OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 8:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Polling PMode Floppy Driver
PostPosted: Sat May 23, 2020 1:40 pm 
Offline

Joined: Sat May 23, 2020 1:13 pm
Posts: 1
I'm currently writing a floppy driver for a 32-bit protected mode OS. I'm planning not to use DMA or any other asynchronous things for now, as my OS is single-tasking. I have interrupts disabled in the floppy controller for the same reason. I read the wiki page here on the floppy controller, but I can't figure out how to read a sector from a drive properly. My current floppy driver source code (32-bit GNU C) is attached. panic prints the supplied message and a stacktrace, then halts. SPT is the sectors per track, taken from the FAT record in the boot sector. On boot, my kernel calls init_floppy, then uses read_sectors to read the FAT from disk into memory. When I run my kernel, the panic function on line 95 in floppy_out is called. Going up the stack, this is called from line 102 in floppy_sense, from line 168 in read_sector, from line 192 in read_sectors. I'm not sure what's going wrong here. Am I not supposed to do a sense interrupt after issuing a read command? Is my read command malformed? Is there an earlier error that goes undetected until now?


Attachments:
floppy.c [4.29 KiB]
Downloaded 13 times
Top
 Profile  
 
 Post subject: Re: Polling PMode Floppy Driver
PostPosted: Tue May 26, 2020 4:38 am 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
benjidial wrote:
Am I not supposed to do a sense interrupt after issuing a read command?

You're supposed to poll MSR. The sense interrupt command is meant to be used with the seek and recalibrate commands.

(I'd argue that you're supposed to use DMA and IRQs, but it's your OS and you can make it however you want.)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Google [Bot], Majestic-12 [Bot], Octocontrabass and 173 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group