Changeset 59885 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Mar 1, 2016 12:13:37 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 4 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r59878 r59885 193 193 bs3-mode-SwitchToRM.asm \ 194 194 bs3-mode-SwitchToPE16.asm \ 195 bs3-mode-SwitchToPE16_32.asm \ 196 bs3-mode-SwitchToPE16_V86.asm \ 195 197 bs3-mode-SwitchToPE32.asm \ 196 198 bs3-mode-SwitchToPP16.asm \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
r59863 r59885 27 27 %include "bs3kit-template-header.mac" 28 28 29 %if TMPL_BITS != 1630 29 BS3_EXTERN_DATA16 g_bBs3CurrentMode 31 30 TMPL_BEGIN_TEXT 32 %endif33 31 34 32 … … 39 37 BS3_PROC_BEGIN_CMN Bs3SwitchTo16Bit 40 38 %if TMPL_BITS == 16 39 push ax 40 push ds 41 42 ; Check g_bBs3CurrentMode whether we're in v8086 mode or not. 43 mov ax, seg g_bBs3CurrentMode 44 mov ds, ax 45 mov al, [g_bBs3CurrentMode] 46 and al, BS3_MODE_CODE_MASK 47 cmp al, BS3_MODE_CODE_V86 48 jne .ret_16bit 49 50 ; Switch to ring-0 if v8086 mode. 51 mov ax, BS3_SYSCALL_TO_RING0 52 int BS3_TRAP_SYSCALL 53 54 .ret_16bit: 55 pop ds 56 pop ax 41 57 ret 58 42 59 %else 43 60 push xAX -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm
r59863 r59885 53 53 cli 54 54 55 %if TMPL_BITS == 16 56 ; Check for v8086 mode, we need to exit it to enter 32-bit mode. 57 mov ax, seg g_bBs3CurrentMode 58 mov ds, ax 59 mov al, [g_bBs3CurrentMode] 60 and al, BS3_MODE_CODE_MASK 61 cmp al, BS3_MODE_CODE_V86 62 jne .not_v8086 63 64 mov ax, BS3_SYSCALL_TO_RING0 65 int BS3_TRAP_SYSCALL 66 67 mov xAX, BS3_SEL_R0_CS32 68 jmp .do_far_jump 69 %endif 70 71 .not_v8086: 55 72 ; Calc ring addend. 56 73 mov ax, cs … … 60 77 61 78 ; Create far return for switching to 32-bit mode. 79 .do_far_jump: 62 80 push sAX 63 81 %if TMPL_BITS == 16 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm
r59863 r59885 41 41 %if TMPL_BITS == 64 42 42 ret 43 44 %elif BS3_MODE_IS_RM_OR_V86(TMPL_MODE) 45 .again: int3 ; Makes no sense to go to 64-bit mode from real or v8086 mode. 46 jmp .again 47 43 48 %else 44 49 %if TMPL_BITS == 16 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToV86.asm
r59863 r59885 38 38 ; 39 39 BS3_PROC_BEGIN_CMN Bs3SwitchTo16Bit 40 %if TMPL_BITS == 1640 %if BS3_MODE_IS_16BIT_CODE_NO_V86(TMPL_MODE) 41 41 ret 42 42 %else … … 45 45 cli 46 46 47 %if BS3_MODE_IS_V86(TMPL_MODE) 48 ; Switch to ring-0 if v8086 mode. 49 mov ax, BS3_SYSCALL_TO_RING0 50 int BS3_TRAP_SYSCALL 51 %endif 52 47 53 ; Calc new CS. 54 %if BS3_MODE_IS_RM_OR_V86(TMPL_MODE) 55 mov xAX, BS3_SEL_R0_CS16 56 %else 48 57 mov ax, cs 49 58 and xAX, 3 50 59 shl xAX, BS3_SEL_RING_SHIFT ; ring addend. 51 60 add xAX, BS3_SEL_R0_CS16 61 %endif 52 62 53 63 ; Construct a far return for switching to 16-bit code. -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_32.asm
r59827 r59885 1 1 ; $Id$ 2 2 ;; @file 3 ; BS3Kit - Bs3SwitchToPE16 3 ; BS3Kit - Bs3SwitchToPE16_32 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2007-201 5Oracle Corporation7 ; Copyright (C) 2007-2016 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 30 30 ;; 31 ; Switch to 16-bit unpaged protected modefrom any other mode.31 ; Switch to 32-bit code under 16-bit unpaged protected mode sys/tss from any other mode. 32 32 ; 33 ; @cproto BS3_DECL(void) Bs3SwitchToPE16 (void);33 ; @cproto BS3_DECL(void) Bs3SwitchToPE16_32(void); 34 34 ; 35 35 ; @uses Nothing (except high 32-bit register parts). 36 36 ; 37 ; @remarks Obviously returns to 16-bit mode, even if the caller was38 ; in 32-bit or 64-bit mode.37 ; @remarks Obviously returns to 32-bit mode, even if the caller was 38 ; in 16-bit or 64-bit mode. 39 39 ; 40 40 ; @remarks Does not require 20h of parameter scratch space in 64-bit mode. 41 41 ; 42 BS3_PROC_BEGIN_MODE Bs3SwitchToPE16 43 %ifdef TMPL_PE16 42 BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_32 43 %ifdef TMPL_PE16_32 44 44 ret 45 45 46 46 %else 47 47 ; 48 ; Switch to 16-bit mode and prepare for returning in 16-bit mode.48 ; Make sure we're the 16-bit segment and then call Bs3SwitchToPE16. 49 49 ; 50 50 %if TMPL_BITS != 16 51 shl xPRE [xSP + xCB], TMPL_BITS - 16 ; Adjust the return address.52 add xSP, xCB - 253 54 ; Must be in 16-bit segment when calling Bs3SwitchTo16Bit.55 51 jmp .sixteen_bit_segment 56 52 BS3_BEGIN_TEXT16 … … 58 54 .sixteen_bit_segment: 59 55 %endif 56 extern TMPL_NM(Bs3SwitchToPE16) 57 call TMPL_NM(Bs3SwitchToPE16) 58 BS3_SET_BITS 16 60 59 61 60 ; 62 ; Switch to realmode.61 ; Switch to 32-bit mode. 63 62 ; 64 extern TMPL_NM(Bs3SwitchToRM) 65 call TMPL_NM(Bs3SwitchToRM) 66 BS3_SET_BITS 16 67 68 push ax 69 push cx 70 pushf 71 cli 63 extern TMPL_NM(Bs3SwitchTo32Bit) 64 call TMPL_NM(Bs3SwitchTo32Bit) 65 BS3_SET_BITS 32 72 66 73 67 ; 74 ; Load the GDT and enable PE16.68 ; Fix the return address and return. 75 69 ; 76 BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt 77 BS3_BEGIN_TEXT16 78 mov ax, BS3SYSTEM16 79 mov ds, ax 80 lgdt [Bs3Lgdt_Gdt] 70 %if TMPL_BITS == 16 71 push word [esp] 72 %elif TMPL_BITS == 64 73 pop dword [esp + 4] 74 %endif 75 ret 76 %endif 77 BS3_PROC_END_MODE Bs3SwitchToPE16_32 81 78 82 smsw ax83 or ax, X86_CR0_PE84 lmsw ax85 86 ;87 ; Convert from real mode stack to protected mode stack.88 ;89 mov ax, .p16_stack90 extern NAME(Bs3ConvertRMStackToP16UsingCxReturnToAx_c16)91 jmp NAME(Bs3ConvertRMStackToP16UsingCxReturnToAx_c16)92 .p16_stack:93 94 ;95 ; Call routine for doing mode specific setups.96 ;97 extern NAME(Bs3EnteredMode_pe16)98 call NAME(Bs3EnteredMode_pe16)99 100 popf101 pop cx102 pop ax103 ret104 105 %if TMPL_BITS != 16106 TMPL_BEGIN_TEXT107 %endif108 %endif109 BS3_PROC_END_MODE Bs3SwitchToPE16110 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_V86.asm
r59827 r59885 1 1 ; $Id$ 2 2 ;; @file 3 ; BS3Kit - Bs3SwitchToPE16 3 ; BS3Kit - Bs3SwitchToPE16_V86 4 4 ; 5 5 6 6 ; 7 ; Copyright (C) 2007-201 5Oracle Corporation7 ; Copyright (C) 2007-2016 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 40 40 ; @remarks Does not require 20h of parameter scratch space in 64-bit mode. 41 41 ; 42 BS3_PROC_BEGIN_MODE Bs3SwitchToPE16 43 %ifdef TMPL_PE16 42 BS3_PROC_BEGIN_MODE Bs3SwitchToPE16_V86 43 %ifdef TMPL_PE16_V86 44 44 ret 45 45 46 46 %else 47 47 ; 48 ; Switch to 16-bit mode and prepare for returning in 16-bit mode.48 ; Make sure we're the 16-bit segment and then call Bs3SwitchToPE16. 49 49 ; 50 50 %if TMPL_BITS != 16 51 shl xPRE [xSP + xCB], TMPL_BITS - 16 ; Adjust the return address.52 add xSP, xCB - 253 54 ; Must be in 16-bit segment when calling Bs3SwitchTo16Bit.55 51 jmp .sixteen_bit_segment 56 52 BS3_BEGIN_TEXT16 … … 58 54 .sixteen_bit_segment: 59 55 %endif 56 extern TMPL_NM(Bs3SwitchToPE16) 57 call TMPL_NM(Bs3SwitchToPE16) 58 BS3_SET_BITS 16 60 59 61 60 ; 62 ; Switch to realmode.61 ; Switch to v8086 mode. 63 62 ; 64 extern TMPL_NM(Bs3SwitchToRM) 65 call TMPL_NM(Bs3SwitchToRM) 66 BS3_SET_BITS 16 63 extern TMPL_NM(Bs3SwitchToV86) 64 jmp TMPL_NM(Bs3SwitchToV86) 65 %endif 66 BS3_PROC_END_MODE Bs3SwitchToPE16_V86 67 67 68 push ax69 push cx70 pushf71 cli72 73 ;74 ; Load the GDT and enable PE16.75 ;76 BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt77 BS3_BEGIN_TEXT1678 mov ax, BS3SYSTEM1679 mov ds, ax80 lgdt [Bs3Lgdt_Gdt]81 82 smsw ax83 or ax, X86_CR0_PE84 lmsw ax85 86 ;87 ; Convert from real mode stack to protected mode stack.88 ;89 mov ax, .p16_stack90 extern NAME(Bs3ConvertRMStackToP16UsingCxReturnToAx_c16)91 jmp NAME(Bs3ConvertRMStackToP16UsingCxReturnToAx_c16)92 .p16_stack:93 94 ;95 ; Call routine for doing mode specific setups.96 ;97 extern NAME(Bs3EnteredMode_pe16)98 call NAME(Bs3EnteredMode_pe16)99 100 popf101 pop cx102 pop ax103 ret104 105 %if TMPL_BITS != 16106 TMPL_BEGIN_TEXT107 %endif108 %endif109 BS3_PROC_END_MODE Bs3SwitchToPE16110
Note:
See TracChangeset
for help on using the changeset viewer.