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