[SOLVED] What's this? Occurs when reading from ATA device...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

[SOLVED] What's this? Occurs when reading from ATA device...

Post by HugeCode »

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: 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();
Last edited by HugeCode on Tue Apr 16, 2013 9:48 am, edited 2 times in total.
MDenham
Member
Member
Posts: 62
Joined: Sat Nov 10, 2012 1:16 pm

Re: What's this? Occurs when reading from ATA device...

Post 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.
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: What's this? Occurs when reading from ATA device...

Post 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?
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: What's this? Occurs when reading from ATA device...

Post 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.
MDenham
Member
Member
Posts: 62
Joined: Sat Nov 10, 2012 1:16 pm

Re: What's this? Occurs when reading from ATA device...

Post 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.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: What's this? Occurs when reading from ATA device...

Post by Mikemk »

HugeCode wrote:

Code: Select all

	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.
HugeCode
Member
Member
Posts: 112
Joined: Mon Dec 17, 2012 9:12 am

Re: What's this? Occurs when reading from ATA device...

Post 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.
Post Reply