]> git.sesse.net Git - x264/blob - common/i386/cpu-a.asm
cosmetics
[x264] / common / i386 / cpu-a.asm
1 ;*****************************************************************************
2 ;* cpu.asm: h264 encoder library
3 ;*****************************************************************************
4 ;* Copyright (C) 2003 x264 project
5 ;* $Id: cpu.asm,v 1.1 2004/06/03 19:27:07 fenrir Exp $
6 ;*
7 ;* Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 ;*
9 ;* This program is free software; you can redistribute it and/or modify
10 ;* it under the terms of the GNU General Public License as published by
11 ;* the Free Software Foundation; either version 2 of the License, or
12 ;* (at your option) any later version.
13 ;*
14 ;* This program is distributed in the hope that it will be useful,
15 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;* GNU General Public License for more details.
18 ;*
19 ;* You should have received a copy of the GNU General Public License
20 ;* along with this program; if not, write to the Free Software
21 ;* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22 ;*****************************************************************************
23
24 BITS 32
25
26 ;=============================================================================
27 ; Macros and other preprocessor constants
28 ;=============================================================================
29
30 %include "i386inc.asm"
31
32 ;=============================================================================
33 ; Code
34 ;=============================================================================
35
36 SECTION .text
37
38 cglobal x264_cpu_cpuid_test
39 cglobal x264_cpu_cpuid
40 cglobal x264_emms
41
42 ALIGN 16
43 ;-----------------------------------------------------------------------------
44 ;   int __cdecl x264_cpu_cpuid_test( void ) return 0 if unsupported
45 ;-----------------------------------------------------------------------------
46 x264_cpu_cpuid_test:
47     pushfd
48     push    ebx
49     push    ebp
50     push    esi
51     push    edi
52
53     pushfd
54     pop     eax
55     mov     ebx, eax
56     xor     eax, 0x200000
57     push    eax
58     popfd
59     pushfd
60     pop     eax
61     xor     eax, ebx
62     
63     pop     edi
64     pop     esi
65     pop     ebp
66     pop     ebx
67     popfd
68     ret
69
70 ALIGN 16
71 ;-----------------------------------------------------------------------------
72 ;   int __cdecl x264_cpu_cpuid( int op, int *eax, int *ebx, int *ecx, int *edx )
73 ;-----------------------------------------------------------------------------
74 x264_cpu_cpuid:
75
76     push    ebp
77     mov     ebp,    esp
78     push    ebx
79     push    esi
80     push    edi
81     
82     mov     eax,    [ebp +  8]
83     cpuid
84
85     mov     esi,    [ebp + 12]
86     mov     [esi],  eax
87
88     mov     esi,    [ebp + 16]
89     mov     [esi],  ebx
90
91     mov     esi,    [ebp + 20]
92     mov     [esi],  ecx
93
94     mov     esi,    [ebp + 24]
95     mov     [esi],  edx
96
97     pop     edi
98     pop     esi
99     pop     ebx
100     pop     ebp
101     ret
102
103 ALIGN 16
104 ;-----------------------------------------------------------------------------
105 ;   void __cdecl x264_emms( void )
106 ;-----------------------------------------------------------------------------
107 x264_emms:
108     emms
109     ret
110