Changeset 64694 in vbox for trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Timestamp:
- Nov 17, 2016 5:10:47 PM (8 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 26 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r61547 r64694 283 283 bs3-mode-SwitchToLM32.asm \ 284 284 bs3-mode-SwitchToLM16.asm \ 285 bs3-mode-SwitchTo32BitAndCallC.asm \ 285 286 bs3-mode-EnteredMode.asm \ 286 287 bs3-mode-PagingGetRootForPP16.asm \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
r62484 r64694 75 75 76 76 BS3_BEGIN_TEXT16 77 .sixteen_bit: 77 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit 78 78 79 79 ; Load 16-bit segment registers. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestDoModesByOneHlp.asm
r60750 r64694 87 87 88 88 ; Assuming real mode far pointer, convert protected mode before calling it. 89 push word [ BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent) + 2]89 push word [2 + BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] 90 90 call _Bs3SelRealModeCodeToProtMode_c16 91 91 add sp, 2 … … 95 95 96 96 push ax ; call converted selector 97 push word [BS3_ CMN_NM(g_pfnBs3TestDoModesByOneCurrent)] ; call offset97 push word [BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] ; call offset 98 98 retf 99 99 … … 130 130 131 131 ; Assuming real mode far pointer, convert protected mode before calling it. 132 push word [ BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent) + 2]132 push word [2 + BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] 133 133 call _Bs3SelRealModeCodeToProtMode_c16 134 134 add sp, 2 … … 137 137 push word .return ; return address 138 138 push ax ; call converted selector 139 push word [BS3_ CMN_NM(g_pfnBs3TestDoModesByOneCurrent)]; call offset139 push word [BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] ; call offset 140 140 retf 141 141 … … 157 157 158 158 BS3_BEGIN_TEXT16 159 BS3_SET_BITS 32159 BS3_SET_BITS 16 160 160 BS3_PROC_BEGIN _Bs3TestCallDoerTo32_f16 161 161 push xBP … … 180 180 jnz .return_to_v86 ; Need to figure this while we still have the mode value. 181 181 182 call [BS3_ CMN_NM(g_pfnBs3TestDoModesByOneCurrent)]182 call [BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] 183 183 184 184 ; Switch back to 16-bit mode. … … 192 192 BS3_SET_BITS 32 193 193 .return_to_v86: 194 call [BS3_ CMN_NM(g_pfnBs3TestDoModesByOneCurrent)]194 call [BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] 195 195 196 196 ; Switch back to v8086 mode. … … 222 222 223 223 push eax ; Worker bMode argument. 224 call [BS3_ CMN_NM(g_pfnBs3TestDoModesByOneCurrent)]224 call [BS3_DATA16_WRT(BS3_CMN_NM(g_pfnBs3TestDoModesByOneCurrent))] 225 225 226 226 ; Switch back to 64-bit mode. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchTo32BitAndCallC.asm
r64681 r64694 1 1 ; $Id$ 2 2 ;; @file 3 ; BS3Kit - Bs3SwitchFromV86To16BitAndCallC3 ; BS3Kit - bs3SwitchTo32BitAndCallC 4 4 ; 5 5 … … 29 29 ;********************************************************************************************************************************* 30 30 %include "bs3kit-template-header.mac" 31 %if TMPL_BITS != 1632 %error "16-bit only"33 %endif34 31 35 32 … … 37 34 ;* External Symbols * 38 35 ;********************************************************************************************************************************* 36 BS3_EXTERN_DATA16 g_bBs3CurrentMode 37 TMPL_BEGIN_TEXT 38 39 39 %ifdef BS3_STRICT 40 BS3_EXTERN_DATA16 g_bBs3CurrentMode 41 TMPL_BEGIN_TEXT 42 BS3_EXTERN_CMN Bs3Panic 40 BS3_EXTERN_CMN Bs3Panic 43 41 %endif 44 BS3_EXTERN_CMN Bs3SwitchTo16Bit 45 BS3_EXTERN_CMN Bs3SwitchTo16BitV86 46 BS3_EXTERN_CMN Bs3SelRealModeCodeToProtMode 42 43 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE) 44 BS3_EXTERN_CMN Bs3SelRealModeCodeToFlat 45 %endif 46 47 %if TMPL_MODE == BS3_MODE_RM 48 extern NAME(Bs3SwitchToPE32_rm) 49 extern NAME(Bs3SwitchToRM_pe32) 50 %elif !BS3_MODE_IS_32BIT_CODE(TMPL_MODE) 51 BS3_EXTERN_CMN Bs3SwitchTo32Bit 52 %if BS3_MODE_IS_16BIT_CODE_NO_V86(TMPL_MODE) 53 extern _Bs3SwitchTo16Bit_c32 54 %elif BS3_MODE_IS_32BIT_CODE_NO_V86(TMPL_MODE) 55 extern _Bs3SwitchTo16BitV86_c32 56 %elif !BS3_MODE_IS_32BIT_CODE(TMPL_MODE) 57 extern _Bs3SwitchTo64_c32 58 %endif 59 %endif 60 47 61 48 62 49 63 ;; 50 ; @cproto BS3_ CMN_PROTO_STUB(int, Bs3SwitchFromV86To16BitAndCallC,(FPFNBS3FARfpfnCall, unsigned cbParams, ...));64 ; @cproto BS3_MODE_PROTO_STUB(int, Bs3SwitchTo32BitAndCallC,(PFNBS3FARADDRCONV fpfnCall, unsigned cbParams, ...)); 51 65 ; 52 BS3_PROC_BEGIN_CMN Bs3SwitchFromV86To16BitAndCallC, BS3_PBC_HYBRID 53 inc bp 54 push bp 55 mov bp, sp 66 BS3_PROC_BEGIN_MODE Bs3SwitchTo32BitAndCallC, BS3_PBC_HYBRID 67 BS3_CALL_CONV_PROLOG 4 68 TONLY16 inc xBP 69 push xBP 70 mov xBP, xSP 71 push xSI 56 72 57 73 ; 58 74 ; Push the arguments first. 59 75 ; 60 mov ax, si ; save si 61 mov si, [bp + 2 + cbCurRetAddr + 4]76 TONLY16 mov si, [xBP + xCB + cbCurRetAddr + sCB] 77 TNOT16 mov esi, [xBP + xCB + cbCurRetAddr + sCB] 62 78 %ifdef BS3_STRICT 63 test si, 179 test xSI, 3 64 80 jz .cbParams_ok 65 81 call Bs3Panic 66 82 .cbParams_ok: 67 test byte [g_bBs3CurrentMode], BS3_MODE_CODE_V8668 j nz.mode_ok83 cmp byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], TMPL_MODE 84 je .mode_ok 69 85 call Bs3Panic 70 86 .mode_ok: 71 87 %endif 72 88 add xSI, sCB - 1 ; round it up to nearest push size / dword. 89 and xSI, ~(sCB - 1) 90 jz .done_pushing ; skip if zero 73 91 .push_more: 74 push word [bp + 2 + cbCurRetAddr + 4 + 2 + si - 2]75 sub si, 292 push xPRE [xBP + xCB + cbCurRetAddr + sCB + xCB + xSI - xCB] 93 sub xSI, xCB 76 94 jnz .push_more 77 mov si, ax ; restore si 95 mov xSI, xAX ; restore xSI 96 .done_pushing: 78 97 79 98 ; 80 ; Convert the code segment to a 16-bit prot mode selector99 ; Load fpfnCall into eax. 81 100 ; 82 push word [bp + 2 + cbCurRetAddr + 2] 83 call Bs3SelRealModeCodeToProtMode 84 mov [bp + 2 + cbCurRetAddr + 2], ax 85 add sp, 2 101 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE) 102 push sPRE [xBP + xCB + cbCurRetAddr] 103 BS3_CALL Bs3SelRealModeCodeToFlat, 1 104 add xSP, sCB 105 rol eax, 16 106 mov ax, dx 107 rol eax, 16 108 %else 109 mov eax, [xBP + xCB + cbCurRetAddr] 110 %endif 86 111 87 112 ; 88 ; Switch mode.113 ; Switch to 32-bit mode, if this is real mode pick PE32. 89 114 ; 90 call Bs3SwitchTo16Bit 91 call far [bp + 2 + cbCurRetAddr] 92 call Bs3SwitchTo16BitV86 115 %if TMPL_MODE == BS3_MODE_RM 116 call NAME(Bs3SwitchToPE32_rm) 117 BS3_SET_BITS 32 118 %elif !BS3_MODE_IS_32BIT_CODE(TMPL_MODE) 119 call Bs3SwitchTo32Bit 120 BS3_SET_BITS 32 121 %endif 93 122 94 mov sp, bp 95 pop bp 96 dec bp 123 ; 124 ; Make the call. 125 ; 126 call eax 127 128 ; 129 ; Return, preserving xAX. 130 ; 131 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE) 132 mov edx, eax 133 shr edx, 16 134 %endif 135 %if TMPL_MODE == BS3_MODE_RM 136 call NAME(Bs3SwitchToRM_pe32) 137 %elif BS3_MODE_IS_16BIT_CODE_NO_V86(TMPL_MODE) 138 call _Bs3SwitchTo16Bit_c32 139 %elif BS3_MODE_IS_32BIT_CODE_NO_V86(TMPL_MODE) 140 call _Bs3SwitchTo16BitV86_c32 141 %elif !BS3_MODE_IS_32BIT_CODE(TMPL_MODE) 142 call _Bs3SwitchTo64_c32 143 %endif 144 BS3_SET_BITS TMPL_BITS 145 146 ; Epilog. 147 lea xSP, [xBP - xCB] 148 pop xSI 149 pop xBP 150 TONLY16 dec xBP 151 BS3_CALL_CONV_EPILOG 4 97 152 BS3_HYBRID_RET 98 BS3_PROC_END_ CMN Bs3SwitchFromV86To16BitAndCallC153 BS3_PROC_END_MODE Bs3SwitchTo32BitAndCallC 99 154 100 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM32.asm
r60686 r64694 79 79 jmp .thirty_two_bit_segment 80 80 BS3_BEGIN_TEXT32 81 .thirty_two_bit_segment: 81 BS3_GLOBAL_LOCAL_LABEL .thirty_two_bit_segment 82 82 %endif 83 83 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16.asm
r60686 r64694 25 25 ; 26 26 27 ;********************************************************************************************************************************* 28 ;* Header Files * 29 ;********************************************************************************************************************************* 27 30 %include "bs3kit-template-header.mac" 28 31 32 33 ;********************************************************************************************************************************* 34 ;* External Symbols * 35 ;********************************************************************************************************************************* 29 36 %ifndef TMPL_PAE16 37 BS3_BEGIN_TEXT16 30 38 extern NAME(Bs3EnteredMode_pae16) 31 39 %ifdef TMPL_PAE32 32 40 BS3_EXTERN_CMN Bs3SwitchTo16Bit 33 %else 34 %endif 35 %endif 41 %endif 42 TMPL_BEGIN_TEXT 43 %endif 44 36 45 37 46 ;; … … 75 84 ; 76 85 %if TMPL_BITS != 16 77 shl xPRE [xSP + xCB], TMPL_BITS - 16; Adjust the return address.86 shl xPRE [xSP], TMPL_BITS - 16 ; Adjust the return address. 78 87 add xSP, xCB - 2 79 88 … … 82 91 BS3_BEGIN_TEXT16 83 92 BS3_SET_BITS TMPL_BITS 84 .sixteen_bit_segment: 93 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 85 94 %endif 86 95 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16_32.asm
r60557 r64694 53 53 BS3_BEGIN_TEXT16 54 54 BS3_SET_BITS TMPL_BITS 55 .sixteen_bit_segment: 55 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 56 56 %endif 57 57 extern TMPL_NM(Bs3SwitchToPAE16) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE16_V86.asm
r60557 r64694 57 57 BS3_BEGIN_TEXT16 58 58 BS3_SET_BITS TMPL_BITS 59 .sixteen_bit_segment: 59 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 60 60 %endif 61 61 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE32.asm
r60686 r64694 62 62 %if TMPL_BITS != 32 63 63 %if TMPL_BITS > 32 64 shl xPRE [xSP + xCB], 32; Adjust the return address from 64-bit to 32-bit.64 shl xPRE [xSP], 32 ; Adjust the return address from 64-bit to 32-bit. 65 65 add rsp, xCB - 4 66 66 %else 67 67 push word 0 ; Reserve space to expand the return address. 68 68 %endif 69 %endif 70 %if TMPL_BITS != 16 69 71 ; Must be in 16-bit segment when calling Bs3SwitchTo16Bit. 70 72 jmp .sixteen_bit_segment 71 73 BS3_BEGIN_TEXT16 72 74 BS3_SET_BITS TMPL_BITS 73 .sixteen_bit_segment: 75 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 74 76 %endif 75 77 … … 121 123 jmp BS3_SEL_R0_CS32:dword .thirty_two_bit wrt FLAT 122 124 BS3_BEGIN_TEXT32 123 .thirty_two_bit: 125 BS3_GLOBAL_LOCAL_LABEL .thirty_two_bit 124 126 125 127 ; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPAE32_16.asm
r60557 r64694 48 48 49 49 %elif TMPL_MODE == BS3_MODE_PAE32 50 extern BS3_CMN_NM(Bs3SwitchTo 32Bit)51 jmp BS3_CMN_NM(Bs3SwitchTo 32Bit)50 extern BS3_CMN_NM(Bs3SwitchTo16Bit) 51 jmp BS3_CMN_NM(Bs3SwitchTo16Bit) 52 52 53 53 %else … … 66 66 BS3_BEGIN_TEXT16 67 67 BS3_SET_BITS TMPL_BITS 68 .sixteen_bit_segment: 68 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 69 69 %endif 70 70 extern _Bs3SwitchTo16Bit_c32 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16.asm
r62484 r64694 68 68 ; 69 69 %if TMPL_BITS != 16 70 shl xPRE [xSP + xCB], TMPL_BITS - 16 ; Adjust the return address.70 shl xPRE [xSP], TMPL_BITS - 16 ; Adjust the return address. 71 71 add xSP, xCB - 2 72 72 … … 75 75 BS3_BEGIN_TEXT16 76 76 BS3_SET_BITS TMPL_BITS 77 .sixteen_bit_segment: 77 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 78 78 %endif 79 79 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_32.asm
r60557 r64694 53 53 BS3_BEGIN_TEXT16 54 54 BS3_SET_BITS TMPL_BITS 55 .sixteen_bit_segment: 55 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 56 56 %endif 57 57 extern TMPL_NM(Bs3SwitchToPE16) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_V86.asm
r60557 r64694 57 57 BS3_BEGIN_TEXT16 58 58 BS3_SET_BITS TMPL_BITS 59 .sixteen_bit_segment: 59 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 60 60 %endif 61 61 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE32.asm
r62484 r64694 61 61 %if TMPL_BITS != 32 62 62 %if TMPL_BITS > 32 63 shl xPRE [xSP + xCB], 32; Adjust the return address from 64-bit to 32-bit.63 shl xPRE [xSP], 32 ; Adjust the return address from 64-bit to 32-bit. 64 64 add rsp, xCB - 4 65 65 %else 66 66 push word 0 ; Reserve space to expand the return address. 67 67 %endif 68 %endif 69 %if TMPL_BITS != 16 68 70 ; Must be in 16-bit segment when calling Bs3SwitchTo16Bit. 69 71 jmp .sixteen_bit_segment 70 72 BS3_BEGIN_TEXT16 71 73 BS3_SET_BITS TMPL_BITS 72 .sixteen_bit_segment: 74 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 73 75 %endif 74 75 76 ; 76 77 ; Switch to real mode. … … 99 100 jmp BS3_SEL_R0_CS32:dword .thirty_two_bit wrt FLAT 100 101 BS3_BEGIN_TEXT32 101 .thirty_two_bit: 102 BS3_GLOBAL_LOCAL_LABEL .thirty_two_bit 102 103 103 104 ; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE32_16.asm
r60557 r64694 48 48 49 49 %elif TMPL_MODE == BS3_MODE_PE32 50 extern BS3_CMN_NM(Bs3SwitchTo 32Bit)51 jmp BS3_CMN_NM(Bs3SwitchTo 32Bit)50 extern BS3_CMN_NM(Bs3SwitchTo16Bit) 51 jmp BS3_CMN_NM(Bs3SwitchTo16Bit) 52 52 53 53 %else … … 66 66 BS3_BEGIN_TEXT16 67 67 BS3_SET_BITS TMPL_BITS 68 .sixteen_bit_segment: 68 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 69 69 %endif 70 70 extern _Bs3SwitchTo16Bit_c32 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16.asm
r60686 r64694 25 25 ; 26 26 27 ;********************************************************************************************************************************* 28 ;* Header Files * 29 ;********************************************************************************************************************************* 27 30 %include "bs3kit-template-header.mac" 28 31 32 ;********************************************************************************************************************************* 33 ;* External Symbols * 34 ;********************************************************************************************************************************* 29 35 %ifndef TMPL_PP16 36 BS3_BEGIN_TEXT16 30 37 extern NAME(Bs3EnteredMode_pp16) 31 38 %ifdef TMPL_PP32 32 39 BS3_EXTERN_CMN Bs3SwitchTo16Bit 33 %else 34 %endif 35 %endif 40 %endif 41 TMPL_BEGIN_TEXT 42 %endif 43 36 44 37 45 ;; … … 76 84 ; 77 85 %if TMPL_BITS != 16 78 shl xPRE [xSP + xCB], TMPL_BITS - 16 ; Adjust the return address.86 shl xPRE [xSP], TMPL_BITS - 16 ; Adjust the return address. 79 87 add xSP, xCB - 2 80 88 … … 83 91 BS3_BEGIN_TEXT16 84 92 BS3_SET_BITS TMPL_BITS 85 .sixteen_bit_segment: 93 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 86 94 %endif 87 95 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16_32.asm
r60557 r64694 53 53 BS3_BEGIN_TEXT16 54 54 BS3_SET_BITS TMPL_BITS 55 .sixteen_bit_segment: 55 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 56 56 %endif 57 57 extern TMPL_NM(Bs3SwitchToPP16) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP16_V86.asm
r60557 r64694 57 57 BS3_BEGIN_TEXT16 58 58 BS3_SET_BITS TMPL_BITS 59 .sixteen_bit_segment: 59 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 60 60 %endif 61 61 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP32.asm
r62484 r64694 62 62 %if TMPL_BITS != 32 63 63 %if TMPL_BITS > 32 64 shl xPRE [xSP + xCB], 32; Adjust the return address from 64-bit to 32-bit.64 shl xPRE [xSP], 32 ; Adjust the return address from 64-bit to 32-bit. 65 65 add rsp, xCB - 4 66 66 %else 67 67 push word 0 ; Reserve space to expand the return address. 68 68 %endif 69 %endif 70 %if TMPL_BITS != 16 69 71 ; Must be in 16-bit segment when calling Bs3SwitchTo16Bit. 70 72 jmp .sixteen_bit_segment 71 73 BS3_BEGIN_TEXT16 72 74 BS3_SET_BITS TMPL_BITS 73 .sixteen_bit_segment: 75 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 74 76 %endif 75 77 … … 129 131 jmp BS3_SEL_R0_CS32:dword .thirty_two_bit wrt FLAT 130 132 BS3_BEGIN_TEXT32 131 .thirty_two_bit: 133 BS3_GLOBAL_LOCAL_LABEL .thirty_two_bit 132 134 ; 133 135 ; Convert the (now) real mode stack pointer to 32-bit flat. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPP32_16.asm
r60557 r64694 48 48 49 49 %elif TMPL_MODE == BS3_MODE_PP32 50 extern BS3_CMN_NM(Bs3SwitchTo 32Bit)51 jmp BS3_CMN_NM(Bs3SwitchTo 32Bit)50 extern BS3_CMN_NM(Bs3SwitchTo16Bit) 51 jmp BS3_CMN_NM(Bs3SwitchTo16Bit) 52 52 53 53 %else -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToRM.asm
r62484 r64694 242 242 BS3_BEGIN_TEXT16 243 243 BS3_SET_BITS TMPL_BITS 244 .sixteen_bit_segment: 244 BS3_GLOBAL_LOCAL_LABEL .sixteen_bit_segment 245 245 246 246 extern BS3_CMN_NM(Bs3SwitchTo16Bit) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModesByOne.c
r62471 r64694 112 112 extern PFNBS3TESTDOMODE g_pfnBs3TestDoModesByOneCurrent; 113 113 114 #include <iprt/asm-amd64-x86.h> 114 115 115 116 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModesHlp.asm
r60676 r64694 38 38 ; 39 39 %if TMPL_MODE == BS3_MODE_RM 40 %define MY_BEGIN_TEXT BS3_BEGIN_RMTEXT16 41 %define MY_BEGIN_TEXT16 BS3_BEGIN_RMTEXT16 42 %else 43 %define MY_BEGIN_TEXT TMPL_BEGIN_TEXT 44 %define MY_BEGIN_TEXT16 BS3_BEGIN_TEXT16 40 %define MY_BEGIN_TEXT BS3_BEGIN_RMTEXT16 41 %define MY_BEGIN_TEXT16 BS3_BEGIN_RMTEXT16 42 %define MY_TEXT16_WRT(a_Label) a_Label wrt BS3GROUPRMTEXT16 43 %else 44 %define MY_BEGIN_TEXT TMPL_BEGIN_TEXT 45 %define MY_BEGIN_TEXT16 BS3_BEGIN_TEXT16 46 %define MY_TEXT16_WRT(a_Label) BS3_TEXT16_WRT(a_Label) 45 47 %endif 46 48 … … 137 139 138 140 139 141 MY_BEGIN_TEXT16 ; need the group definition 140 142 MY_BEGIN_TEXT 141 143 … … 277 279 ; @uses rax 278 280 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInRM, BS3_PBC_NEAR 279 BS3_LEA_MOV_WRT_RIP(xAX, .doit)280 jmp TMPL_NM(bs3TestCallDoerPrologue) 281 MY_BEGIN_TEXT16 282 BS3_SET_BITS TMPL_BITS 283 .doit: 281 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 282 jmp TMPL_NM(bs3TestCallDoerPrologue) 283 MY_BEGIN_TEXT16 284 BS3_SET_BITS TMPL_BITS 285 BS3_GLOBAL_LOCAL_LABEL .doit 284 286 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 285 287 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 326 328 ; @uses rax 327 329 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16, BS3_PBC_NEAR 328 BS3_LEA_MOV_WRT_RIP(xAX, .doit)329 jmp TMPL_NM(bs3TestCallDoerPrologue) 330 MY_BEGIN_TEXT16 331 BS3_SET_BITS TMPL_BITS 332 .doit: 330 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 331 jmp TMPL_NM(bs3TestCallDoerPrologue) 332 MY_BEGIN_TEXT16 333 BS3_SET_BITS TMPL_BITS 334 BS3_GLOBAL_LOCAL_LABEL .doit 333 335 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 334 336 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 367 369 ; @uses rax 368 370 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_32, BS3_PBC_NEAR 369 BS3_LEA_MOV_WRT_RIP(xAX, .doit)371 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 370 372 jmp TMPL_NM(bs3TestCallDoerPrologue) 371 373 .doit: … … 396 398 ; @uses rax 397 399 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE16_V86, BS3_PBC_NEAR 398 BS3_LEA_MOV_WRT_RIP(xAX, .doit) 399 jmp TMPL_NM(bs3TestCallDoerPrologue) 400 .doit: 400 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 401 jmp TMPL_NM(bs3TestCallDoerPrologue) 402 MY_BEGIN_TEXT16 403 BS3_SET_BITS TMPL_BITS 404 BS3_GLOBAL_LOCAL_LABEL .doit 401 405 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 402 406 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 429 433 STRICT_CHECK_REGS 430 434 jmp TMPL_NM(bs3TestCallDoerEpilogue) 435 MY_BEGIN_TEXT 431 436 BS3_PROC_END_MODE Bs3TestCallDoerInPE16_V86 432 437 … … 435 440 ; @uses rax 436 441 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32, BS3_PBC_NEAR 437 BS3_LEA_MOV_WRT_RIP(xAX, .doit)442 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 438 443 jmp TMPL_NM(bs3TestCallDoerPrologue) 439 444 .doit: … … 464 469 ; @uses rax 465 470 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPE32_16, BS3_PBC_NEAR 466 BS3_LEA_MOV_WRT_RIP(xAX, .doit)467 jmp TMPL_NM(bs3TestCallDoerPrologue) 468 MY_BEGIN_TEXT16 469 BS3_SET_BITS TMPL_BITS 470 .doit: 471 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 472 jmp TMPL_NM(bs3TestCallDoerPrologue) 473 MY_BEGIN_TEXT16 474 BS3_SET_BITS TMPL_BITS 475 BS3_GLOBAL_LOCAL_LABEL .doit 471 476 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 472 477 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 506 511 ; @uses rax 507 512 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPEV86, BS3_PBC_NEAR 508 BS3_LEA_MOV_WRT_RIP(xAX, .doit)509 jmp TMPL_NM(bs3TestCallDoerPrologue) 510 MY_BEGIN_TEXT16 511 BS3_SET_BITS TMPL_BITS 512 .doit: 513 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 514 jmp TMPL_NM(bs3TestCallDoerPrologue) 515 MY_BEGIN_TEXT16 516 BS3_SET_BITS TMPL_BITS 517 BS3_GLOBAL_LOCAL_LABEL .doit 513 518 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 514 519 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 554 559 ; @uses rax 555 560 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16, BS3_PBC_NEAR 556 BS3_LEA_MOV_WRT_RIP(xAX, .doit)557 jmp TMPL_NM(bs3TestCallDoerPrologue) 558 MY_BEGIN_TEXT16 559 BS3_SET_BITS TMPL_BITS 560 .doit: 561 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 562 jmp TMPL_NM(bs3TestCallDoerPrologue) 563 MY_BEGIN_TEXT16 564 BS3_SET_BITS TMPL_BITS 565 BS3_GLOBAL_LOCAL_LABEL .doit 561 566 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 562 567 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 596 601 ; @uses rax 597 602 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_32, BS3_PBC_NEAR 598 BS3_LEA_MOV_WRT_RIP(xAX, .doit)603 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 599 604 jmp TMPL_NM(bs3TestCallDoerPrologue) 600 605 .doit: … … 625 630 ; @uses rax 626 631 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP16_V86, BS3_PBC_NEAR 627 BS3_LEA_MOV_WRT_RIP(xAX, .doit) 628 jmp TMPL_NM(bs3TestCallDoerPrologue) 629 .doit: 632 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 633 jmp TMPL_NM(bs3TestCallDoerPrologue) 634 MY_BEGIN_TEXT16 635 BS3_SET_BITS TMPL_BITS 636 BS3_GLOBAL_LOCAL_LABEL .doit 630 637 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 631 638 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 658 665 STRICT_CHECK_REGS 659 666 jmp TMPL_NM(bs3TestCallDoerEpilogue) 667 MY_BEGIN_TEXT 660 668 BS3_PROC_END_MODE Bs3TestCallDoerInPP16_V86 661 669 … … 664 672 ; @uses rax 665 673 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32, BS3_PBC_NEAR 666 BS3_LEA_MOV_WRT_RIP(xAX, .doit)674 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 667 675 jmp TMPL_NM(bs3TestCallDoerPrologue) 668 676 .doit: … … 693 701 ; @uses rax 694 702 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPP32_16, BS3_PBC_NEAR 695 BS3_LEA_MOV_WRT_RIP(xAX, .doit)696 jmp TMPL_NM(bs3TestCallDoerPrologue) 697 MY_BEGIN_TEXT16 698 BS3_SET_BITS TMPL_BITS 699 .doit: 703 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 704 jmp TMPL_NM(bs3TestCallDoerPrologue) 705 MY_BEGIN_TEXT16 706 BS3_SET_BITS TMPL_BITS 707 BS3_GLOBAL_LOCAL_LABEL .doit 700 708 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 701 709 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 735 743 ; @uses rax 736 744 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPPV86, BS3_PBC_NEAR 737 BS3_LEA_MOV_WRT_RIP(xAX, .doit)738 jmp TMPL_NM(bs3TestCallDoerPrologue) 739 MY_BEGIN_TEXT16 740 BS3_SET_BITS TMPL_BITS 741 .doit: 745 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 746 jmp TMPL_NM(bs3TestCallDoerPrologue) 747 MY_BEGIN_TEXT16 748 BS3_SET_BITS TMPL_BITS 749 BS3_GLOBAL_LOCAL_LABEL .doit 742 750 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 743 751 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 772 780 MY_BEGIN_TEXT 773 781 BS3_PROC_END_MODE Bs3TestCallDoerInPPV86 774 775 782 776 783 … … 783 790 ; @uses rax 784 791 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16, BS3_PBC_NEAR 785 BS3_LEA_MOV_WRT_RIP(xAX, .doit)786 jmp TMPL_NM(bs3TestCallDoerPrologue) 787 MY_BEGIN_TEXT16 788 BS3_SET_BITS TMPL_BITS 789 .doit: 792 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 793 jmp TMPL_NM(bs3TestCallDoerPrologue) 794 MY_BEGIN_TEXT16 795 BS3_SET_BITS TMPL_BITS 796 BS3_GLOBAL_LOCAL_LABEL .doit 790 797 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 791 798 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 825 832 ; @uses rax 826 833 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_32, BS3_PBC_NEAR 827 BS3_LEA_MOV_WRT_RIP(xAX, .doit)834 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 828 835 jmp TMPL_NM(bs3TestCallDoerPrologue) 829 836 .doit: … … 854 861 ; @uses rax 855 862 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE16_V86, BS3_PBC_NEAR 856 BS3_LEA_MOV_WRT_RIP(xAX, .doit) 857 jmp TMPL_NM(bs3TestCallDoerPrologue) 858 .doit: 863 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 864 jmp TMPL_NM(bs3TestCallDoerPrologue) 865 MY_BEGIN_TEXT16 866 BS3_SET_BITS TMPL_BITS 867 BS3_GLOBAL_LOCAL_LABEL .doit 859 868 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 860 869 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 887 896 STRICT_CHECK_REGS 888 897 jmp TMPL_NM(bs3TestCallDoerEpilogue) 898 MY_BEGIN_TEXT 889 899 BS3_PROC_END_MODE Bs3TestCallDoerInPAE16_V86 890 900 … … 893 903 ; @uses rax 894 904 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32, BS3_PBC_NEAR 895 BS3_LEA_MOV_WRT_RIP(xAX, .doit)905 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 896 906 jmp TMPL_NM(bs3TestCallDoerPrologue) 897 907 .doit: … … 922 932 ; @uses rax 923 933 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAE32_16, BS3_PBC_NEAR 924 BS3_LEA_MOV_WRT_RIP(xAX, .doit)925 jmp TMPL_NM(bs3TestCallDoerPrologue) 926 MY_BEGIN_TEXT16 927 BS3_SET_BITS TMPL_BITS 928 .doit: 934 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 935 jmp TMPL_NM(bs3TestCallDoerPrologue) 936 MY_BEGIN_TEXT16 937 BS3_SET_BITS TMPL_BITS 938 BS3_GLOBAL_LOCAL_LABEL .doit 929 939 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 930 940 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 964 974 ; @uses rax 965 975 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInPAEV86, BS3_PBC_NEAR 966 BS3_LEA_MOV_WRT_RIP(xAX, .doit)967 jmp TMPL_NM(bs3TestCallDoerPrologue) 968 MY_BEGIN_TEXT16 969 BS3_SET_BITS TMPL_BITS 970 .doit: 976 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 977 jmp TMPL_NM(bs3TestCallDoerPrologue) 978 MY_BEGIN_TEXT16 979 BS3_SET_BITS TMPL_BITS 980 BS3_GLOBAL_LOCAL_LABEL .doit 971 981 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 972 982 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 1012 1022 ; @uses rax 1013 1023 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM16, BS3_PBC_NEAR 1014 BS3_LEA_MOV_WRT_RIP(xAX, .doit)1015 jmp TMPL_NM(bs3TestCallDoerPrologue) 1016 MY_BEGIN_TEXT16 1017 BS3_SET_BITS TMPL_BITS 1018 .doit: 1024 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 1025 jmp TMPL_NM(bs3TestCallDoerPrologue) 1026 MY_BEGIN_TEXT16 1027 BS3_SET_BITS TMPL_BITS 1028 BS3_GLOBAL_LOCAL_LABEL .doit 1019 1029 mov ax, [xBP + xCB + cbCurRetAddr] ; Load far function pointer. 1020 1030 mov dx, [xBP + xCB + cbCurRetAddr + 2] … … 1054 1064 ; @uses rax 1055 1065 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM32, BS3_PBC_NEAR 1056 BS3_LEA_MOV_WRT_RIP(xAX, .doit)1066 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 1057 1067 jmp TMPL_NM(bs3TestCallDoerPrologue) 1058 1068 .doit: … … 1084 1094 ; @uses rax 1085 1095 BS3_PROC_BEGIN_MODE Bs3TestCallDoerInLM64, BS3_PBC_NEAR 1086 BS3_LEA_MOV_WRT_RIP(xAX, .doit)1096 BS3_LEA_MOV_WRT_RIP(xAX, MY_TEXT16_WRT(.doit)) 1087 1097 jmp TMPL_NM(bs3TestCallDoerPrologue) 1088 1098 .doit: -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-footer.mac
r60676 r64694 127 127 %unmacro TONLY32 1+ 128 128 %unmacro TONLY64 1+ 129 %unmacro TNOT16 1+ 130 %unmacro TNOT32 1+ 129 131 %unmacro TNOT64 1+ 130 132 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.mac
r62484 r64694 470 470 %endif 471 471 472 ;; @def TNOT16 473 ; Version of BNOT16 that follows the code template. 474 ; Like BNOT16 this normally goes in column 1. 475 %if TMPL_BITS == 16 476 %macro TNOT16 1+ 477 %endmacro 478 %else 479 %macro TNOT16 1+ 480 %1 481 %endmacro 482 %endif 483 484 ;; @def TNOT32 485 ; Version of BNOT32 that follows the code template. 486 ; Like BNOT32 this normally goes in column 1. 487 %if TMPL_BITS == 32 488 %macro TNOT32 1+ 489 %endmacro 490 %else 491 %macro TNOT32 1+ 492 %1 493 %endmacro 494 %endif 495 472 496 ;; @def TNOT64 473 497 ; Version of BNOT64 that follows the code template. … … 481 505 %endmacro 482 506 %endif 507 483 508 484 509 ; -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r64367 r64694 2313 2313 * Afterwards it switches back to v8086 mode and returns a 16-bit status code. 2314 2314 * 2315 * @returns 16-bit status code if the function returned anything. 2316 * @param fpfnCall Far real mode pointer to the function to call. 2317 * @param cbParams The size of the parameter list, in bytes. 2318 * @param ... The parameters. 2315 * @returns 16-bit status code if the function returned anything. 2316 * @param fpfnCall Far real mode pointer to the function to call. 2317 * @param cbParams The size of the parameter list, in bytes. 2318 * @param ... The parameters. 2319 * @sa Bs3SwitchTo32BitAndCallC 2319 2320 */ 2320 2321 BS3_CMN_PROTO_STUB(int, Bs3SwitchFromV86To16BitAndCallC,(FPFNBS3FAR fpfnCall, unsigned cbParams, ...)); … … 3304 3305 3305 3306 /** 3307 * Call 32-bit prot mode C function. 3308 * 3309 * This switches from the current mode and calls the 32-bit @a fpfnCall C code 3310 * with @a cbParams on the stack, then returns. 3311 * 3312 * @returns 32-bit status code if the function returned anything. 3313 * @param fpfnCall Address of the 32-bit C function to call. When 3314 * called from 16-bit code, this is a far real mode 3315 * function pointer, i.e. as fixed up by the linker. 3316 * In 32-bit and 64-bit code, this is a flat address. 3317 * @param cbParams The size of the parameter list, in bytes. 3318 * @param ... The parameters. 3319 * @sa Bs3SwitchFromV86To16BitAndCallC 3320 * 3321 * @remarks WARNING! This probably doesn't work in 64-bit mode yet. 3322 * Only tested for 16-bit real mode. 3323 */ 3324 BS3_MODE_PROTO_STUB(int32_t, Bs3SwitchTo32BitAndCallC,(FPFNBS3FAR fpfnCall, unsigned cbParams, ...)); 3325 3326 /** 3306 3327 * Initializes trap handling for the current system. 3307 3328 * … … 3319 3340 3320 3341 /** 3321 * Executes the array of tests in every possibly mode, uni tifed driver.3342 * Executes the array of tests in every possibly mode, unified driver. 3322 3343 * 3323 3344 * This requires much less code space than Bs3TestDoModes as there is only one -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
r62484 r64694 213 213 %endif 214 214 215 ;; @def BS3_TEXT16_WRT 216 ; For accessing BS3DATA16 correctly. 217 ; @param a_Label The BS3TEXT16 label. 218 %undef BS3_TEXT16_WRT 219 %if %1 == 16 220 %define BS3_TEXT16_WRT(a_Label) a_Label wrt CGROUP16 221 %elif %1 == 32 222 %define BS3_TEXT16_WRT(a_Label) a_Label wrt FLAT 223 %else 224 %define BS3_TEXT16_WRT(a_Label) BS3_WRT_RIP(a_Label) wrt FLAT 225 %endif 226 215 227 %undef BS3_IF_16BIT_OTHERWISE 216 228 %if %1 == 16 … … 622 634 %macro BS3_GLOBAL_NAME_EX 3 623 635 global %1 636 %1: 637 %undef BS3_LAST_LABEL 638 %xdefine BS3_LAST_LABEL %1 639 %endmacro 640 641 ;; 642 ; Global local label. 643 ; 644 ; This should be used when switching segments and jumping to it via a local lable. 645 ; It makes the lable visible to the debugger and map file. 646 ; 647 %macro BS3_GLOBAL_LOCAL_LABEL 1 648 global RT_CONCAT(BS3_LAST_LABEL,%1) 624 649 %1: 625 650 %endmacro
Note:
See TracChangeset
for help on using the changeset viewer.