1 | ; $Id: bs3-cmn-SelFar32ToFlat32NoClobber.asm 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - Bs3SelFar32ToFlat32NoClobber.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2020 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 |
|
---|
28 | ;*********************************************************************************************************************************
|
---|
29 | ;* Header Files *
|
---|
30 | ;*********************************************************************************************************************************
|
---|
31 | %include "bs3kit-template-header.mac"
|
---|
32 |
|
---|
33 |
|
---|
34 | ;*********************************************************************************************************************************
|
---|
35 | ;* External Symbols *
|
---|
36 | ;*********************************************************************************************************************************
|
---|
37 | BS3_EXTERN_CMN Bs3SelFar32ToFlat32
|
---|
38 | TMPL_BEGIN_TEXT
|
---|
39 |
|
---|
40 |
|
---|
41 | ;;
|
---|
42 | ; Wrapper around the Bs3SelFar32ToFlat32 C function that doesn't
|
---|
43 | ; clobber any registers nor require 20h stack scratch area (64-bit).
|
---|
44 | ;
|
---|
45 | ; @uses Only return registers (ax:dx, eax, eax)
|
---|
46 | ; @remarks No 20h scratch space required in 64-bit mode.
|
---|
47 | ;
|
---|
48 | BS3_PROC_BEGIN_CMN Bs3SelFar32ToFlat32NoClobber, BS3_PBC_NEAR ; Far stub generated by the makefile.
|
---|
49 | push xBP
|
---|
50 | mov xBP, xSP
|
---|
51 |
|
---|
52 | %if TMPL_BITS == 16
|
---|
53 | push bx
|
---|
54 | push cx
|
---|
55 | push es
|
---|
56 |
|
---|
57 | push word [xBP + xCB + cbCurRetAddr + 4] ; uSel
|
---|
58 | push word [xBP + xCB + cbCurRetAddr + 2] ; high off
|
---|
59 | push word [xBP + xCB + cbCurRetAddr] ; low off
|
---|
60 | call Bs3SelFar32ToFlat32
|
---|
61 | add sp, 6
|
---|
62 |
|
---|
63 | pop es
|
---|
64 | pop cx
|
---|
65 | pop bx
|
---|
66 | %else
|
---|
67 | push xDX
|
---|
68 | push xCX
|
---|
69 | %if TMPL_BITS == 32
|
---|
70 | push es
|
---|
71 | push fs
|
---|
72 | push gs
|
---|
73 |
|
---|
74 | push dword [xBP + xCB + cbCurRetAddr + 4] ; uSel
|
---|
75 | push dword [xBP + xCB + cbCurRetAddr] ; off
|
---|
76 | call Bs3SelFar32ToFlat32
|
---|
77 | add esp, 8
|
---|
78 |
|
---|
79 | pop gs
|
---|
80 | pop fs
|
---|
81 | pop es
|
---|
82 | %else
|
---|
83 | push r8
|
---|
84 | push r9
|
---|
85 | push r10
|
---|
86 | push r11
|
---|
87 | sub rsp, 20h
|
---|
88 |
|
---|
89 | call Bs3SelFar32ToFlat32 ; Just pass ECX and DX along as-is.
|
---|
90 |
|
---|
91 | add rsp, 20h
|
---|
92 | pop r11
|
---|
93 | pop r10
|
---|
94 | pop r9
|
---|
95 | pop r8
|
---|
96 | %endif
|
---|
97 | pop xCX
|
---|
98 | pop xDX
|
---|
99 | %endif
|
---|
100 |
|
---|
101 | pop xBP
|
---|
102 | BS3_HYBRID_RET
|
---|
103 | BS3_PROC_END_CMN Bs3SelFar32ToFlat32NoClobber
|
---|
104 |
|
---|