1 | ; $Id: bs3-mode-PagingGetRootForPAE32.asm 76553 2019-01-01 01:45:53Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3PagingGetRootForPAE32
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2019 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 | %ifdef TMPL_RM
|
---|
31 | extern TMPL_NM(Bs3SwitchToPE16)
|
---|
32 | extern NAME(Bs3SwitchToRM_pe16)
|
---|
33 | %elifdef TMPL_CMN_V86
|
---|
34 | extern TMPL_NM(Bs3SwitchToRing0)
|
---|
35 | extern TMPL_NM(Bs3SwitchTo16BitV86)
|
---|
36 | %endif
|
---|
37 |
|
---|
38 | BS3_EXTERN_CMN Bs3PagingInitRootForPAE
|
---|
39 |
|
---|
40 | BS3_EXTERN_DATA16 g_PhysPagingRootPAE
|
---|
41 | TMPL_BEGIN_TEXT
|
---|
42 |
|
---|
43 |
|
---|
44 | ;;
|
---|
45 | ; @cproto BS3_DECL(uint32_t) Bs3PagingGetRootForPAE32(void)
|
---|
46 | ;
|
---|
47 | ; @returns eax
|
---|
48 | ;
|
---|
49 | ; @uses ax
|
---|
50 | ;
|
---|
51 | ; @remarks returns value in EAX, not dx:ax!
|
---|
52 | ;
|
---|
53 | BS3_PROC_BEGIN_MODE Bs3PagingGetRootForPAE32, BS3_PBC_NEAR ; Internal function, no far variant necessary.
|
---|
54 | mov eax, [BS3_DATA16_WRT(g_PhysPagingRootPAE)]
|
---|
55 | cmp eax, 0ffffffffh
|
---|
56 | je .init_root
|
---|
57 | ret
|
---|
58 |
|
---|
59 | .init_root:
|
---|
60 | push xBP
|
---|
61 | mov xBP, xSP
|
---|
62 | BONLY16 push es
|
---|
63 | push sDX
|
---|
64 | push sCX
|
---|
65 | push sBX
|
---|
66 | %if TMPL_BITS == 64
|
---|
67 | push r8
|
---|
68 | push r9
|
---|
69 | push r10
|
---|
70 | push r11
|
---|
71 | %endif
|
---|
72 |
|
---|
73 | %ifdef TMPL_RM
|
---|
74 | ;
|
---|
75 | ; We don't want to be restricted to real mode addressing, so
|
---|
76 | ; temporarily switch to 16-bit protected mode.
|
---|
77 | ;
|
---|
78 | call TMPL_NM(Bs3SwitchToPE16)
|
---|
79 | call Bs3PagingInitRootForPAE
|
---|
80 | call NAME(Bs3SwitchToRM_pe16)
|
---|
81 |
|
---|
82 | %elifdef TMPL_CMN_V86
|
---|
83 | ;
|
---|
84 | ; V8086 mode uses real mode addressing too. Unlikly that we'll
|
---|
85 | ; ever end up here though.
|
---|
86 | ;
|
---|
87 | call TMPL_NM(Bs3SwitchToRing0)
|
---|
88 | call Bs3PagingInitRootForPAE
|
---|
89 | call TMPL_NM(Bs3SwitchTo16BitV86)
|
---|
90 | %else
|
---|
91 | ;
|
---|
92 | ; Not a problematic addressing mode.
|
---|
93 | ;
|
---|
94 | BONLY64 sub rsp, 20h
|
---|
95 | BS3_CALL Bs3PagingInitRootForPAE, 0
|
---|
96 | BONLY64 add rsp, 20h
|
---|
97 | %endif
|
---|
98 |
|
---|
99 | ;
|
---|
100 | ; Load the value and return.
|
---|
101 | ;
|
---|
102 | mov eax, [BS3_DATA16_WRT(g_PhysPagingRootPAE)]
|
---|
103 |
|
---|
104 | %if TMPL_BITS == 64
|
---|
105 | pop r11
|
---|
106 | pop r10
|
---|
107 | pop r9
|
---|
108 | pop r8
|
---|
109 | %endif
|
---|
110 | pop sBX
|
---|
111 | pop sCX
|
---|
112 | pop sDX
|
---|
113 | BONLY16 pop es
|
---|
114 | leave
|
---|
115 | ret
|
---|
116 | BS3_PROC_END_MODE Bs3PagingGetRootForPAE32
|
---|
117 |
|
---|