- Timestamp:
- Apr 5, 2016 12:33:14 AM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
r60320 r60321 970 970 ASMSetIDTR(&Idtr); 971 971 Bs3TrapSetJmpAndRestore(&Ctx81, &TrapCtx); 972 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx81, 0 /*uErrCd*/, uCr2Expected); 972 if (f486Plus) 973 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx81, 0 /*uErrCd*/, uCr2Expected); 974 else 975 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx81, X86_TRAP_PF_RW /*uErrCd*/, uCr2Expected + 4 - RT_MIN(j, 4)); 973 976 g_usBs3TestStep++; 974 977 … … 982 985 ASMSetIDTR(&Idtr); 983 986 Bs3TrapSetJmpAndRestore(&Ctx81, &TrapCtx); 984 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx81, 0 /*uErrCd*/, uCr2Expected); 987 if (f486Plus) 988 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx81, 0 /*uErrCd*/, uCr2Expected); 989 else 990 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx81, X86_TRAP_PF_RW /*uErrCd*/, uCr2Expected + 4 - RT_MIN(j, 4)); 985 991 g_usBs3TestStep++; 986 992 … … 1119 1125 { 1120 1126 Bs3TrapSetJmpAndRestore(&Ctx80, &TrapCtx); 1121 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx80, 0 /*uErrCd*/, GdtrSaved.pGdt + BS3_SEL_TEST_PAGE_00); 1127 if (f486Plus) 1128 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx80, 0 /*uErrCd*/, GdtrSaved.pGdt + BS3_SEL_TEST_PAGE_00); 1129 else 1130 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &Ctx80, X86_TRAP_PF_RW, GdtrSaved.pGdt + BS3_SEL_TEST_PAGE_00 + 4); 1122 1131 g_usBs3TestStep++; 1123 1132 … … 1127 1136 Bs3TrapSetJmpAndRestore(&CtxTmp, &TrapCtx); 1128 1137 1129 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &CtxTmp, 0 /*uErrCd*/, GdtrSaved.pGdt + BS3_SEL_TEST_PAGE_03); 1138 if (f486Plus) 1139 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &CtxTmp, 0 /*uErrCd*/, GdtrSaved.pGdt + BS3_SEL_TEST_PAGE_03); 1140 else 1141 bs3CpuBasic2_ComparePfCtx(&TrapCtx, &CtxTmp, X86_TRAP_PF_RW, GdtrSaved.pGdt + BS3_SEL_TEST_PAGE_03 + 4); 1130 1142 g_usBs3TestStep++; 1131 1143 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingInitRootForPP.c
r60319 r60321 45 45 { 46 46 uint32_t uCurPhys = (uint32_t)iFirst << X86_PD_SHIFT; 47 47 48 while (cEntries--) 48 49 { … … 125 126 cTop = RT_MIN(16, cMax / 4); 126 127 } 127 Bs3 Printf("Bs3PagingInitRootForPP: Warning! insufficient memory for mapping all 4GB!\n"128 " Will only map 0x00000000-%#010RX32 and %#010RX32-0xffffffff.\n",129 (uint32_t)(cMax - cTop) << PAGE_SHIFT, UINT32_MAX - ((uint32_t)cTop << PAGE_SHIFT) + 1);128 Bs3TestPrintf("Bs3PagingInitRootForPP: Warning! insufficient memory for mapping all 4GB!\n" 129 " Will only map 0x00000000-%#010RX32 and %#010RX32-0xffffffff.\n", 130 (uint32_t)(cMax - cTop) << PAGE_SHIFT, UINT32_MAX - ((uint32_t)cTop << PAGE_SHIFT) + 1); 130 131 rc = Bs3PagingInitPageTablesForPgDir(pPgDir, 0, cMax - cTop); 131 132 if (RT_SUCCESS(rc)) … … 139 140 } 140 141 142 Bs3Printf("Bs3PagingInitRootForPP: No memory!\n"); 141 143 BS3_ASSERT(false); 142 144 return VERR_NO_MEMORY; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c
r60311 r60321 215 215 { 216 216 RTCCUINTXREG const cr3 = ASMGetCR3(); 217 RTCCUINTXREG const cr4 = ASMGetCR4();217 RTCCUINTXREG const cr4 = g_uBs3CpuDetected & BS3CPU_F_CPUID ? ASMGetCR4() : 0; 218 218 bool const fLegacyPTs = !(cr4 & X86_CR4_PAE); 219 219 bool const fUseInvlPg = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80486 … … 222 222 unsigned cEntries; 223 223 int rc; 224 225 BS3PAGING_DPRINTF(("Bs3PagingProtect: reloading cr3=%RX32\n", (uint32_t)cr3));226 ASMSetCR3(cr3);227 224 228 225 /* -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16.asm
r60319 r60321 68 68 69 69 %else 70 70 71 ; 71 72 ; Switch to 16-bit text segment and prepare for returning in 16-bit mode. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c
r60311 r60321 95 95 modify exact [ax bx cx dx di es]; 96 96 97 /** 98 * Performs a int 15h function 0x88 call. 99 * 100 * @returns UINT32_MAX on failure, number of KBs above 1MB otherwise. 101 */ 102 BS3_DECL(uint32_t) Bs3BiosInt15h88(void); 103 #pragma aux Bs3BiosInt15h88 = \ 104 ".286" \ 105 "clc" \ 106 "mov ax, 08800h" \ 107 "int 15h" \ 108 "jc failed" \ 109 "xor dx, dx" \ 110 "jmp done" \ 111 "failed:" \ 112 "xor ax, ax" \ 113 "dec ax" \ 114 "mov dx, ax" \ 115 "done:" \ 116 value [ax dx] \ 117 modify exact [ax bx cx dx es]; 118 97 119 98 120 /********************************************************************************************************************************* … … 152 174 153 175 176 /** 177 * Adds a range of memory to the tiled slabs. 178 * 179 * @param uRange Start of range. 180 * @param cbRange Size of range. 181 */ 182 static void bs3InitMemoryAddRange(uint32_t uRange, uint32_t cbRange) 183 { 184 if (uRange < BS3_SEL_TILED_AREA_SIZE) 185 { 186 uint32_t uRangeEnd = uRange + cbRange; 187 if ( uRange >= _1M 188 || uRangeEnd > _1M) 189 { 190 uint16_t cPages; 191 192 /* Adjust the start of the range such that it's at or above 1MB and page aligned. */ 193 if (uRange < _1M) 194 { 195 cbRange -= _1M - uRange; 196 uRange = _1M; 197 } 198 else if (uRange & (_4K - 1U)) 199 { 200 cbRange -= uRange & (_4K - 1U); 201 uRange = RT_ALIGN_32(uRange, _4K); 202 } 203 204 /* Adjust the end/size of the range such that it's page aligned and not beyond the tiled area. */ 205 if (uRangeEnd > BS3_SEL_TILED_AREA_SIZE) 206 { 207 cbRange -= uRangeEnd - BS3_SEL_TILED_AREA_SIZE; 208 uRangeEnd = BS3_SEL_TILED_AREA_SIZE; 209 } 210 else if (uRangeEnd & (_4K - 1U)) 211 { 212 cbRange -= uRangeEnd & (_4K - 1U); 213 uRangeEnd &= ~(uint32_t)(_4K - 1U); 214 } 215 216 /* If there is still something, enable it. 217 (We're a bit paranoid here don't trust the BIOS to only report a page once.) */ 218 cPages = cbRange >> 12; /*div 4K*/ 219 if (cPages) 220 { 221 unsigned i; 222 uRange -= _1M; 223 i = uRange >> 12; /*div _4K*/ 224 while (cPages-- > 0) 225 { 226 uint16_t uLineToLong = ASMBitTestAndClear(g_Bs3Mem4KUpperTiled.Core.bmAllocated, i); 227 g_Bs3Mem4KUpperTiled.Core.cFreeChunks += uLineToLong; 228 i++; 229 } 230 } 231 } 232 } 233 } 234 154 235 155 236 BS3_DECL(void) Bs3InitMemory_rm(void) … … 157 238 uint16_t i; 158 239 uint16_t cPages; 240 uint32_t u32; 159 241 INT15E820ENTRY Entry; 160 242 … … 226 308 && i++ < 2048) 227 309 { 228 if (Entry.uType == INT15E820_TYPE_USABLE) 229 { 230 if (Entry.uBaseAddr < BS3_SEL_TILED_AREA_SIZE) 231 { 232 /* Entry concerning tiled memory. Convert from 64-bit to 32-bit 233 values and check whether it's concerning anything at or above 1MB */ 234 uint32_t uRange = (uint32_t)Entry.uBaseAddr; 235 uint32_t cbRange = Entry.cbRange >= BS3_SEL_TILED_AREA_SIZE 236 ? BS3_SEL_TILED_AREA_SIZE : (uint32_t)Entry.cbRange; 237 uint32_t uRangeEnd = uRange + cbRange; 238 AssertCompile(BS3_SEL_TILED_AREA_SIZE <= _512M /* the range of 16-bit cPages. */ ); 239 if ( uRange >= _1M 240 || uRangeEnd > _1M) 241 { 242 /* Adjust the start of the range such that it's at or above 1MB and page aligned. */ 243 if (uRange < _1M) 244 { 245 cbRange -= _1M - uRange; 246 uRange = _1M; 247 } 248 else if (uRange & (_4K - 1U)) 249 { 250 cbRange -= uRange & (_4K - 1U); 251 uRange = RT_ALIGN_32(uRange, _4K); 252 } 253 254 /* Adjust the end/size of the range such that it's page aligned and not beyond the tiled area. */ 255 if (uRangeEnd > BS3_SEL_TILED_AREA_SIZE) 256 { 257 cbRange -= uRangeEnd - BS3_SEL_TILED_AREA_SIZE; 258 uRangeEnd = BS3_SEL_TILED_AREA_SIZE; 259 } 260 else if (uRangeEnd & (_4K - 1U)) 261 { 262 cbRange -= uRangeEnd & (_4K - 1U); 263 uRangeEnd &= ~(uint32_t)(_4K - 1U); 264 } 265 266 /* If there is still something, enable it. 267 (We're a bit paranoid here don't trust the BIOS to only report a page once.) */ 268 cPages = cbRange >> 12; /*div 4K*/ 269 if (cPages) 270 { 271 uRange -= _1M; 272 i = uRange >> 12; /*div _4K*/ 273 while (cPages-- > 0) 274 { 275 uint16_t uLineToLong = ASMBitTestAndClear(g_Bs3Mem4KUpperTiled.Core.bmAllocated, i); 276 g_Bs3Mem4KUpperTiled.Core.cFreeChunks += uLineToLong; 277 i++; 278 } 279 } 280 } 281 } 310 if ( Entry.uType == INT15E820_TYPE_USABLE 311 && Entry.uBaseAddr < BS3_SEL_TILED_AREA_SIZE) 312 { 313 /* Entry concerning tiled memory. Convert from 64-bit to 32-bit 314 values and check whether it's concerning anything at or above 1MB */ 315 uint32_t uRange = (uint32_t)Entry.uBaseAddr; 316 uint32_t cbRange = Entry.cbRange >= BS3_SEL_TILED_AREA_SIZE 317 ? BS3_SEL_TILED_AREA_SIZE : (uint32_t)Entry.cbRange; 318 AssertCompile(BS3_SEL_TILED_AREA_SIZE <= _512M /* the range of 16-bit cPages. */ ); 319 bs3InitMemoryAddRange(uRange, cbRange); 282 320 } 283 321 } 284 322 } 323 /* Try the 286+ API for getting memory above 1MB and (usually) below 16MB. */ 324 else if ( (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386 325 && (u32 = Bs3BiosInt15h88()) != UINT32_MAX 326 && u32 > 0) 327 bs3InitMemoryAddRange(_1M, u32 * _1K); 285 328 286 329 /*
Note:
See TracChangeset
for help on using the changeset viewer.