VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/tstX86-FpuSaveRestoreA.asm@ 99725

Last change on this file since 99725 was 98103, checked in by vboxsync, 2 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.0 KB
Line 
1; $Id: tstX86-FpuSaveRestoreA.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; tstX86-FpuSaveRestore - Experimenting with saving and restoring FPU, assembly bits.
4;
5
6;
7; Copyright (C) 2013-2023 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; SPDX-License-Identifier: GPL-3.0-only
26;
27
28
29
30;*******************************************************************************
31;* Header Files *
32;*******************************************************************************
33%include "iprt/asmdefs.mac"
34%include "iprt/x86.mac"
35
36
37;*******************************************************************************
38;* Global Variables *
39;*******************************************************************************
40BEGINCODE
41g_r80_Zero: dt 0.0
42g_r80_One: dt 1.0
43
44
45BEGINCODE
46
47;; Prepares a FPU exception.
48BEGINPROC MyFpuPrepXcpt
49 fld tword [g_r80_One xWrtRIP]
50 fld tword [g_r80_Zero xWrtRIP]
51 fdiv st0
52 ret
53ENDPROC MyFpuPrepXcpt
54
55
56;; Same as above, just different address.
57BEGINPROC MyFpuPrepXcpt2
58 fld tword [g_r80_One xWrtRIP]
59 fld tword [g_r80_Zero xWrtRIP]
60 fdiv st0
61 ret
62ENDPROC MyFpuPrepXcpt2
63
64
65BEGINPROC MyFpuSave
66%ifdef ASM_CALL64_MSC
67 o64 fxsave [rcx]
68%elifdef ASM_CALL64_GCC
69 o64 fxsave [rdi]
70%elifdef RT_ARCH_X86
71 mov ecx, [esp + 4]
72 fxsave [ecx]
73%else
74 %error "Unsupported architecture."
75 bad arch
76%endif
77 ret
78ENDPROC MyFpuSave
79
80
81BEGINPROC MyFpuStoreEnv
82%ifdef ASM_CALL64_MSC
83 fstenv [rcx]
84%elifdef ASM_CALL64_GCC
85 fstenv [rdi]
86%elifdef RT_ARCH_X86
87 mov ecx, [esp + 4]
88 fstenv [ecx]
89%else
90 %error "Unsupported architecture."
91 bad arch
92%endif
93 ret
94ENDPROC MyFpuStoreEnv
95
96
97BEGINPROC MyFpuRestore
98%ifdef ASM_CALL64_MSC
99 o64 fxrstor [rcx]
100%elifdef ASM_CALL64_GCC
101 o64 fxrstor [rdi]
102%elifdef RT_ARCH_X86
103 mov ecx, [esp + 4]
104 fxrstor [ecx]
105%else
106 %error "Unsupported architecture."
107 bad arch
108%endif
109 ret
110ENDPROC MyFpuRestore
111
112
113BEGINPROC MyFpuLoadEnv
114%ifdef ASM_CALL64_MSC
115 fldenv [rcx]
116%elifdef ASM_CALL64_GCC
117 fldenv [rdi]
118%elifdef RT_ARCH_X86
119 mov ecx, [esp + 4]
120 fldenv [ecx]
121%else
122 %error "Unsupported architecture."
123 bad arch
124%endif
125 ret
126ENDPROC MyFpuLoadEnv
127
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