Physical address returned by IODMACommand exceeds hw.memsize
Physical address returned by IODMACommand exceeds hw.memsize
- Subject: Physical address returned by IODMACommand exceeds hw.memsize
- From: Maxim Zhuravlev <email@hidden>
- Date: Mon, 29 Nov 2010 11:49:05 +0300
Hi,
consider the following code:
void* allocPage(uint64_t* phys_addr)
{
void* result = NULL;
IOBufferMemoryDescriptor* descriptor = NULL;
descriptor = IOBufferMemoryDescriptor::withOptions(
kIODirectionInOut|kIOMemoryPhysicallyContiguous,
page_size, page_size);
descriptor->prepare();
*phys_addr = -1;
IODMACommand* dma =
IODMACommand::withSpecification(kIODMACommandOutputHost64,
64,
0,
IODMACommand::kMapped,
0,
1);
if (kIOReturnSuccess == dma->setMemoryDescriptor(descriptor))
{
IODMACommand::Segment64 segments[1];
UInt32 numSegments = 1;
UInt64 offset = 0;
if (kIOReturnSuccess ==
dma->gen64IOVMSegments(&offset, segments, &numSegments))
*phys_addr = segments[0].fIOVMAddr;
dma->clearMemoryDescriptor();
}
dma->release();
result = descriptor->getBytesNoCopy();
IOLog("virtual address 0x6llx(%llu) is mapped to physical
address 0x6llx(%lld)\n", result, result, *phys_addr, *phys_addr);
return result;
}
On a MacPro4,1 with OSX 10.6.4, 6gb of ram installed (hw.memsize:
6442450944) and boot-args="debug=0x14e arch=x86_64 himemory_mode=2
dart=0":
virtual address 0xffffff8087c35000(18446743526231461888) is mapped to
physical address 0x00000001f202b000(8355229696)
virtual address 0xffffff8087c3e000(18446743526231498752) is mapped to
physical address 0x00000001f22ac000(8357855232)
virtual address 0xffffff8087c45000(18446743526231527424) is mapped to
physical address 0x00000001f1d2d000(8352092160)
virtual address 0xffffff8087c46000(18446743526231531520) is mapped to
physical address 0x00000001f1eae000(8353669120)
Well, everything works just fine, so I'm just curious, where does this
extra memory come from?
Thanks in advance.
_______________________________________________
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