Physical address returned by IODMACommand exceeds hw.memsize
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=jQlf7LwIuAPFgF7fUsVSOpXVbcVPnQFxNTpeZGUhFIU=; b=i7NIWO5lQfDNkWIJIGd13knOLHQ9Aw2DZ+ffWCANhlE6+K3GCjsemCxPwI9SKV+F6q jBqsJuP2sAQcZxvUY9qyeTecYI35dwmVZw/bRNweuIQpDJKPT2eV8WQTi4tOutPGfOtX JYc3amemdwH7GaEXLKolphhUwh4eRXrXKyino= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Y3VEek66xHHkttNIs9Dxq9Mf3E4UIgW8c8y5Jkggj6Waeli+gYQ6rvlGbiBabo4cvD jRrI6IgHmgMn4IJyzWHLA/EwTiit9kdY3jUepH3ndTNOn97qxMWGbrb3pRA5r/MtCF2k DzFAvsnbbuwu4i0Flrmod3lHi9ostf04Gdf+s= 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 0x%016llx(%llu) is mapped to physical address 0x%016llx(%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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Maxim Zhuravlev