OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Nov 21, 2019 5:17 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: OSDev Wiki ATA read/write sectors code not working right
PostPosted: Wed Apr 24, 2019 10:48 am 
Offline

Joined: Sun Apr 21, 2019 7:39 am
Posts: 18
https://wiki.osdev.org/ATA_read/write_sectors
Some of the time, it does work, some of the time it does not.
I can only read and write in one function, then the code quits working.

https://gist.github.com/iProgramMC/8328 ... 9bdfd6909f
https://gist.github.com/iProgramMC/8d92 ... 52e7b76b31

The basic code required to test the functions is here.
The code returns zeros from the FileOpen function, even though the InitFilesystem function worked beforehand and made a full tree of the filesystem.

File system is very simple, you've got the classical BPB boot-sector, then 16 sectors' worth of root directory files, and data area.
All other FAT features were stripped down as this is planned to be a read-only file system.
Its main purpose is to load other programs into memory.

I'm not sure what causes the random halt of the functioning of AtaLbaRead and AtaLbaWrite, but I have a suspicion it may be in regards to the drive not being initialized and such, even though the file system was loaded successfully.

Please help?


Top
 Profile  
 
 Post subject: Re: OSDev Wiki ATA read/write sectors code not working right
PostPosted: Wed Apr 24, 2019 12:55 pm 
Offline

Joined: Sun Apr 21, 2019 7:39 am
Posts: 18
Please help!


Top
 Profile  
 
 Post subject: Re: OSDev Wiki ATA read/write sectors code not working right
PostPosted: Wed Apr 24, 2019 3:49 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
i think that you're messing up some code.
in the wiki says:
Code:
mov edx, 0x1f4
mov eax, ebx
shr eax, 8
out dx, al


and then

Code:
mov edx, 0x1f4
mov eax, ebx
shr eax, 16
out dx, al


but instead in your code you're doing:
Code:
mov edx, 0x1f4
mov eax, ebx
shr eax, 16
out dx, al


correct me if i'm wrong


Top
 Profile  
 
 Post subject: Re: OSDev Wiki ATA read/write sectors code not working right
PostPosted: Thu Apr 25, 2019 6:09 am 
Offline

Joined: Sun Apr 21, 2019 7:39 am
Posts: 18
I've fixed it.
The resulting array is still inconsistent even if I read the same sector over and over.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: MSN [Bot] and 8 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