thughes | 4ee6496 | 2004-06-16 20:51:45 +0000 | [diff] [blame] | 1 | |
| 2 | ##--------------------------------------------------------------------## |
nethercote | 986202f | 2004-10-19 13:48:06 +0000 | [diff] [blame] | 3 | ##--- Support for determining CPU characteristics. x86/cpuid.S ---## |
thughes | 4ee6496 | 2004-06-16 20:51:45 +0000 | [diff] [blame] | 4 | ##--------------------------------------------------------------------## |
| 5 | |
| 6 | /* |
njn | b9c427c | 2004-12-01 14:14:42 +0000 | [diff] [blame] | 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
thughes | 4ee6496 | 2004-06-16 20:51:45 +0000 | [diff] [blame] | 9 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame^] | 10 | Copyright (C) 2000-2005 Julian Seward |
thughes | 4ee6496 | 2004-06-16 20:51:45 +0000 | [diff] [blame] | 11 | jseward@acm.org |
| 12 | |
| 13 | This program is free software; you can redistribute it and/or |
| 14 | modify it under the terms of the GNU General Public License as |
| 15 | published by the Free Software Foundation; either version 2 of the |
| 16 | License, or (at your option) any later version. |
| 17 | |
| 18 | This program is distributed in the hope that it will be useful, but |
| 19 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | General Public License for more details. |
| 22 | |
| 23 | You should have received a copy of the GNU General Public License |
| 24 | along with this program; if not, write to the Free Software |
| 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 26 | 02111-1307, USA. |
| 27 | |
| 28 | The GNU General Public License is contained in the file COPYING. |
| 29 | */ |
| 30 | |
sewardj | 8b635a4 | 2004-11-22 19:01:47 +0000 | [diff] [blame] | 31 | #if 0 |
| 32 | |
nethercote | 5a2664c | 2004-09-02 15:37:39 +0000 | [diff] [blame] | 33 | #include "core_asm.h" |
thughes | 4ee6496 | 2004-06-16 20:51:45 +0000 | [diff] [blame] | 34 | |
| 35 | /* |
| 36 | int VG_(cpuid)(UInt eax, |
| 37 | UInt *eax_ret, UInt *ebx_ret, UInt *ecx_ret, UInt *edx_ret) |
| 38 | */ |
| 39 | .globl VG_(cpuid) |
| 40 | VG_(cpuid): |
| 41 | pushl %ebp |
| 42 | movl %esp, %ebp |
| 43 | pushl %eax |
| 44 | pushl %ebx |
| 45 | pushl %ecx |
| 46 | pushl %edx |
| 47 | pushl %esi |
| 48 | movl 8(%ebp), %eax |
| 49 | cpuid |
| 50 | movl 12(%ebp), %esi |
| 51 | testl %esi, %esi |
| 52 | jz 1f |
| 53 | movl %eax, (%esi) |
| 54 | 1: |
| 55 | movl 16(%ebp), %esi |
| 56 | testl %esi, %esi |
| 57 | jz 2f |
| 58 | movl %ebx, (%esi) |
| 59 | 2: |
| 60 | movl 20(%ebp), %esi |
| 61 | testl %esi, %esi |
| 62 | jz 3f |
| 63 | movl %ecx, (%esi) |
| 64 | 3: |
| 65 | movl 24(%ebp), %esi |
| 66 | testl %esi, %esi |
| 67 | jz 4f |
| 68 | movl %edx, (%esi) |
| 69 | 4: |
| 70 | popl %esi |
| 71 | popl %edx |
| 72 | popl %ecx |
| 73 | popl %ebx |
| 74 | popl %eax |
| 75 | movl %ebp, %esp |
| 76 | popl %ebp |
| 77 | ret |
thughes | 4ad52d0 | 2004-06-27 17:37:21 +0000 | [diff] [blame] | 78 | |
| 79 | /* Let the linker know we don't need an executable stack */ |
| 80 | .section .note.GNU-stack,"",@progbits |
| 81 | |
sewardj | 8b635a4 | 2004-11-22 19:01:47 +0000 | [diff] [blame] | 82 | #endif /* 0 */ |
| 83 | |
thughes | 4ad52d0 | 2004-06-27 17:37:21 +0000 | [diff] [blame] | 84 | ##--------------------------------------------------------------------## |
nethercote | 986202f | 2004-10-19 13:48:06 +0000 | [diff] [blame] | 85 | ##--- end ---## |
thughes | 4ad52d0 | 2004-06-27 17:37:21 +0000 | [diff] [blame] | 86 | ##--------------------------------------------------------------------## |