OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 10:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [SOLVED] What's this? Occurs when reading from ATA device...
PostPosted: Sat Apr 13, 2013 7:09 am 
Offline
Member
Member

Joined: Mon Dec 17, 2012 9:12 am
Posts: 112
Does anybody have any idea what's this?
Image
I'm reading from ATA several times, but when I read .data, this appears. I can read something like Exception, but I have all exception handlers set and I'm sure this is not in handler code. I also masked all PIC interrupts, but this still appears...
Code:
for(i = 0;i < pehdr.sectionCount; i++, sect++) {
   if(sect->rawDataAddress==0 || sect->name[0]!='.') {
      continue;
   }
   for(z = 0; z < sect->virtualSize/(sectorsPerCluster*512);z++) {
      kernel_read_cluster(device, fatLBA, rawStart, clust, sect->rawDataAddress/(sectorsPerCluster*512)+z, sectorsPerCluster, (void*)(sect->virtualAddress + z*(sectorsPerCluster*512)));
   }
   if(*((char*)0xb8000)=='E')
      stop();


Last edited by HugeCode on Tue Apr 16, 2013 9:48 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: What's this? Occurs when reading from ATA device...
PostPosted: Sat Apr 13, 2013 9:58 am 
Offline
Member
Member

Joined: Sat Nov 10, 2012 1:16 pm
Posts: 62
Well, I have an idea of what's going on - specifically, one of your print routines is written such that it's just dumping the entire string directly to memory without adding attribute bytes, or something is using the start of video memory as a buffer when it shouldn't be, giving the same result - but I can also tell you that the issue isn't in the code you posted.


Top
 Profile  
 
 Post subject: Re: What's this? Occurs when reading from ATA device...
PostPosted: Sat Apr 13, 2013 11:14 am 
Offline
Member
Member

Joined: Mon Dec 17, 2012 9:12 am
Posts: 112
ohhhh no. The ONLY mistake I've done was writing directly to virtual address, without adding image base. BTW there's a video memory on 0x3000 or 0x4000? And of course, I didn't commented it out. I removed it and it was less memory waqsting than the code I currently have.
BTW why did the output work with 0x3000?


Top
 Profile  
 
 Post subject: Re: What's this? Occurs when reading from ATA device...
PostPosted: Sat Apr 13, 2013 11:44 pm 
Offline
Member
Member
User avatar

Joined: Wed Jul 13, 2011 7:38 pm
Posts: 558
MDenham wrote:
Well, I have an idea of what's going on - specifically, one of your print routines is written such that it's just dumping the entire string directly to memory without adding attribute bytes ...

This is exactly the case.

Notice the word "Ecpin" showing up a lot in the output. Each letter has a different attribute byte.

Exception.


Top
 Profile  
 
 Post subject: Re: What's this? Occurs when reading from ATA device...
PostPosted: Sun Apr 14, 2013 10:37 am 
Offline
Member
Member

Joined: Sat Nov 10, 2012 1:16 pm
Posts: 62
Blacklight wrote:
MDenham wrote:
Well, I have an idea of what's going on - specifically, one of your print routines is written such that it's just dumping the entire string directly to memory without adding attribute bytes ...

This is exactly the case.

Notice the word "Ecpin" showing up a lot in the output. Each letter has a different attribute byte.

Exception.
Well, that's what led me to that conclusion, but it isn't necessarily the print routine that's causing the problems. Something else could be (improperly) using video memory as a buffer instead, which would cause the same issues.


Top
 Profile  
 
 Post subject: Re: What's this? Occurs when reading from ATA device...
PostPosted: Sun Apr 14, 2013 1:23 pm 
Offline
Member
Member

Joined: Sat Oct 22, 2011 12:27 pm
Posts: 409
HugeCode wrote:
Code:
   if(*((char*)0xb8000)=='E')
      stop();

Or, he could be reading it to video memory.

_________________
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.


Top
 Profile  
 
 Post subject: Re: What's this? Occurs when reading from ATA device...
PostPosted: Mon Apr 15, 2013 12:01 pm 
Offline
Member
Member

Joined: Mon Dec 17, 2012 9:12 am
Posts: 112
I wrote it's working now. It was in adding PE_OPTIONAL_HEADER->imageBase to virtual address. Terms RVA and VA are very confusing.


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

All times are UTC - 6 hours


Who is online

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