Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 1 | /* |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 2 | * |
| 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 Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | /* calling syntax: docpuid(idx,eax,ebx,ecx,edx) */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 18 | |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 19 | .align 4 |
| 20 | .text |
| 21 | |
| 22 | .global docpuid |
| 23 | .type docpuid,@function |
| 24 | |
| 25 | docpuid: |
| 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 | |
| 39 | L1: movl 16(%ebp),%edi |
| 40 | test %edi,%edi |
| 41 | jz L2 |
| 42 | movl %ebx,(%edi) |
| 43 | |
| 44 | L2: movl 20(%ebp),%edi |
| 45 | test %edi,%edi |
| 46 | jz L3 |
| 47 | movl %ecx,(%edi) |
| 48 | |
| 49 | L3: movl 24(%ebp), %edi |
| 50 | test %edi,%edi |
| 51 | jz L4 |
| 52 | movl %edx,(%edi) |
| 53 | |
| 54 | L4: 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 |