- Timestamp:
- Mar 4, 2016 8:32:23 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 10 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r59895 r59934 198 198 bs3-mode-SwitchToPE16_V86.asm \ 199 199 bs3-mode-SwitchToPE32.asm \ 200 bs3-mode-SwitchToPE32_16.asm \ 201 bs3-mode-SwitchToPEV86.asm \ 200 202 bs3-mode-SwitchToPP16.asm \ 203 bs3-mode-SwitchToPP16_32.asm \ 204 bs3-mode-SwitchToPP16_V86.asm \ 201 205 bs3-mode-SwitchToPP32.asm \ 206 bs3-mode-SwitchToPP32_16.asm \ 207 bs3-mode-SwitchToPPV86.asm \ 202 208 bs3-mode-SwitchToPAE16.asm \ 209 bs3-mode-SwitchToPAE16_32.asm \ 210 bs3-mode-SwitchToPAE16_V86.asm \ 203 211 bs3-mode-SwitchToPAE32.asm \ 212 bs3-mode-SwitchToPAE32_16.asm \ 213 bs3-mode-SwitchToPAEV86.asm \ 204 214 bs3-mode-SwitchToLM64.asm \ 205 215 bs3-mode-SwitchToLM32.asm \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
r59885 r59934 59 59 %else 60 60 push xAX 61 push xBX 61 62 xPUSHF 62 63 cli … … 77 78 78 79 ; Load 16-bit segment registers. 79 ;; @todo support non-standard stacks?80 80 add ax, BS3_SEL_R0_SS16 - BS3_SEL_R0_CS16 81 81 mov ss, ax … … 84 84 mov ds, ax 85 85 mov es, ax 86 87 ; Thunk the stack if necessary. 88 mov ebx, esp 89 shr ebx, 16 90 jz .stack_ok 91 int3 ; This is for later, just remove this int3 once needed. 92 test ax, X86_SEL_RPL 93 jnz .stack_rpl_must_be_0_for_custom_stacks 94 shl bx, X86_SEL_SHIFT 95 add bx, BS3_SEL_TILED 96 mov ss, bx 97 movzx esp, sp 98 .stack_ok: 86 99 87 100 ; Update globals. … … 93 106 add sp, 4 94 107 %endif 108 pop ebx 109 %if TMPL_BITS == 64 110 add sp, 4 111 %endif 95 112 pop eax 96 113 %if TMPL_BITS == 64 97 114 add sp, 4 98 115 %endif 99 ret sCB - 2 ; Return and pop 2 or 6 bytes of "parameters" (unused return value) 116 ret (TMPL_BITS - 16) / 8 ; Return and pop 2 or 6 bytes of "parameters" (unused return value) 117 118 .stack_rpl_must_be_0_for_custom_stacks: 119 int3 120 jmp .stack_rpl_must_be_0_for_custom_stacks 100 121 TMPL_BEGIN_TEXT 101 122 %endif -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16BitV86.asm
r59895 r59934 63 63 push ecx 64 64 push ebx 65 %if TMPL_BITS == 1665 %if TMPL_BITS == 16 66 66 push ds 67 67 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm
r59885 r59934 28 28 29 29 30 %if TMPL_BITS == 16 31 BS3_EXTERN_CMN Bs3SelProtFar32ToFlat32 32 %endif 30 33 %if TMPL_BITS != 32 31 34 BS3_EXTERN_DATA16 g_bBs3CurrentMode … … 47 50 push eax 48 51 pushfd 52 push edx 49 53 %else 50 54 pushfq … … 53 57 cli 54 58 55 %if TMPL_BITS == 1659 %if TMPL_BITS == 16 56 60 ; Check for v8086 mode, we need to exit it to enter 32-bit mode. 57 61 mov ax, seg g_bBs3CurrentMode … … 62 66 jne .not_v8086 63 67 68 ; Calc flat stack into edx. 69 mov dx, ss 70 movzx edx, dx 71 shl edx, 4 72 add dx, sp 73 adc edx, 0 ; edx = flat stack address corresponding to ss:sp 74 75 ; Switch to 16-bit ring0 and go on to do the far jump to 32-bit code. 64 76 mov ax, BS3_SYSCALL_TO_RING0 65 77 int BS3_TRAP_SYSCALL … … 67 79 mov xAX, BS3_SEL_R0_CS32 68 80 jmp .do_far_jump 69 %endif81 %endif 70 82 71 83 .not_v8086: 84 %if TMPL_BITS == 16 85 ; Calc flat stack into edx. 86 push ecx 87 push ebx 88 push ss 89 push word 0 90 push sp 91 call Bs3SelProtFar32ToFlat32 92 add sp, 6 93 shl edx, 16 94 mov dx, ax ; edx = flat stack address corresponding to ss:sp 95 pop ebx 96 pop ecx 97 %endif 98 72 99 ; Calc ring addend. 73 100 mov ax, cs … … 92 119 add eax, BS3_SEL_R0_SS32 - BS3_SEL_R0_CS32 93 120 mov ss, ax 121 %if TMPL_BITS == 16 122 mov esp, edx ; Load flat stack address. 123 %endif 94 124 95 125 add eax, BS3_SEL_R0_DS32 - BS3_SEL_R0_SS32 … … 103 133 %if TMPL_BITS == 16 104 134 ; Adjust the return address. 105 movsx eax, word [esp + 4* 2+ 2]135 movsx eax, word [esp + 4*3 + 2] 106 136 add eax, BS3_ADDR_BS3TEXT16 107 mov [esp + 4* 2], eax137 mov [esp + 4*3], eax 108 138 %endif 109 139 110 140 ; Restore and return. 141 BS3_ONLY_16BIT_STMT pop edx 111 142 popfd 112 143 pop eax -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm
r59885 r59934 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 … … 42 42 ret 43 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 .again47 48 44 %else 49 45 %if TMPL_BITS == 16 … … 59 55 cli 60 56 57 %if TMPL_BITS == 16 58 ; Check that this is LM16 59 mov ax, seg g_bBs3CurrentMode 60 cmp byte [g_bBs3CurrentMode], BS3_MODE_LM16 61 je .ok_lm16 62 int3 63 .ok_lm16: 64 %endif 65 61 66 ; Calc ring addend. 62 67 mov ax, cs … … 67 72 ; setup far return. 68 73 push sAX 69 %if TMPL_BITS == 1674 %if TMPL_BITS == 16 70 75 push dword .sixty_four_bit 71 76 o32 retf 72 %else77 %else 73 78 push .sixty_four_bit 74 79 retf 75 %endif80 %endif 76 81 77 82 BS3_SET_BITS 64 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_32.asm
r59885 r59934 46 46 %else 47 47 ; 48 ; Make sure we're the 16-bit segment and then call Bs3SwitchToPE16.48 ; Make sure we're in the 16-bit segment and then call Bs3SwitchToPE16. 49 49 ; 50 50 %if TMPL_BITS != 16 … … 61 61 ; Switch to 32-bit mode. 62 62 ; 63 extern TMPL_NM(Bs3SwitchTo32Bit) 64 call TMPL_NM(Bs3SwitchTo32Bit) 63 extern _Bs3SwitchTo32Bit_c16 64 %if TMPL_BITS == 16 65 jmp _Bs3SwitchTo32Bit_c16 66 %else 67 call _Bs3SwitchTo32Bit_c16 65 68 BS3_SET_BITS 32 66 67 ; 68 ; Fix the return address and return. 69 ; 70 %if TMPL_BITS == 16 71 push word [esp] 72 %elif TMPL_BITS == 64 73 pop dword [esp + 4] 69 %if TMPL_BITS == 32 70 ret 71 %else 72 ret 4 ; Return and pop 4 bytes of "parameters" (unused return address). 73 %endif 74 74 %endif 75 ret76 75 %endif 77 76 BS3_PROC_END_MODE Bs3SwitchToPE16_32 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToPE16_V86.asm
r59904 r59934 29 29 30 30 ;; 31 ; Switch to 16-bit unpaged protected mode from any other mode.31 ; Switch to 16-bit unpaged protected mode with 16-bit sys+tss from any other mode. 32 32 ; 33 33 ; @cproto BS3_DECL(void) Bs3SwitchToPE16(void); … … 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 16-bit v8086 mode, even if the caller was 38 ; in 16-bit, 32-bit or 64-bit mode. 39 39 ; 40 40 ; @remarks Does not require 20h of parameter scratch space in 64-bit mode. … … 65 65 66 66 ; 67 ; Switch to v8086 mode .67 ; Switch to v8086 mode (return address is already 16-bit). 68 68 ; 69 extern TMPL_NM(Bs3SwitchToV86)70 jmp TMPL_NM(Bs3SwitchToV86)69 extern _Bs3SwitchToV86_pe16 70 jmp _Bs3SwitchToV86_pe16 71 71 %endif 72 72 BS3_PROC_END_MODE Bs3SwitchToPE16_V86 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToRM.asm
r59863 r59934 28 28 29 29 BS3_EXTERN_SYSTEM16 Bs3Gdt 30 %if TMPL_MODE == BS3_MODE_PE16 31 BS3_EXTERN_DATA16 g_uBs3CpuDetected 32 %endif 30 33 TMPL_BEGIN_TEXT 31 34 … … 60 63 cli 61 64 62 %if TMPL_BITS != 16 65 %if TMPL_MODE == BS3_MODE_PE16 66 ; 67 ; On 80286 we must reset the CPU to get back to real mode. 68 ; 69 mov ax, seg g_uBs3CpuDetected 70 mov ds, ax 71 cmp byte [g_uBs3CpuDetected], BS3CPU_80286 72 jne .is_386_or_better 73 .implement_this_later: 74 int3 75 jmp .implement_this_later 76 77 jmp .reload_cs 78 79 %elif TMPL_BITS != 16 80 ; 63 81 ; Must be in 16-bit segment when calling Bs3SwitchTo16Bit. 82 ; 64 83 jmp .sixteen_bit_segment wrt FLAT 65 84 BS3_BEGIN_TEXT16 … … 75 94 ; Exit to real mode. 76 95 ; 96 .is_386_or_better: 77 97 mov eax, cr0 78 98 and eax, X86_CR0_NO_PE_NO_PG
Note:
See TracChangeset
for help on using the changeset viewer.