blob: 9b1d13448fe915f1269fd5089a6094facf86e873 [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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/* calling syntax: docpuid(idx,eax,ebx,ecx,edx) */
23
24.align 4
25.text
26
27.global docpuid
28 .type docpuid,@function
29
30docpuid:
31 pushl %ebp
32 movl %esp, %ebp
33 pushl %edi
34 pushl %ebx
35 pushl %ecx
36 pushl %edx
37 movl 8(%ebp),%eax
38 cpuid
39 movl 12(%ebp),%edi
40 test %edi,%edi
41 jz L1
42 movl %eax, (%edi)
43
44L1: movl 16(%ebp),%edi
45 test %edi,%edi
46 jz L2
47 movl %ebx,(%edi)
48
49L2: movl 20(%ebp),%edi
50 test %edi,%edi
51 jz L3
52 movl %ecx,(%edi)
53
54L3: movl 24(%ebp), %edi
55 test %edi,%edi
56 jz L4
57 movl %edx,(%edi)
58
59L4: popl %edx
60 popl %ecx
61 popl %ebx
62 popl %edi
63 movl %ebp,%esp
64 popl %ebp
65 ret
66
67.section .note.GNU-stack,"", @progbits