Re: kernel panic on readBytes
Re: kernel panic on readBytes
- Subject: Re: kernel panic on readBytes
- From: Terry Lambert <email@hidden>
- Date: Fri, 4 Apr 2008 15:20:05 -0700
On Apr 4, 2008, at 1:59 PM, Timur Alperovich wrote:
Thanks for the prompt responses!
Please see Technical Note 2063.
<http://developer.apple.com/technotes/tn2002/tn2063.html>.
Typing "kernel panic" into the search engine on developer.apple.com
would
turn this up too.
Ok, I figured out how to get the logs, etc, out of it. I tried
searching on google and the apple developer for the error it reports:
AppleDART::mapAddr not mapped for I/O -- and couldn't find anything as
to what could be going on. Any hints? Is there some other way to map
memory pages?
Here is a code snippet of what I'm doing:
IOMemoryDescriptor* d =
IOMemoryDescriptor::withPhysicalAddress(inStruct->offset, 4096,
kIODirectionOut);
if(d == NULL){
IOLog("Failed to grab a descriptor\n");
return kIOReturnError;
}
if(d->prepare() != kIOReturnSuccess){
IOLog("Failed to prepare the page\n");
return kIOReturnError;
}
char buf[4096];
int copied;
copied = d->readBytes(0, (void*) buf, 4096); // <--- Removing this
line gets rid of the panic -- makes me think the error is here.
You can not do I/O to memory which is not in the I/O memory window
mapped by the DART. You are passing it a random buffer, which you did
not allocate out of the I/O memory space (apparently, it is off a
kernel stack).
If you have ever programmed for SPARC or DEC Alpha, they have the same
thing. If you haven't, thing "bounce buffers" for 16 bit devices in a
32 PC operating system, or 32 bit devices in a 64 bit PC operating
system.
Basically, if you follow the examples from <http://
developer.apple.com> and use the proper allocation routine for the
buffer, you will be fine.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden