VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/utils/cpu/xmmsaving-asm.asm@ 77994

Last change on this file since 77994 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1; $Id: xmmsaving-asm.asm 76553 2019-01-01 01:45:53Z vboxsync $
2;; @file
3; xmmsaving - assembly helpers.
4;
5
6;
7; Copyright (C) 2009-2019 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%include "iprt/asmdefs.mac"
29%include "VBox/vmm/stam.mac"
30
31
32BEGINCODE
33
34
35;;
36; DECLASM(int) XmmSavingTestLoadSet(const MYXMMREGSET *pSet, const MYXMMREGSET *pPrevSet, PRTUINT128U pBadVal);
37;
38; @returns 0 on success, 1-based register number on failure.
39; @param pSet The new set.
40; @param pPrevSet The previous set. Can be NULL.
41; @param pBadVal Where to store the actual register value on failure.
42;
43BEGINPROC XmmSavingTestLoadSet
44 push xBP
45 mov xBP, xSP
46 sub xSP, 32 ; Space for storing an XMM register (in TEST_REG).
47 and xSP, ~31 ; Align it.
48
49 ; Unify register/arguments.
50%ifdef ASM_CALL64_GCC
51 mov r8, rdx ; pBadVal
52 mov xCX, rdi ; pSet
53 mov xDX, rsi ; pPrevSet
54%endif
55%ifdef RT_ARCH_X86
56 mov xCX, [ebp + 8] ; pSet
57 mov xDX, [ebp + 12] ; pPrevSet
58%endif
59
60 test xDX, xDX
61 jz near .just_load
62
63 ; Check that the old set is still correct.
64%macro TEST_REG 1,
65 movdqa [xSP], xmm %+ %1
66 mov xAX, [xDX + %1 * 8]
67 cmp [xSP], xAX
68 jne %%bad
69 mov xAX, [xDX + %1 * 8 + xCB]
70 cmp [xSP + xCB], xAX
71%ifdef RT_ARCH_X86
72 jne %%bad
73 mov xAX, [xDX + %1 * 8 + xCB*2]
74 cmp [xSP + xCB*2], xAX
75 jne %%bad
76 mov xAX, [xDX + %1 * 8 + xCB*3]
77 cmp [xSP + xCB*3], xAX
78%endif
79 je %%next
80%%bad:
81 mov eax, %1 + 1
82 jmp .return_copy_badval
83%%next:
84%endmacro
85
86 TEST_REG 0
87 TEST_REG 1
88 TEST_REG 2
89 TEST_REG 3
90 TEST_REG 4
91 TEST_REG 5
92 TEST_REG 6
93 TEST_REG 7
94%ifdef RT_ARCH_AMD64
95 TEST_REG 8
96 TEST_REG 9
97 TEST_REG 10
98 TEST_REG 11
99 TEST_REG 12
100 TEST_REG 13
101 TEST_REG 14
102 TEST_REG 15
103%endif
104
105 ; Load the new state.
106.just_load:
107 movdqu xmm0, [xCX + 0*8]
108 movdqu xmm1, [xCX + 1*8]
109 movdqu xmm2, [xCX + 2*8]
110 movdqu xmm3, [xCX + 3*8]
111 movdqu xmm4, [xCX + 4*8]
112 movdqu xmm5, [xCX + 5*8]
113 movdqu xmm6, [xCX + 6*8]
114 movdqu xmm7, [xCX + 7*8]
115%ifdef RT_ARCH_AMD64
116 movdqu xmm8, [xCX + 8*8]
117 movdqu xmm9, [xCX + 9*8]
118 movdqu xmm10, [xCX + 10*8]
119 movdqu xmm11, [xCX + 11*8]
120 movdqu xmm12, [xCX + 12*8]
121 movdqu xmm13, [xCX + 13*8]
122 movdqu xmm14, [xCX + 14*8]
123 movdqu xmm15, [xCX + 15*8]
124%endif
125 xor eax, eax
126 jmp .return
127
128.return_copy_badval:
129 ; don't touch eax here.
130%ifdef RT_ARCH_X86
131 mov edx, [ebp + 16]
132 mov ecx, [esp]
133 mov [edx ], ecx
134 mov ecx, [esp + 4]
135 mov [edx + 4], ecx
136 mov ecx, [esp + 8]
137 mov [edx + 8], ecx
138 mov ecx, [esp + 12]
139 mov [edx + 12], ecx
140%else
141 mov rdx, [rsp]
142 mov rcx, [rsp + 8]
143 mov [r8], rdx
144 mov [r8 + 8], rcx
145%endif
146 jmp .return
147
148.return:
149 leave
150 ret
151ENDPROC XmmSavingTestLoadSet
152
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