Page 1 of 1
[SOLVED] What's this? Occurs when reading from ATA device...
Posted: Sat Apr 13, 2013 7:09 am
by HugeCode
Does anybody have any idea what's this?
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: Select all
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();
Re: What's this? Occurs when reading from ATA device...
Posted: Sat Apr 13, 2013 9:58 am
by MDenham
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.
Re: What's this? Occurs when reading from ATA device...
Posted: Sat Apr 13, 2013 11:14 am
by HugeCode
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?
Re: What's this? Occurs when reading from ATA device...
Posted: Sat Apr 13, 2013 11:44 pm
by Kazinsal
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.
Re: What's this? Occurs when reading from ATA device...
Posted: Sun Apr 14, 2013 10:37 am
by MDenham
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.
Re: What's this? Occurs when reading from ATA device...
Posted: Sun Apr 14, 2013 1:23 pm
by Mikemk
HugeCode wrote:Code: Select all
if(*((char*)0xb8000)=='E')
stop();
Or, he could be reading it to video memory.
Re: What's this? Occurs when reading from ATA device...
Posted: Mon Apr 15, 2013 12:01 pm
by HugeCode
I wrote it's working now. It was in adding PE_OPTIONAL_HEADER->imageBase to virtual address. Terms RVA and VA are very confusing.