blob: b0040520804d234ea82dcda8d5b808f2d9bed042 [file] [log] [blame]
Jordan Crouse7249f792008-03-20 00:11:05 +00001/*
Jordan Crouse7249f792008-03-20 00:11:05 +00002 *
3 * It is derived from the x86info project, which is GPLv2-licensed.
4 *
5 * Copyright (C) 2001-2007 Dave Jones <davej@codemonkey.org.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Jordan Crouse7249f792008-03-20 00:11:05 +000015 */
16
17/* calling syntax: docpuid(idx,eax,ebx,ecx,edx) */
Stefan Reinauer14e22772010-04-27 06:56:47 +000018
Jordan Crouse7249f792008-03-20 00:11:05 +000019.align 4
20.text
21
22.global docpuid
23 .type docpuid,@function
24
25docpuid:
26 pushl %ebp
27 movl %esp, %ebp
28 pushl %edi
29 pushl %ebx
30 pushl %ecx
31 pushl %edx
32 movl 8(%ebp),%eax
33 cpuid
34 movl 12(%ebp),%edi
35 test %edi,%edi
36 jz L1
37 movl %eax, (%edi)
38
39L1: movl 16(%ebp),%edi
40 test %edi,%edi
41 jz L2
42 movl %ebx,(%edi)
43
44L2: movl 20(%ebp),%edi
45 test %edi,%edi
46 jz L3
47 movl %ecx,(%edi)
48
49L3: movl 24(%ebp), %edi
50 test %edi,%edi
51 jz L4
52 movl %edx,(%edi)
53
54L4: popl %edx
55 popl %ecx
56 popl %ebx
57 popl %edi
58 movl %ebp,%esp
59 popl %ebp
60 ret
61
62.section .note.GNU-stack,"", @progbits