VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SwitchTo32Bit.asm@ 59865

最後變更 在這個檔案從59865是 59863,由 vboxsync 提交於 9 年 前

bs3kit: Updates.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.6 KB
 
1; $Id: bs3-cmn-SwitchTo32Bit.asm 59863 2016-02-26 20:59:52Z vboxsync $
2;; @file
3; BS3Kit - Bs3SwitchTo32Bit
4;
5
6;
7; Copyright (C) 2007-2015 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.alldomusa.eu.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "bs3kit-template-header.mac"
28
29
30%if TMPL_BITS != 32
31BS3_EXTERN_DATA16 g_bBs3CurrentMode
32TMPL_BEGIN_TEXT
33%endif
34
35
36;;
37; @cproto BS3_DECL(void) Bs3SwitchTo32Bit(void);
38;
39; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
40;
41BS3_PROC_BEGIN_CMN Bs3SwitchTo32Bit
42%if TMPL_BITS == 32
43 ret
44%else
45 %if TMPL_BITS == 16
46 push ax ; Reserve space for larger return value (adjusted in 32-bit code).
47 push eax
48 pushfd
49 %else
50 pushfq
51 mov [rsp + 4], eax
52 %endif
53 cli
54
55 ; Calc ring addend.
56 mov ax, cs
57 and xAX, 3
58 shl xAX, BS3_SEL_RING_SHIFT
59 add xAX, BS3_SEL_R0_CS32
60
61 ; Create far return for switching to 32-bit mode.
62 push sAX
63 %if TMPL_BITS == 16
64 push dword .thirty_two_bit wrt FLAT
65 o32 retf
66 %else
67 push .thirty_two_bit
68 o64 retf
69 %endif
70
71BS3_SET_BITS 32
72.thirty_two_bit:
73 ; Load 32-bit segment registers.
74 add eax, BS3_SEL_R0_SS32 - BS3_SEL_R0_CS32
75 mov ss, ax
76
77 add eax, BS3_SEL_R0_DS32 - BS3_SEL_R0_SS32
78 mov ds, ax
79 mov es, ax
80
81 ; Update globals.
82 and byte [g_bBs3CurrentMode], ~BS3_MODE_CODE_MASK
83 or byte [g_bBs3CurrentMode], BS3_MODE_CODE_32
84
85 %if TMPL_BITS == 16
86 ; Adjust the return address.
87 movsx eax, word [esp + 4*2 + 2]
88 add eax, BS3_ADDR_BS3TEXT16
89 mov [esp + 4*2], eax
90 %endif
91
92 ; Restore and return.
93 popfd
94 pop eax
95 ret
96%endif
97BS3_PROC_END_CMN Bs3SwitchTo32Bit
98
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette