| 380 | } |
| 381 | |
| 382 | std::string DmaMemoryPool::Dump() { |
| 383 | std::ostringstream out; |
| 384 | int i = 0; |
| 385 | |
| 386 | out << "DmaMemoryPool at " << this << ": (" << alloced_.size() |
| 387 | << " alive objects)" << std::endl; |
| 388 | |
| 389 | for (const auto ®ion : regions_) { |
| 390 | void *ptr = reinterpret_cast<void *>(region.addr); |
| 391 | out << utils::Format(" free segment %02d vaddr 0x%016" PRIxPTR |
| 392 | " paddr 0x%016" PRIxPTR " size 0x%08zx (%zu)", |
| 393 | i++, region.addr, Virt2Phy(ptr), region.size, |
| 394 | region.size) |
| 395 | << std::endl; |
| 396 | } |
| 397 | |
| 398 | return out.str(); |
| 399 | } |
| 400 | |
| 401 | // Add a new region, and splice it with adjacent regions if necessary |
| 402 | void DmaMemoryPool::AddRegion(uintptr_t addr, size_t size) { |