VirtualBox

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

Last change on this file since 83017 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1; $Id: bs3-cmn-ExtCtxRestore.asm 82968 2020-02-04 10:35:17Z vboxsync $
2;; @file
3; BS3Kit - Bs3ExtCtxRestore.
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%include "bs3kit-template-header.mac"
28
29
30;;
31; Restores the extended CPU context (FPU, SSE, AVX, ++).
32;
33; @param pExtCtx
34;
35BS3_PROC_BEGIN_CMN Bs3ExtCtxRestore, BS3_PBC_NEAR
36 push xBP
37 mov xBP, xSP
38 push sAX
39 push sCX
40 push sDX
41 push xBX
42BONLY16 push es
43
44%if ARCH_BITS == 16
45 les bx, [xBP + xCB + cbCurRetAddr]
46 mov al, [es:bx + BS3EXTCTX.enmMethod]
47 cmp al, BS3EXTCTXMETHOD_XSAVE
48 je .do_16_xsave
49 cmp al, BS3EXTCTXMETHOD_FXSAVE
50 je .do_16_fxsave
51 cmp al, BS3EXTCTXMETHOD_ANCIENT
52 je .do_16_ancient
53 int3
54
55.do_16_ancient:
56 frstor [es:bx + BS3EXTCTX.Ctx]
57 jmp .return
58
59.do_16_fxsave:
60 fxrstor [es:bx + BS3EXTCTX.Ctx]
61 jmp .return
62
63.do_16_xsave:
64 xor ecx, ecx
65 mov eax, [es:bx + BS3EXTCTX.fXcr0Nominal]
66 mov edx, [es:bx + BS3EXTCTX.fXcr0Nominal + 4]
67 xsetbv
68
69 xrstor [es:bx + BS3EXTCTX.Ctx]
70
71 mov eax, [es:bx + BS3EXTCTX.fXcr0Saved]
72 mov edx, [es:bx + BS3EXTCTX.fXcr0Saved + 4]
73 xsetbv
74 ;jmp .return
75
76%else
77BONLY32 mov ebx, [xBP + xCB + cbCurRetAddr]
78BONLY64 mov rbx, rcx
79
80 mov al, [xBX + BS3EXTCTX.enmMethod]
81 cmp al, BS3EXTCTXMETHOD_XSAVE
82 je .do_xsave
83 cmp al, BS3EXTCTXMETHOD_FXSAVE
84 je .do_fxsave
85 cmp al, BS3EXTCTXMETHOD_ANCIENT
86 je .do_ancient
87 int3
88
89.do_ancient:
90 frstor [xBX + BS3EXTCTX.Ctx]
91 jmp .return
92
93.do_fxsave:
94BONLY32 fxrstor [xBX + BS3EXTCTX.Ctx]
95BONLY64 fxrstor64 [xBX + BS3EXTCTX.Ctx]
96 jmp .return
97
98.do_xsave:
99 xor ecx, ecx
100 mov eax, [xBX + BS3EXTCTX.fXcr0Nominal]
101 mov edx, [xBX + BS3EXTCTX.fXcr0Nominal + 4]
102 xsetbv
103
104BONLY32 xrstor [xBX + BS3EXTCTX.Ctx]
105BONLY64 xrstor64 [xBX + BS3EXTCTX.Ctx]
106
107 mov eax, [xBX + BS3EXTCTX.fXcr0Saved]
108 mov edx, [xBX + BS3EXTCTX.fXcr0Saved + 4]
109 xsetbv
110 ;jmp .return
111
112%endif
113
114.return:
115BONLY16 pop es
116 pop xBX
117 pop sDX
118 pop sCX
119 pop sAX
120 mov xSP, xBP
121 pop xBP
122 ret
123BS3_PROC_END_CMN Bs3ExtCtxRestore
124
Note: See TracBrowser for help on using the repository browser.

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