Changeset 59215 in vbox
- Timestamp:
- Dec 22, 2015 7:47:07 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/bootsectors/bs3kit
- Files:
-
- 8 edited
-
bs3-cmn-SwitchTo16Bit.asm (modified) (2 diffs)
-
bs3-cmn-SwitchTo32Bit.asm (modified) (1 diff)
-
bs3-cmn-SwitchTo64Bit.asm (modified) (1 diff)
-
bs3-cmn-SwitchToRing1.asm (modified) (1 diff)
-
bs3-first-pe16.asm (modified) (3 diffs)
-
bs3-mode-SwitchToRM.asm (modified) (1 diff)
-
bs3kit-template-header.mac (modified) (3 diffs)
-
bs3kit.mac (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo16Bit.asm
r58812 r59215 34 34 ret 35 35 %else 36 push xAX ; reserve space for far return37 36 push xAX 37 xPUSHF 38 cli 38 39 39 ; Far return, offset part. bits 63/31:16 must be zero. 40 movzx eax, word [xSP + xCB * 3] ; returning to 16-bit, so bit 16 and out must be zero. 41 mov [xSP + xCB * 2], xAX 40 ; Calc new CS. 41 mov ax, cs 42 and xAX, 3 43 shl xAX, BS3_SEL_RING_SHIFT ; ring addend. 44 add xAX, BS3_SEL_R0_CS16 42 45 43 mov ax, cs 44 and ax, 3 45 shl ax, BS3_SEL_RING_SHIFT ; ring addend. 46 add ax, BS3_SEL_R0_CS16 47 mov [esp + xCB * 3], xAX 46 ; Construct a far return for switching to 16-bit code. 47 push xAX 48 push .sixteen_bit 49 xRETF 48 50 51 BS3_BEGIN_TEXT16 52 .sixteen_bit: 49 53 ; Load 16-bit segment registers. 50 54 add ax, BS3_SEL_R0_SS16 - BS3_SEL_R0_CS16 … … 55 59 mov es, ax 56 60 57 ; Restore and return. 58 pop xAX 59 retf 61 popfd 62 %if TMPL_BITS == 64 63 add sp, 4 64 %endif 65 pop eax 66 %if TMPL_BITS == 64 67 add sp, 4 68 %endif 69 ret sCB - 2 ; Return and pop 2 or 6 bytes of "parameters" (unused return value) 70 TMPL_BEGIN_TEXT 60 71 %endif 61 72 BS3_PROC_END_CMN Bs3SwitchTo16Bit -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm
r58812 r59215 35 35 %else 36 36 %if TMPL_BITS == 16 37 sub sp, 638 push bp39 mov bp, sp37 push ax ; Reserve space for larger return value (adjusted in 32-bit code). 38 push eax 39 pushfd 40 40 %else 41 push xPRE [xSP] ; duplicate the return address 41 pushfq 42 mov [rsp + 4], eax 42 43 %endif 43 push sAX 44 45 %if TMPL_BITS == 16 46 ; Convert the 16-bit near return into a 32-bit far return 47 movzx eax, word [bp + 8] 48 add eax, BS3_ADDR_BS3TEXT16 49 mov [bp + 2], eax 50 %endif 44 cli 51 45 52 46 ; Calc ring addend. 53 47 mov ax, cs 54 and ax, 3 55 shl ax, BS3_SEL_RING_SHIFT 48 and xAX, 3 49 shl xAX, BS3_SEL_RING_SHIFT 50 add xAX, BS3_SEL_R0_CS32 56 51 57 ; Set return segment.58 add ax, BS3_SEL_R0_CS3252 ; Create far return for switching to 32-bit mode. 53 push sAX 59 54 %if TMPL_BITS == 16 60 mov [bp + 6], eax 55 push dword .thirty_two_bit wrt FLAT 56 o32 retf 61 57 %else 62 mov [xSP + xCB*2], eax 58 push .thirty_two_bit 59 o64 retf 63 60 %endif 64 61 62 BS3_SET_BITS 32 63 .thirty_two_bit: 65 64 ; Load 32-bit segment registers. 66 add ax, BS3_SEL_R0_SS32 - BS3_SEL_R0_CS3265 add eax, BS3_SEL_R0_SS32 - BS3_SEL_R0_CS32 67 66 mov ss, ax 68 67 69 add ax, BS3_SEL_R0_DS32 - BS3_SEL_R0_SS3268 add eax, BS3_SEL_R0_DS32 - BS3_SEL_R0_SS32 70 69 mov ds, ax 71 70 mov es, ax 72 71 72 %if TMPL_BITS == 16 73 ; Adjust the return address. 74 movsx eax, word [esp + 4*2 + 2] 75 add eax, BS3_ADDR_BS3TEXT16 76 mov [esp + 4*2], eax 77 %endif 78 73 79 ; Restore and return. 74 pop sAX 75 %if TMPL_BITS == 16 76 leave 77 o32 retf 78 %else 79 retf 80 %endif 80 popfd 81 pop eax 82 ret 81 83 %endif 82 84 BS3_PROC_END_CMN Bs3SwitchTo32Bit -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo64Bit.asm
r58812 r59215 37 37 %else 38 38 %if TMPL_BITS == 16 39 sub sp, 6 40 push bp 41 mov bp, sp 39 sub sp, 6 ; Space for extended return value (corrected in 64-bit mode). 42 40 %else 43 push xPRE [xSP] ; duplicate the return address 41 push xPRE [xSP] ; Duplicate the return address. 42 and dword [xSP + xCB], 0 ; Clear the high dword or it. 44 43 %endif 44 push dword 0 45 45 push sAX 46 47 %if TMPL_BITS == 16 48 ; Convert the 16-bit near return into a 32-bit far return 49 movzx eax, word [bp + 8] 50 add eax, BS3_ADDR_BS3TEXT16 51 mov [bp + 2], eax 52 %endif 46 push dword 0 47 pushfd 48 cli 53 49 54 50 ; Calc ring addend. 55 51 mov ax, cs 56 and ax, 3 57 shl ax, BS3_SEL_RING_SHIFT 52 and xAX, 3 53 shl xAX, BS3_SEL_RING_SHIFT 54 add xAX, BS3_SEL_R0_CS32 58 55 59 ; Set return segment. 60 add ax, BS3_SEL_R0_CS64 61 %if TMPL_BITS == 16 62 mov [bp + 6], eax 63 %else 64 mov [xSP + xCB*2], eax 65 %endif 56 ; setup far return. 57 push sAX 58 %if TMPL_BITS == 16 59 push dword .sixty_four_bit 60 o32 retf 61 %else 62 push .sixty_four_bit 63 retf 64 %endif 66 65 66 BS3_SET_BITS 64 67 .sixty_four_bit: 67 68 ; Load 64-bit segment registers (SS64==DS64). 68 add ax, BS3_SEL_R0_DS64 - BS3_SEL_R0_CS6469 add eax, BS3_SEL_R0_DS64 - BS3_SEL_R0_CS64 69 70 mov ss, ax 70 71 mov ds, ax 71 72 mov es, ax 72 73 73 ; Restore and return. 74 pop sAX 75 %if TMPL_BITS == 16 76 leave 77 o32 retf 78 %else 79 retf 74 %if TMPL_BITS == 16 75 movzx eax, word [rsp + 8*2+6] 76 add eax, BS3_ADDR_BS3TEXT16 77 mov [rsp + 8*2], rax 78 %endif 79 80 popf 81 pop rax 82 ret 80 83 %endif 81 %endif82 84 BS3_PROC_END_CMN Bs3SwitchTo64Bit 83 85 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchToRing1.asm
r58812 r59215 41 41 int BS3_TRAP_SYSCALL 42 42 43 .return 43 .return: 44 44 pop sAX 45 45 ret -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-pe16.asm
r58814 r59215 49 49 EXTERN Bs3SwitchToRM_pe16 50 50 EXTERN Bs3SwitchToPE32_rm 51 EXTERN Bs3SwitchTo32Bit_c16 52 EXTERN Bs3SwitchTo32Bit_c32 53 EXTERN Bs3SwitchTo16Bit_c16 54 EXTERN Bs3SwitchTo16Bit_c32 51 55 EXTERN Bs3SwitchToRM_pe32 52 56 EXTERN Bs3InitMemory_rm … … 62 66 call NAME(Bs3InitMemory_rm) ; Initialize the memory (must be done from real mode). 63 67 call NAME(Bs3SwitchToPE16_rm) 68 69 call NAME(Bs3SwitchTo32Bit_c16) 70 BS3_SET_BITS 32 71 call NAME(Bs3SwitchTo16Bit_c32) 72 BS3_SET_BITS 16 73 64 74 call NAME(Bs3SwitchToRM_pe16) 65 75 66 76 call NAME(Bs3SwitchToPE32_rm) 67 77 BS3_SET_BITS 32 68 .halt: hlt69 jmp .halt70 78 call NAME(Bs3SwitchToRM_pe32) 71 79 BS3_SET_BITS 16 80 call NAME(Bs3SwitchToPE16_rm) 72 81 73 82 … … 75 84 ; Call main, if it returns shutdown the system. 76 85 ; 86 .halt: hlt 87 jmp .halt 77 88 call NAME(Main_pe16) 78 89 call Bs3Shutdown -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToRM.asm
r58812 r59215 73 73 extern TODO_FIX_LM_MODE_RETURN 74 74 %endif 75 75 76 push eax 76 77 mov eax, cr0 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.mac
r58812 r59215 690 690 %define xPUSHF pushq 691 691 %define xPOPF popfq 692 %define xRETF o64 retf 692 693 %else 693 694 %ifdef TMPL_32BIT … … 707 708 %define xPUSHF pushfd 708 709 %define xPOPF popfd 710 %define xRETF retf 709 711 %else 710 712 %ifndef TMPL_16BIT … … 726 728 %define xPUSHF pushf 727 729 %define xPOPF popf 730 %define xRETF retf 728 731 %endif 729 732 %endif -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac
r59210 r59215 405 405 %endif 406 406 %endif 407 int3 ; handy and avoids overlapping labels. 407 408 %endmacro 408 409
Note:
See TracChangeset
for help on using the changeset viewer.

