Changeset 60682 in vbox
- Timestamp:
- Apr 24, 2016 6:56:17 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106850
- Location:
- trunk/src/VBox/ValidationKit/bootsectors
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
r60681 r60682 1392 1392 uint8_t bFiller; 1393 1393 int off; 1394 int off2; 1394 1395 unsigned cb; 1395 1396 uint8_t BS3_FAR *pbTest; … … 1881 1882 * Check non-canonical 64-bit space. 1882 1883 */ 1883 if (BS3_MODE_IS_64BIT_CODE(bTestMode)) 1884 { 1885 1886 } 1884 if ( BS3_MODE_IS_64BIT_CODE(bTestMode) 1885 && (pbTest = (uint8_t BS3_FAR *)Bs3PagingSetupCanonicalTraps()) != NULL) 1886 { 1887 /* Make our references relative to the gap. */ 1888 pbTest += g_cbBs3PagingOneCanonicalTrap; 1889 1890 /* Hit it from below. */ 1891 for (off = -cbIdtr - 8; off < cbIdtr + 8; off++) 1892 { 1893 Ctx.rbx.u = CtxUdExpected.rbx.u = UINT64_C(0x0000800000000000) + off; 1894 Bs3MemSet(&pbTest[-64], bFiller, 64*2); 1895 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 1896 if (off + cbIdtr <= 0) 1897 { 1898 bs3CpuBasic2_CompareUdCtx(&TrapCtx, &CtxUdExpected); 1899 if (Bs3MemCmp(&pbTest[off], pabExpected, cbIdtr) != 0) 1900 Bs3TestFailedF("Mismatch (#21): expected %.*Rhxs, got %.*Rhxs\n", cbIdtr, pabExpected, cbIdtr, &pbTest[off]); 1901 } 1902 else 1903 { 1904 bs3CpuBasic2_CompareGpCtx(&TrapCtx, &Ctx, 0); 1905 if (off <= -2 && Bs3MemCmp(&pbTest[off], pabExpected, 2) != 0) 1906 Bs3TestFailedF("Mismatch (#21): expected limit %.2Rhxs, got %.2Rhxs\n", pabExpected, &pbTest[off]); 1907 off2 = off <= -2 ? 2 : 0; 1908 cb = cbIdtr - off2; 1909 if (!ASMMemIsAllU8(&pbTest[off + off2], cb, bFiller)) 1910 Bs3TestFailedF("Mismatch (#21): touched base %.*Rhxs, got %.*Rhxs\n", 1911 cb, &pabExpected[off], cb, &pbTest[off + off2]); 1912 } 1913 if (!ASMMemIsAllU8(&pbTest[off - 16], 16, bFiller)) 1914 Bs3TestFailedF("Leading bytes touched (#21): bFiller=%#x, got %.16Rhxs\n", bFiller, &pbTest[off]); 1915 if (!ASMMemIsAllU8(&pbTest[off + cbIdtr], 16, bFiller)) 1916 Bs3TestFailedF("Trailing bytes touched (#21): bFiller=%#x, got %.16Rhxs\n", bFiller, &pbTest[off + cbIdtr]); 1917 } 1918 1919 /* Hit it from above. */ 1920 for (off = -cbIdtr - 8; off < cbIdtr + 8; off++) 1921 { 1922 Ctx.rbx.u = CtxUdExpected.rbx.u = UINT64_C(0xffff800000000000) + off; 1923 Bs3MemSet(&pbTest[-64], bFiller, 64*2); 1924 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 1925 if (off >= 0) 1926 { 1927 bs3CpuBasic2_CompareUdCtx(&TrapCtx, &CtxUdExpected); 1928 if (Bs3MemCmp(&pbTest[off], pabExpected, cbIdtr) != 0) 1929 Bs3TestFailedF("Mismatch (#22): expected %.*Rhxs, got %.*Rhxs\n", cbIdtr, pabExpected, cbIdtr, &pbTest[off]); 1930 } 1931 else 1932 { 1933 bs3CpuBasic2_CompareGpCtx(&TrapCtx, &Ctx, 0); 1934 if (!ASMMemIsAllU8(&pbTest[off], cbIdtr, bFiller)) 1935 Bs3TestFailedF("Mismatch (#22): touched base %.*Rhxs, got %.*Rhxs\n", 1936 cbIdtr, &pabExpected[off], cbIdtr, &pbTest[off]); 1937 } 1938 if (!ASMMemIsAllU8(&pbTest[off - 16], 16, bFiller)) 1939 Bs3TestFailedF("Leading bytes touched (#22): bFiller=%#x, got %.16Rhxs\n", bFiller, &pbTest[off]); 1940 if (!ASMMemIsAllU8(&pbTest[off + cbIdtr], 16, bFiller)) 1941 Bs3TestFailedF("Trailing bytes touched (#22): bFiller=%#x, got %.16Rhxs\n", bFiller, &pbTest[off + cbIdtr]); 1942 } 1943 1944 } 1945 1887 1946 } 1888 1947 … … 2161 2220 BS3_DECL_FAR(uint8_t) TMPL_NM(bs3CpuBasic2_sidt)(uint8_t bMode) 2162 2221 { 2163 if (bMode == BS3_MODE_LM64)2222 //if (bMode == BS3_MODE_LM64) 2164 2223 { 2165 2224 union … … 2194 2253 BS3_DECL_FAR(uint8_t) TMPL_NM(bs3CpuBasic2_sgdt)(uint8_t bMode) 2195 2254 { 2196 if (bMode == BS3_MODE_LM64)2255 //if (bMode == BS3_MODE_LM64) 2197 2256 { 2198 2257 union -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r60676 r60682 87 87 bs3-cmn-PagingInitRootForLM.c \ 88 88 bs3-cmn-PagingProtect.c \ 89 bs3-cmn-PagingSetupCanonicalTraps.c \ 89 90 bs3-cmn-PicMaskAll.c \ 90 91 bs3-cmn-RegCtxRestore.asm \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingData.c
r60311 r60682 42 42 uint32_t g_PhysPagingRootLM = UINT32_MAX; 43 43 44 uint32_t g_uBs3PagingCanonicalTrapsAddr = UINT32_MAX; 45 uint16_t g_cbBs3PagingCanonicalTraps = 0; 46 uint16_t g_cbBs3PagingOneCanonicalTrap = 0; 47 44 48 #endif 45 49 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PagingProtect.c
r60678 r60682 93 93 { 94 94 if (pPD->a[iPde].u <= uMaxAddr) 95 {96 95 pPTE = &((X86PT BS3_FAR *)Bs3XptrFlatToCurrent(pPD->a[iPde].u & ~(uint32_t)PAGE_OFFSET_MASK))->a[iPte]; 97 *prc = VINF_SUCCESS;98 }99 96 else 100 97 BS3PAGING_DPRINTF1(("bs3PagingGetLegacyPte: out of range! iPde=%#x: %#x\n", iPde, pPD->a[iPde].u)); … … 122 119 ASMInvalidatePage(uFlat); 123 120 pPTE = &pPT->a[iPte]; 124 *prc = VINF_SUCCESS;125 121 } 126 122 } … … 134 130 135 131 132 /** 133 * Get the PTE for an address, given a PAE or long mode CR3. 134 * 135 * @returns Pointer to the PTE on success, NULL on failure. 136 * @param cr3 The CR3. 137 * @param bMode Indicates whether it's PAE or long mode. 138 * @param uFlat The address for which we want the PTE. 139 * @param fUseInvlPg Whether we can use invalidate page when 140 * replacing large pages. 141 * @param prc Updated only on failure. 142 */ 136 143 #undef bs3PagingGetPte 137 BS3_CMN_DEF(X86PTEPAE BS3_FAR *, bs3PagingGetPte,(RTCCUINTXREG cr3, uint 64_t uFlat, bool fUseInvlPg, int *prc))144 BS3_CMN_DEF(X86PTEPAE BS3_FAR *, bs3PagingGetPte,(RTCCUINTXREG cr3, uint8_t bMode, uint64_t uFlat, bool fUseInvlPg, int *prc)) 138 145 { 139 146 X86PTEPAE BS3_FAR *pPTE = NULL; … … 148 155 { 149 156 X86PDPAE BS3_FAR *pPD; 150 if (BS3_MODE_IS_64BIT_SYS( g_bBs3CurrentMode))157 if (BS3_MODE_IS_64BIT_SYS(bMode)) 151 158 { 152 159 unsigned const iPml4e = (uFlat >> X86_PML4_SHIFT) & X86_PML4_MASK; … … 206 213 { 207 214 if ((pPD->a[iPde].u & X86_PDE_PAE_PG_MASK) <= uMaxAddr) 208 {209 215 pPTE = &((X86PTPAE BS3_FAR *)Bs3XptrFlatToCurrent(pPD->a[iPde].u & ~(uint64_t)PAGE_OFFSET_MASK))->a[iPte]; 210 *prc = VINF_SUCCESS;211 }212 216 else 213 217 BS3PAGING_DPRINTF1(("bs3PagingGetPte: out of range! iPde=%#x: %RX64 max=%RX32\n", … … 233 237 ASMInvalidatePage(uFlat); 234 238 pPTE = &pPT->a[iPte]; 235 *prc = VINF_SUCCESS;236 239 } 237 240 } … … 304 307 while (cb > 0) 305 308 { 306 PX86PTEPAE pPte = BS3_CMN_FAR_NM(bs3PagingGetPte)(cr3, uFlat, fUseInvlPg, &rc);309 PX86PTEPAE pPte = BS3_CMN_FAR_NM(bs3PagingGetPte)(cr3, g_bBs3CurrentMode, uFlat, fUseInvlPg, &rc); 307 310 if (!pPte) 308 311 return rc; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestSub.c
r60527 r60682 53 53 g_cusBs3SubTestAtErrors = g_cusBs3TestErrors; 54 54 BS3_ASSERT(!g_fbBs3SubTestSkipped); 55 g_cusBs3SubTests++; 55 56 56 57 /* -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-paging.h
r60311 r60682 31 31 #include <iprt/asm.h> 32 32 33 RT_C_DECLS_BEGIN ;33 RT_C_DECLS_BEGIN 34 34 35 35 /** Root directory for page protected mode. 36 36 * UINT32_MAX if not initialized. */ 37 #ifndef DOXYGEN_RUNNING38 # define g_PhysPagingRootPP BS3_DATA_NM(g_PhysPagingRootPP)39 #endif40 37 extern uint32_t g_PhysPagingRootPP; 41 38 /** Root directory pointer table for PAE mode. 42 39 * UINT32_MAX if not initialized. */ 43 #ifndef DOXYGEN_RUNNING44 # define g_PhysPagingRootPAE BS3_DATA_NM(g_PhysPagingRootPAE)45 #endif46 40 extern uint32_t g_PhysPagingRootPAE; 47 41 /** Root table (level 4) for long mode. 48 42 * UINT32_MAX if not initialized. */ 49 #ifndef DOXYGEN_RUNNING50 # define g_PhysPagingRootLM BS3_DATA_NM(g_PhysPagingRootLM)51 #endif52 43 extern uint32_t g_PhysPagingRootLM; 53 44 54 RT_C_DECLS_END; 45 #undef bs3PagingGetLegacyPte 46 BS3_CMN_PROTO_STUB(X86PTE BS3_FAR *, bs3PagingGetLegacyPte,(RTCCUINTXREG cr3, uint32_t uFlat, bool fUseInvlPg, int *prc)); 47 #undef bs3PagingGetPte 48 BS3_CMN_PROTO_STUB(X86PTEPAE BS3_FAR *, bs3PagingGetPte,(RTCCUINTXREG cr3, uint8_t bMode, uint64_t uFlat, 49 bool fUseInvlPg, int *prc)); 55 50 51 RT_C_DECLS_END 56 52 57 #define bs3PagingGetLegacyPte BS3_CMN_NM(bs3PagingGetLegacyPte) 58 BS3_DECL(X86PTE BS3_FAR *) bs3PagingGetLegacyPte(RTCCUINTXREG cr3, uint32_t uFlat, bool fUseInvlPg, int *prc); 59 60 #define bs3PagingGetPte BS3_CMN_NM(bs3PagingGetPte) 61 BS3_DECL(X86PTEPAE BS3_FAR *) bs3PagingGetPte(RTCCUINTXREG cr3, uint64_t uFlat, bool fUseInvlPg, int *prc); 62 53 #include "bs3kit-mangling-code.h" 63 54 64 55 #endif -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk
r60676 r60682 61 61 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemMove) 62 62 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemPCpy) 63 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PagingSetupCanonicalTraps) 63 64 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabAlloc) 64 65 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabAllocEx) … … 109 110 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3UInt32Div) 110 111 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3UInt64Div) 112 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,bs3PagingGetLegacyPte) 113 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,bs3PagingGetPte) 111 114 $(call BS3KIT_FN_GEN_MODE_NEARSTUB,bs3kit-common-16,Bs3TrapInit) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
r60676 r60682 47 47 #define Bs3MemSet BS3_CMN_MANGLER(Bs3MemSet) 48 48 #define Bs3MemZero BS3_CMN_MANGLER(Bs3MemZero) 49 #define bs3PagingGetLegacyPte BS3_CMN_MANGLER(bs3PagingGetLegacyPte) 50 #define bs3PagingGetPte BS3_CMN_MANGLER(bs3PagingGetPte) 49 51 #define Bs3PagingInitRootForLM BS3_CMN_MANGLER(Bs3PagingInitRootForLM) 50 52 #define Bs3PagingInitRootForPAE BS3_CMN_MANGLER(Bs3PagingInitRootForPAE) … … 52 54 #define Bs3PagingProtect BS3_CMN_MANGLER(Bs3PagingProtect) 53 55 #define Bs3PagingProtectPtr BS3_CMN_MANGLER(Bs3PagingProtectPtr) 56 #define Bs3PagingSetupCanonicalTraps BS3_CMN_MANGLER(Bs3PagingSetupCanonicalTraps) 54 57 #define Bs3Panic BS3_CMN_MANGLER(Bs3Panic) 55 58 #define Bs3PicMaskAll BS3_CMN_MANGLER(Bs3PicMaskAll) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
r60676 r60682 47 47 #undef Bs3MemSet 48 48 #undef Bs3MemZero 49 #undef bs3PagingGetLegacyPte 50 #undef bs3PagingGetPte 49 51 #undef Bs3PagingInitRootForLM 50 52 #undef Bs3PagingInitRootForPAE … … 52 54 #undef Bs3PagingProtect 53 55 #undef Bs3PagingProtectPtr 56 #undef Bs3PagingSetupCanonicalTraps 54 57 #undef Bs3Panic 55 58 #undef Bs3PicMaskAll -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r60681 r60682 2137 2137 BS3_CMN_PROTO_STUB(int, Bs3PagingProtectPtr,(void BS3_FAR *pv, size_t cb, uint64_t fSet, uint64_t fClear)); 2138 2138 2139 /** The physical / flat address of the buffer backing the canonical traps. 2140 * This buffer is spread equally on each side of the 64-bit non-canonical 2141 * address divide. Non-64-bit code can use this to setup trick shots and 2142 * inspect their results. */ 2143 extern uint32_t g_uBs3PagingCanonicalTrapsAddr; 2144 /** The size of the buffer at g_uPagingCanonicalTraps (both sides). */ 2145 extern uint16_t g_cbBs3PagingCanonicalTraps; 2146 /** The size of one trap buffer (low or high). 2147 * This is g_cbBs3PagingCanonicalTraps divided by two. */ 2148 extern uint16_t g_cbBs3PagingOneCanonicalTrap; 2149 2150 /** 2151 * Sets up the 64-bit canonical address space trap buffers, if neceessary. 2152 * 2153 * @returns Pointer to the buffers (i.e. the first page of the low one) on 2154 * success. NULL on failure. 2155 */ 2156 BS3_CMN_PROTO_STUB(void BS3_FAR *, Bs3PagingSetupCanonicalTraps,(void)); 2157 2139 2158 /** 2140 2159 * Waits for the keyboard controller to become ready.
Note:
See TracChangeset
for help on using the changeset viewer.