Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 1 | /* |
| 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 |
Paul Menzel | a46a712 | 2013-02-23 18:37:27 +0100 | [diff] [blame] | 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | /* calling syntax: docpuid(idx,eax,ebx,ecx,edx) */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 23 | |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 24 | .align 4 |
| 25 | .text |
| 26 | |
| 27 | .global docpuid |
| 28 | .type docpuid,@function |
| 29 | |
| 30 | docpuid: |
| 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 | |
| 44 | L1: movl 16(%ebp),%edi |
| 45 | test %edi,%edi |
| 46 | jz L2 |
| 47 | movl %ebx,(%edi) |
| 48 | |
| 49 | L2: movl 20(%ebp),%edi |
| 50 | test %edi,%edi |
| 51 | jz L3 |
| 52 | movl %ecx,(%edi) |
| 53 | |
| 54 | L3: movl 24(%ebp), %edi |
| 55 | test %edi,%edi |
| 56 | jz L4 |
| 57 | movl %edx,(%edi) |
| 58 | |
| 59 | L4: 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 |