Changeset 90205 in vbox for trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
- Timestamp:
- Jul 15, 2021 5:06:04 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r90113 r90205 2308 2308 AssertPtr(pfnLookup); 2309 2309 2310 RTGCPHYS GCPhysAddr 2311 DMARMEMREQIN MemReqIn = pMemReqRemap->In;2312 uint64_t const uAddrIn = MemReqIn.AddrRange.uAddr;2313 size_t const cbAddrIn = MemReqIn.AddrRange.cb;2314 uint64_t uAddrInBase = MemReqIn.AddrRange.uAddr & X86_PAGE_4K_BASE_MASK;2315 uint64_t offAddrIn = MemReqIn.AddrRange.uAddr & X86_PAGE_4K_OFFSET_MASK;2316 size_t cbRemaining = cbAddrIn;2317 size_t const cbPage = X86_PAGE_4K_SIZE;2310 RTGCPHYS GCPhysAddrOut = NIL_RTGCPHYS; 2311 DMARMEMREQIN MemReqIn = pMemReqRemap->In; 2312 uint64_t const uAddrIn = MemReqIn.AddrRange.uAddr; 2313 size_t const cbAddrIn = MemReqIn.AddrRange.cb; 2314 uint64_t uAddrInBase = MemReqIn.AddrRange.uAddr & X86_PAGE_4K_BASE_MASK; 2315 uint64_t offAddrIn = MemReqIn.AddrRange.uAddr & X86_PAGE_4K_OFFSET_MASK; 2316 size_t cbRemaining = cbAddrIn; 2317 size_t const cbPage = X86_PAGE_4K_SIZE; 2318 2318 2319 2319 int rc; … … 2326 2326 MemReqIn.AddrRange.cb = cbRemaining; /* Not currently accessed by pfnLookup, but keep things consistent. */ 2327 2327 2328 /* Lookup the physical page corresponding to the I/Ovirtual address. */2328 /* Lookup the physical page corresponding to the DMA virtual address. */ 2329 2329 DMARIOPAGE IoPage; 2330 2330 rc = pfnLookup(pDevIns, &MemReqIn, &pMemReqRemap->Aux, &IoPage); … … 2336 2336 Assert((IoPage.fPerm & MemReqIn.AddrRange.fPerm) == MemReqIn.AddrRange.fPerm); 2337 2337 2338 /* Store the translated address before continuing to access more pages. */2338 /* Store the translated address and permissions before continuing to access more pages. */ 2339 2339 if (cbRemaining == cbAddrIn) 2340 2340 { 2341 uint64_t const fOffMask = X86_GET_PAGE_OFFSET_MASK(IoPage.cShift); 2342 uint64_t const offAddrOut = uAddrIn & fOffMask; 2343 Assert(!(IoPage.GCPhysBase & fOffMask)); 2344 GCPhysAddr = IoPage.GCPhysBase | offAddrOut; 2341 uint64_t const offAddrOut = uAddrIn & X86_GET_PAGE_OFFSET_MASK(IoPage.cShift); 2342 GCPhysAddrOut = IoPage.GCPhysBase | offAddrOut; 2345 2343 } 2346 2344 /* Check if addresses translated so far result in a physically contiguous region. */ … … 2361 2359 if (cbRemaining > cbPage - offAddrIn) 2362 2360 { 2363 cbRemaining -= (cbPage - offAddrIn); /* Calculate how much more we need to access. */2364 uAddrInBase += cbPage; /* Update address of the next access. */2365 offAddrIn = 0; /* After first page, allpages are accessed from offset 0. */2361 cbRemaining -= (cbPage - offAddrIn); /* Calculate how much more we need to access. */ 2362 uAddrInBase += cbPage; /* Update address of the next access. */ 2363 offAddrIn = 0; /* After the first page, remaining pages are accessed from offset 0. */ 2366 2364 } 2367 2365 else … … 2376 2374 } 2377 2375 2378 pMemReqRemap->Out.AddrRange.uAddr = GCPhysAddr ;2376 pMemReqRemap->Out.AddrRange.uAddr = GCPhysAddrOut; 2379 2377 pMemReqRemap->Out.AddrRange.cb = cbAddrIn - cbRemaining; 2380 2378 pMemReqRemap->Out.AddrRange.fPerm = IoPagePrev.fPerm;
Note:
See TracChangeset
for help on using the changeset viewer.