]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/intel-ipsec-mb/include/clear_regs_mem_fns.asm
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / intel-ipsec-mb / include / clear_regs_mem_fns.asm
CommitLineData
f67539c2
TL
1;;
2;; Copyright (c) 2019, Intel Corporation
3;;
4;; Redistribution and use in source and binary forms, with or without
5;; modification, are permitted provided that the following conditions are met:
6;;
7;; * Redistributions of source code must retain the above copyright notice,
8;; this list of conditions and the following disclaimer.
9;; * Redistributions in binary form must reproduce the above copyright
10;; notice, this list of conditions and the following disclaimer in the
11;; documentation and/or other materials provided with the distribution.
12;; * Neither the name of Intel Corporation nor the names of its contributors
13;; may be used to endorse or promote products derived from this software
14;; without specific prior written permission.
15;;
16;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
20;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26;;
27
28%include "include/os.asm"
29%include "include/clear_regs.asm"
30
31section .text
32;
33; This function clears all scratch GP registers
34;
35; void clear_scratch_gps(void)
36MKGLOBAL(clear_scratch_gps,function,internal)
37clear_scratch_gps:
38
39 clear_scratch_gps_asm
40
41 ret
42
43;
44; This function clears all scratch XMM registers
45;
46; void clear_scratch_xmms_sse(void)
47MKGLOBAL(clear_scratch_xmms_sse,function,internal)
48clear_scratch_xmms_sse:
49
50 clear_scratch_xmms_sse_asm
51
52 ret
53
54;
55; This function clears all scratch XMM registers
56;
57; It should be called before restoring the XMM registers
58; for Windows (XMM6-XMM15)
59;
60; void clear_scratch_xmms_avx(void)
61MKGLOBAL(clear_scratch_xmms_avx,function,internal)
62clear_scratch_xmms_avx:
63
64 clear_scratch_xmms_avx_asm
65
66 ret
67
68;
69; This function clears all scratch YMM registers
70;
71; It should be called before restoring the XMM registers
72; for Windows (XMM6-XMM15)
73;
74; void clear_scratch_ymms(void)
75MKGLOBAL(clear_scratch_ymms,function,internal)
76clear_scratch_ymms:
77
78 clear_scratch_ymms_asm
79
80 ret
81
82;
83; This function clears all scratch ZMM registers
84;
85; It should be called before restoring the XMM registers
86; for Windows (XMM6-XMM15). YMM registers are used
87; on purpose, since XOR'ing YMM registers is faster
88; than XOR'ing ZMM registers, and the operation clears
89; also the upper 256 bits
90;
91; void clear_scratch_zmms(void)
92MKGLOBAL(clear_scratch_zmms,function,internal)
93clear_scratch_zmms:
94
95 clear_scratch_zmms_asm
96
97 ret
98
99;
100; This function clears all memory passed
101;
102; void force_memset_zero(void *mem, const size_t size)
103MKGLOBAL(force_memset_zero,function,internal)
104force_memset_zero:
105
106%ifdef LINUX
107 mov rcx, rsi
108%else
109 push rdi
110 mov rdi, rcx
111 mov rcx, rdx
112%endif
113 xor eax, eax
114 cld
115 rep stosb
116
117%ifndef LINUX
118 pop rdi
119%endif
120 ret
121
122%ifdef LINUX
123section .note.GNU-stack noalloc noexec nowrite progbits
124%endif