Apply %restore_fcommon macro for Address Sanitizer
[platform/upstream/nettle.git] / x86_64 / fat / cpuid.asm
1 C x86_64/fat/cpuid.asm
2
3 ifelse(<
4    Copyright (C) 2015 Niels Möller
5
6    This file is part of GNU Nettle.
7
8    GNU Nettle is free software: you can redistribute it and/or
9    modify it under the terms of either:
10
11      * the GNU Lesser General Public License as published by the Free
12        Software Foundation; either version 3 of the License, or (at your
13        option) any later version.
14
15    or
16
17      * the GNU General Public License as published by the Free
18        Software Foundation; either version 2 of the License, or (at your
19        option) any later version.
20
21    or both in parallel, as here.
22
23    GNU Nettle is distributed in the hope that it will be useful,
24    but WITHOUT ANY WARRANTY; without even the implied warranty of
25    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26    General Public License for more details.
27
28    You should have received copies of the GNU General Public License and
29    the GNU Lesser General Public License along with this program.  If
30    not, see http://www.gnu.org/licenses/.
31 >)
32
33 C Input argument
34 C cpuid input: %edi
35 C output pointer: %rsi  
36
37         .file "cpuid.asm"
38
39         C void _nettle_cpuid(uint32_t in, uint32_t *out)
40
41         .text
42         ALIGN(16)
43 PROLOGUE(_nettle_cpuid)
44         W64_ENTRY(2)
45         push    %rbx
46         
47         movl    %edi, %eax
48         cpuid
49         mov     %eax, (%rsi)
50         mov     %ebx, 4(%rsi)
51         mov     %ecx, 8(%rsi)
52         mov     %edx, 12(%rsi)
53
54         pop     %rbx
55         W64_EXIT(2)
56         ret
57 EPILOGUE(_nettle_cpuid)
58