VirtualBox

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

Last change on this file since 55438 was 55166, checked in by vboxsync, 10 years ago

VMM/testcase: close quotes, nit.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1; $Id: tstX86-FpuSaveRestoreA.asm 55166 2015-04-09 15:54:13Z vboxsync $
2;; @file
3; tstX86-FpuSaveRestore - Experimenting with saving and restoring FPU, assembly bits.
4;
5
6;
7; Copyright (C) 2013 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
18
19
20;*******************************************************************************
21;* Header Files *
22;*******************************************************************************
23%include "iprt/asmdefs.mac"
24%include "iprt/x86.mac"
25
26
27;*******************************************************************************
28;* Global Variables *
29;*******************************************************************************
30BEGINCODE
31g_r80_Zero: dt 0.0
32g_r80_One: dt 1.0
33
34
35BEGINCODE
36
37;; Prepares a FPU exception.
38BEGINPROC MyFpuPrepXcpt
39 fld tword [g_r80_One xWrtRIP]
40 fld tword [g_r80_Zero xWrtRIP]
41 fdiv st0
42 ret
43ENDPROC MyFpuPrepXcpt
44
45
46;; Same as above, just different address.
47BEGINPROC MyFpuPrepXcpt2
48 fld tword [g_r80_One xWrtRIP]
49 fld tword [g_r80_Zero xWrtRIP]
50 fdiv st0
51 ret
52ENDPROC MyFpuPrepXcpt2
53
54
55BEGINPROC MyFpuSave
56%ifdef ASM_CALL64_MSC
57 o64 fxsave [rcx]
58%elifdef ASM_CALL64_GCC
59 o64 fxsave [rdi]
60%elifdef RT_ARCH_X86
61 mov ecx, [esp + 4]
62 fxsave [ecx]
63%else
64 %error "Unsupported architecture."
65 bad arch
66%endif
67 ret
68ENDPROC MyFpuSave
69
70
71BEGINPROC MyFpuStoreEnv
72%ifdef ASM_CALL64_MSC
73 fstenv [rcx]
74%elifdef ASM_CALL64_GCC
75 fstenv [rdi]
76%elifdef RT_ARCH_X86
77 mov ecx, [esp + 4]
78 fstenv [ecx]
79%else
80 %error "Unsupported architecture."
81 bad arch
82%endif
83 ret
84ENDPROC MyFpuStoreEnv
85
86
87BEGINPROC MyFpuRestore
88%ifdef ASM_CALL64_MSC
89 o64 fxrstor [rcx]
90%elifdef ASM_CALL64_GCC
91 o64 fxrstor [rdi]
92%elifdef RT_ARCH_X86
93 mov ecx, [esp + 4]
94 fxrstor [ecx]
95%else
96 %error "Unsupported architecture."
97 bad arch
98%endif
99 ret
100ENDPROC MyFpuRestore
101
102
103BEGINPROC MyFpuLoadEnv
104%ifdef ASM_CALL64_MSC
105 fldenv [rcx]
106%elifdef ASM_CALL64_GCC
107 fldenv [rdi]
108%elifdef RT_ARCH_X86
109 mov ecx, [esp + 4]
110 fldenv [ecx]
111%else
112 %error "Unsupported architecture."
113 bad arch
114%endif
115 ret
116ENDPROC MyFpuLoadEnv
117
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