blob: 84cdc77874fda25d067303539ce5b1db007d1a4f [file] [log] [blame]
Jacob Garber07201d72020-09-08 12:25:44 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
3/* It is derived from the x86info project, which is GPLv2-licensed. */
Jordan Crouse7249f792008-03-20 00:11:05 +00004
5/* calling syntax: docpuid(idx,eax,ebx,ecx,edx) */
Stefan Reinauer14e22772010-04-27 06:56:47 +00006
Jordan Crouse7249f792008-03-20 00:11:05 +00007.align 4
8.text
9
10.global docpuid
11 .type docpuid,@function
12
13docpuid:
14 pushl %ebp
15 movl %esp, %ebp
16 pushl %edi
17 pushl %ebx
18 pushl %ecx
19 pushl %edx
20 movl 8(%ebp),%eax
21 cpuid
22 movl 12(%ebp),%edi
23 test %edi,%edi
24 jz L1
25 movl %eax, (%edi)
26
27L1: movl 16(%ebp),%edi
28 test %edi,%edi
29 jz L2
30 movl %ebx,(%edi)
31
32L2: movl 20(%ebp),%edi
33 test %edi,%edi
34 jz L3
35 movl %ecx,(%edi)
36
37L3: movl 24(%ebp), %edi
38 test %edi,%edi
39 jz L4
40 movl %edx,(%edi)
41
42L4: popl %edx
43 popl %ecx
44 popl %ebx
45 popl %edi
46 movl %ebp,%esp
47 popl %ebp
48 ret
49
50.section .note.GNU-stack,"", @progbits