1 | ; $Id: bs3-cmn-SelFar32ToFlat32NoClobber.asm 106061 2024-09-16 14:03:52Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3SelFar32ToFlat32NoClobber.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2024 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; The contents of this file may alternatively be used under the terms
|
---|
26 | ; of the Common Development and Distribution License Version 1.0
|
---|
27 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | ; CDDL are applicable instead of those of the GPL.
|
---|
30 | ;
|
---|
31 | ; You may elect to license modified versions of this file under the
|
---|
32 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | ;
|
---|
34 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | ;
|
---|
36 |
|
---|
37 |
|
---|
38 | ;*********************************************************************************************************************************
|
---|
39 | ;* Header Files *
|
---|
40 | ;*********************************************************************************************************************************
|
---|
41 | %include "bs3kit-template-header.mac"
|
---|
42 |
|
---|
43 |
|
---|
44 | ;*********************************************************************************************************************************
|
---|
45 | ;* External Symbols *
|
---|
46 | ;*********************************************************************************************************************************
|
---|
47 | BS3_EXTERN_CMN Bs3SelFar32ToFlat32
|
---|
48 | TMPL_BEGIN_TEXT
|
---|
49 |
|
---|
50 |
|
---|
51 | ;;
|
---|
52 | ; Wrapper around the Bs3SelFar32ToFlat32 C function that doesn't
|
---|
53 | ; clobber any registers nor require 20h stack scratch area (64-bit).
|
---|
54 | ;
|
---|
55 | ; @uses Only return registers (ax:dx, eax, eax)
|
---|
56 | ; @remarks No 20h scratch space required in 64-bit mode.
|
---|
57 | ;
|
---|
58 | BS3_PROC_BEGIN_CMN Bs3SelFar32ToFlat32NoClobber, BS3_PBC_NEAR ; Far stub generated by the makefile.
|
---|
59 | push xBP
|
---|
60 | mov xBP, xSP
|
---|
61 |
|
---|
62 | %if TMPL_BITS == 16
|
---|
63 | push bx
|
---|
64 | push cx
|
---|
65 | push es
|
---|
66 |
|
---|
67 | push word [xBP + xCB + cbCurRetAddr + 4] ; uSel
|
---|
68 | push word [xBP + xCB + cbCurRetAddr + 2] ; high off
|
---|
69 | push word [xBP + xCB + cbCurRetAddr] ; low off
|
---|
70 | call Bs3SelFar32ToFlat32
|
---|
71 | add sp, 6
|
---|
72 |
|
---|
73 | pop es
|
---|
74 | pop cx
|
---|
75 | pop bx
|
---|
76 | %else
|
---|
77 | push xDX
|
---|
78 | push xCX
|
---|
79 | %if TMPL_BITS == 32
|
---|
80 | push es
|
---|
81 | push fs
|
---|
82 | push gs
|
---|
83 |
|
---|
84 | push dword [xBP + xCB + cbCurRetAddr + 4] ; uSel
|
---|
85 | push dword [xBP + xCB + cbCurRetAddr] ; off
|
---|
86 | call Bs3SelFar32ToFlat32
|
---|
87 | add esp, 8
|
---|
88 |
|
---|
89 | pop gs
|
---|
90 | pop fs
|
---|
91 | pop es
|
---|
92 | %else
|
---|
93 | push r8
|
---|
94 | push r9
|
---|
95 | push r10
|
---|
96 | push r11
|
---|
97 | sub rsp, 20h
|
---|
98 |
|
---|
99 | call Bs3SelFar32ToFlat32 ; Just pass ECX and DX along as-is.
|
---|
100 |
|
---|
101 | add rsp, 20h
|
---|
102 | pop r11
|
---|
103 | pop r10
|
---|
104 | pop r9
|
---|
105 | pop r8
|
---|
106 | %endif
|
---|
107 | pop xCX
|
---|
108 | pop xDX
|
---|
109 | %endif
|
---|
110 |
|
---|
111 | pop xBP
|
---|
112 | BS3_HYBRID_RET
|
---|
113 | BS3_PROC_END_CMN Bs3SelFar32ToFlat32NoClobber
|
---|
114 |
|
---|