VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-EnteredMode.asm@ 59242

Last change on this file since 59242 was 59242, checked in by vboxsync, 9 years ago

bs3kit: stack conversion fixes, switching to and from PP32 now works too.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1; $Id: bs3-mode-EnteredMode.asm 59242 2016-01-03 01:09:38Z vboxsync $
2;; @file
3; BS3Kit - Bs3EnteredMode
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.virtualbox.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;;
31; @cproto BS3_DECL(void) Bs3EnteredMode(void);
32;
33; @uses Nothing.
34;
35; @remarks ASSUMES we're in ring-0 when not in some kind of real mode.
36;
37BS3_PROC_BEGIN_MODE Bs3EnteredMode
38 push xBP
39 mov xBP, xSP
40 push xAX
41
42 ;
43 ; Load selectors, IDTs and stuff as appropriate.
44 ;
45%ifdef TMPL_CMN_R86
46BS3_BEGIN_DATA16
47TMPL_BEGIN_TEXT
48 xor ax, ax
49 mov ss, ax
50 mov ax, BS3DATA16
51 mov ds, ax
52 mov es, ax
53
54%elif TMPL_BITS == 16
55BS3_EXTERN_SYSTEM16 Bs3Lidt_Idt16
56BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss16
57BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss16DoubleFault
58TMPL_BEGIN_TEXT
59 jmp BS3_SEL_R0_CS16:.reloaded_cs
60.reloaded_cs:
61
62 mov ax, BS3_SEL_R0_SS16
63 mov ss, ax
64
65 mov ax, BS3_SEL_SYSTEM16
66 mov ds, ax
67 lidt [Bs3Lidt_Idt16]
68
69 mov ax, X86DESCGENERIC_BIT_OFF_TYPE + 1
70 btr [Bs3Gdte_Tss16DoubleFault], ax ; mark it not busy
71 btr [Bs3Gdte_Tss16], ax ; mark it not busy
72 mov ax, BS3_SEL_TSS16
73 ltr ax
74
75 mov ax, BS3_SEL_LDT
76 lldt ax
77
78 mov ax, BS3_SEL_R0_DS16
79 mov ds, ax
80 mov es, ax
81
82%elif TMPL_BITS == 32
83BS3_EXTERN_SYSTEM16 Bs3Lidt_Idt32
84BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss32
85BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss32DoubleFault
86TMPL_BEGIN_TEXT
87 mov ax, BS3_SEL_R0_SS32
88 mov ss, ax
89
90 mov ax, BS3_SEL_SYSTEM16
91 mov ds, ax
92 lidt [Bs3Lidt_Idt32]
93
94 mov ax, X86DESCGENERIC_BIT_OFF_TYPE + 1
95 btr [Bs3Gdte_Tss32DoubleFault], ax ; mark it not busy
96 btr [Bs3Gdte_Tss32], ax ; mark it not busy
97 mov ax, BS3_SEL_TSS32
98 ltr ax
99
100 mov ax, BS3_SEL_LDT
101 lldt ax
102
103 mov ax, BS3_SEL_R0_DS32
104 mov ds, ax
105 mov es, ax
106
107
108%elif TMPL_BITS == 64
109BS3_EXTERN_SYSTEM16 Bs3Lidt_Idt64
110BS3_EXTERN_SYSTEM16 Bs3Gdte_Tss64
111TMPL_BEGIN_TEXT
112 mov ax, BS3_SEL_R0_DS64
113 mov ss, ax
114
115 mov ax, BS3_SEL_SYSTEM16
116 mov ds, ax
117 lidt [Bs3Lidt_Idt64]
118
119 mov eax, X86DESCGENERIC_BIT_OFF_TYPE + 1
120 btr [Bs3Gdte_Tss64], eax ; mark it not busy
121 mov ax, BS3_SEL_TSS64
122 ltr ax
123
124 mov ax, BS3_SEL_LDT
125 lldt ax
126
127 mov ax, BS3_SEL_R0_DS64
128 mov ds, ax
129 mov es, ax
130
131%else
132 %error "TMPL_BITS"
133%endif
134
135 pop xAX
136 leave
137 ret
138BS3_PROC_END_MODE Bs3EnteredMode
139
Note: See TracBrowser for help on using the repository browser.

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