Changeset 95372 in vbox for trunk/src/VBox
- Timestamp:
- Jun 26, 2022 12:27:49 AM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 4 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r95371 r95372 139 139 bs3-cmn-RegSetLdtr.asm \ 140 140 bs3-cmn-RegGetXcr0.asm \ 141 bs3-cmn-RegGetXcr0Asm.asm \142 141 bs3-cmn-RegSetXcr0.asm \ 143 142 bs3-cmn-ExtCtxInit.c \ … … 148 147 bs3-cmn-ExtCtxFree.c \ 149 148 bs3-cmn-ExtCtxCopy.c \ 149 bs3-cmn-ExtCtxGetMxCsr.c \ 150 bs3-cmn-ExtCtxSetMxCsr.c \ 151 bs3-cmn-ExtCtxGetYmm.c \ 152 bs3-cmn-ExtCtxSetYmm.c \ 150 153 bs3-cmn-SelFar32ToFlat32.c \ 151 154 bs3-cmn-SelFar32ToFlat32NoClobber.asm \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-ExtCtxSave.asm
r95371 r95372 28 28 29 29 extern BS3_CMN_NM(Bs3RegSetXcr0) 30 extern BS3_CMN_NM(Bs3RegGetXcr0Asm)31 30 32 31 ;; … … 64 63 65 64 .do_16_xsave: 66 call BS3_CMN_NM(Bs3RegGetXcr0Asm) 65 ; xgetbv can be used in any ring! 66 xor ecx, ecx 67 xgetbv 67 68 mov [es:bx + BS3EXTCTX.fXcr0Saved], eax 68 69 mov [es:bx + BS3EXTCTX.fXcr0Saved + 4], edx … … 106 107 107 108 .do_xsave: 108 call BS3_CMN_NM(Bs3RegGetXcr0Asm) 109 xor ecx, ecx 110 xgetbv 109 111 mov [xBX + BS3EXTCTX.fXcr0Saved], eax 110 112 mov [xBX + BS3EXTCTX.fXcr0Saved + 4], edx -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegGetXcr0.asm
r95371 r95372 28 28 29 29 30 BS3_EXTERN_CMN Bs3Syscall31 %if TMPL_BITS == 1632 BS3_EXTERN_DATA16 g_bBs3CurrentMode33 %endif34 TMPL_BEGIN_TEXT35 36 37 30 ;; 38 31 ; @cproto BS3_CMN_PROTO_STUB(uint64_t, Bs3RegGetXcr0,(void)); … … 41 34 ; @remarks Does not require 20h of parameter scratch space in 64-bit mode. 42 35 ; 43 ; @uses No GPRs, though 16-bit mode the upper 48-bits of rax and rdxare cleared.36 ; @uses No GPRs, though 16-bit mode the upper 48-bits of RAX, RDX and RCX are cleared. 44 37 ; 45 38 BS3_PROC_BEGIN_CMN Bs3RegGetXcr0, BS3_PBC_HYBRID_SAFE 46 BS3_CALL_CONV_PROLOG 047 39 push xBP 48 40 mov xBP, xSP 49 41 TONLY64 push rdx 50 42 51 %if TMPL_BITS == 16 52 ; If V8086 mode we have to go thru a syscall. 53 test byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_CODE_V86 54 jnz .via_system_call 55 cmp byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_RM 56 je .direct_access 57 %endif 58 ; If not in ring-0, we have to make a system call. 59 mov ax, ss 60 and ax, X86_SEL_RPL 61 jnz .via_system_call 62 63 .direct_access: 43 ; Read the value. 64 44 TNOT16 push sCX 65 45 xor ecx, ecx 66 46 xgetbv 67 47 TNOT16 pop sCX 68 jmp .return69 48 70 .via_system_call: 71 mov xAX, BS3_SYSCALL_GET_XCR0 72 call Bs3Syscall 73 74 .return: 49 ; Move the edx:eax value into the appropriate return register(s). 75 50 %if TMPL_BITS == 16 76 51 ; value [dx cx bx ax] … … 84 59 shr rdx, 32 85 60 or rax, rdx 86 pop rdx87 61 %endif 62 63 TONLY64 pop rdx 88 64 pop xBP 89 BS3_CALL_CONV_EPILOG 090 65 BS3_HYBRID_RET 91 66 BS3_PROC_END_CMN Bs3RegGetXcr0 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-RegSetXcr0.asm
r95371 r95372 40 40 ; @param uValue The value to set. 41 41 42 ; @remarks Does not require 20h of parameter scratch space in 64-bit mode, 43 ; only 8 bytes for dumping rcx. 42 ; @remarks Does not require 20h of parameter scratch space in 64-bit mode. 44 43 ; 45 44 ; @uses No GPRs. 46 45 ; 47 46 BS3_PROC_BEGIN_CMN Bs3RegSetXcr0, BS3_PBC_HYBRID_SAFE 48 BS3_CALL_CONV_PROLOG 149 47 push xBP 50 48 mov xBP, xSP … … 54 52 55 53 ; Load the value 54 %if TMPL_BITS == 64 55 mov eax, ecx 56 mov rdx, rcx 57 shr rdx, 32 58 %else 56 59 mov sAX, [xBP + xCB + cbCurRetAddr] 57 60 mov sDX, [xBP + xCB + cbCurRetAddr + 4] 61 %endif 58 62 59 63 %if TMPL_BITS == 16 … … 86 90 pop sSI 87 91 pop xBP 88 BS3_CALL_CONV_EPILOG 189 92 BS3_HYBRID_RET 90 93 BS3_PROC_END_CMN Bs3RegSetXcr0 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk
r95371 r95372 37 37 $(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,Bs3SelFar32ToFlat32NoClobber,6) 38 38 $(call BS3KIT_FN_GEN_CMN_FARSTUB,bs3kit-common-16,Bs3RegCtxSaveEx,8) 39 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetYmm) 39 40 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestCheckRegCtxEx) 40 41 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestFailed) … … 60 61 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxInit) 61 62 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetHandler) 63 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxGetYmm) 62 64 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3Printf) 63 65 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3PrintfV) … … 71 73 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabFree) 72 74 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSubErrorCount) 75 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxGetMxCsr) 73 76 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelFar32ToFlat32) 74 77 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelProtFar32ToFlat32) … … 78 81 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetDpl) 79 82 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxFree) 83 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxSetMxCsr) 80 84 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemAlloc) 81 85 $(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3MemAllocZ) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
r95371 r95372 34 34 #define Bs3ExtCtxCopy BS3_CMN_MANGLER(Bs3ExtCtxCopy) 35 35 #define Bs3ExtCtxFree BS3_CMN_MANGLER(Bs3ExtCtxFree) 36 #define Bs3ExtCtxGetMxCsr BS3_CMN_MANGLER(Bs3ExtCtxGetMxCsr) 36 37 #define Bs3ExtCtxGetSize BS3_CMN_MANGLER(Bs3ExtCtxGetSize) 38 #define Bs3ExtCtxGetYmm BS3_CMN_MANGLER(Bs3ExtCtxGetYmm) 37 39 #define Bs3ExtCtxInit BS3_CMN_MANGLER(Bs3ExtCtxInit) 38 40 #define Bs3ExtCtxRestore BS3_CMN_MANGLER(Bs3ExtCtxRestore) 39 41 #define Bs3ExtCtxSave BS3_CMN_MANGLER(Bs3ExtCtxSave) 42 #define Bs3ExtCtxSetMxCsr BS3_CMN_MANGLER(Bs3ExtCtxSetMxCsr) 43 #define Bs3ExtCtxSetYmm BS3_CMN_MANGLER(Bs3ExtCtxSetYmm) 40 44 #define Bs3GetCpuVendor BS3_CMN_MANGLER(Bs3GetCpuVendor) 41 45 #define Bs3GetModeName BS3_CMN_MANGLER(Bs3GetModeName) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
r95371 r95372 34 34 #undef Bs3ExtCtxCopy 35 35 #undef Bs3ExtCtxFree 36 #undef Bs3ExtCtxGetMxCsr 36 37 #undef Bs3ExtCtxGetSize 38 #undef Bs3ExtCtxGetYmm 37 39 #undef Bs3ExtCtxInit 38 40 #undef Bs3ExtCtxRestore 39 41 #undef Bs3ExtCtxSave 42 #undef Bs3ExtCtxSetMxCsr 43 #undef Bs3ExtCtxSetYmm 40 44 #undef Bs3GetCpuVendor 41 45 #undef Bs3GetModeName -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r95371 r95372 2880 2880 BS3_CMN_PROTO_STUB(PBS3EXTCTX, Bs3ExtCtxCopy,(PBS3EXTCTX pDst, PCBS3EXTCTX pSrc)); 2881 2881 2882 /** 2883 * Gets the MXCSR register value from @a pExtCtx. 2884 * 2885 * @returns MXCSR value, 0 if not part of context. 2886 * @param pExtCtx The extended CPU context. 2887 */ 2888 BS3_CMN_PROTO_STUB(uint32_t, Bs3ExtCtxGetMxCsr,(PCBS3EXTCTX pExtCtx)); 2889 2890 /** 2891 * Sets the MXCSR register value in @a pExtCtx. 2892 * 2893 * @param pExtCtx The extended CPU context. 2894 * @param uValue The new MXCSR value. 2895 */ 2896 BS3_CMN_PROTO_STUB(void, Bs3ExtCtxSetMxCsr,(PBS3EXTCTX pExtCtx, uint32_t uValue)); 2897 2898 /** 2899 * Gets the value of YMM register number @a iReg from @a pExtCtx. 2900 * 2901 * @returns MXCSR value, 0 if not part of context. 2902 * @param pExtCtx The extended CPU context. 2903 * @param iReg The register to get. 2904 * @param pValue Where to return the value. Parts not in the 2905 * extended state are zeroed. For absent or invalid 2906 * @a iReg values this is set to zero. 2907 */ 2908 BS3_CMN_PROTO_STUB(PRTUINT256U, Bs3ExtCtxGetYmm,(PCBS3EXTCTX pExtCtx, uint8_t iReg, PRTUINT256U pValue)); 2909 2910 /** 2911 * Sets the value of YMM register number @a iReg in @a pExtCtx to @a pValue. 2912 * 2913 * @returns true if set (even if only partially). False if not set (not 2914 * supported by state format, unsupported/invalid iReg). 2915 * @param pExtCtx The extended CPU context. 2916 * @param iReg The register to set. 2917 * @param pValue The new register value. 2918 * @param f128Bit A little peculiarity grown from mixing SSE and AVX 2919 * tests: When set to true only the lower 128 bits of 2920 * the YMM register will be set. The upper bits are 2921 * untouched. When false, the whole 256-bits value 2922 * will be set. 2923 */ 2924 BS3_CMN_PROTO_STUB(bool, Bs3ExtCtxSetYmm,(PBS3EXTCTX pExtCtx, uint8_t iReg, PCRTUINT256U pValue, bool f128Bit)); 2925 2882 2926 2883 2927 /** @name Debug register accessors for V8086 mode (works everwhere).
Note:
See TracChangeset
for help on using the changeset viewer.