Changeset 70740 in vbox
- Timestamp:
- Jan 25, 2018 2:13:56 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120499
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcArch.cpp
r69500 r70740 23 23 #include <VBox/vmm/pdmdev.h> 24 24 #include <VBox/vmm/mm.h> 25 #include <VBox/vmm/pgm.h> 25 26 #include <VBox/log.h> 26 27 #include <VBox/err.h> … … 186 187 187 188 /** 189 * @callback_method_impl{FNIOMMMIOWRITE, Ignores writes to the reserved memory.} 190 */ 191 static DECLCALLBACK(int) pcarchReservedMemoryWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, 192 void const *pv, unsigned cb) 193 { 194 Log2(("pcarchReservedMemoryRead: %#RGp LB %#x %.*Rhxs\n", GCPhysAddr, cb, RT_MIN(cb, 16), pv)); 195 NOREF(pDevIns); NOREF(pvUser); NOREF(GCPhysAddr); NOREF(pv); NOREF(cb); 196 return VINF_SUCCESS; 197 } 198 199 200 /** 201 * @callback_method_impl{FNIOMMMIOREAD, The reserved memory reads as 0xff.} 202 */ 203 static DECLCALLBACK(int) pcarchReservedMemoryRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) 204 { 205 Log2(("pcarchReservedMemoryRead: %#RGp LB %#x\n", GCPhysAddr, cb)); 206 NOREF(pDevIns); NOREF(pvUser); NOREF(GCPhysAddr); 207 memset(pv, 0xff, cb); 208 return VINF_SUCCESS; 209 } 210 211 212 /** 213 * @interface_method_impl{PDMDEVREG,pfnInitComplete, 214 * Turn RAM pages between 0xa0000 and 0xfffff into reserved memory.} 215 */ 216 static DECLCALLBACK(int) pcarchInitComplete(PPDMDEVINS pDevIns) 217 { 218 PVM pVM = PDMDevHlpGetVM(pDevIns); 219 int iRegion = 0; 220 RTGCPHYS const GCPhysEnd = 0x100000; 221 RTGCPHYS GCPhysCur = 0x0a0000; 222 do 223 { 224 if (!PGMPhysIsGCPhysNormal(pVM, GCPhysCur)) 225 GCPhysCur += X86_PAGE_SIZE; 226 else 227 { 228 RTGCPHYS const GCPhysStart = GCPhysCur; 229 do 230 GCPhysCur += X86_PAGE_SIZE; 231 while (GCPhysCur < GCPhysEnd && PGMPhysIsGCPhysNormal(pVM, GCPhysCur)); 232 233 int rc = PDMDevHlpMMIORegister(pDevIns, GCPhysStart, GCPhysCur - GCPhysStart, NULL /*pvUser*/, 234 IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU, 235 pcarchReservedMemoryWrite, pcarchReservedMemoryRead, 236 MMR3HeapAPrintf(pVM, MM_TAG_PGM_PHYS /* bad bird*/, "PC Arch Reserved #%u", iRegion)); 237 AssertLogRelRCReturn(rc, rc); 238 } 239 } while (GCPhysCur < GCPhysEnd); 240 241 return VINF_SUCCESS; 242 } 243 244 245 /** 188 246 * @interface_method_impl{PDMDEVREG,pfnConstruct} 189 247 */ … … 271 329 NULL, 272 330 /* pfnInitComplete. */ 273 NULL,331 pcarchInitComplete, 274 332 /* pfnPowerOff */ 275 333 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.