]> git.sesse.net Git - x264/blob - common/x86/cpu-32.asm
Update file headers throughout x264
[x264] / common / x86 / cpu-32.asm
1 ;*****************************************************************************
2 ;* cpu-32.asm: h264 encoder library
3 ;*****************************************************************************
4 ;* Copyright (C) 2003-2008 x264 project
5 ;*
6 ;* Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 ;*          Loren Merritt <lorenm@u.washington.edu>
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., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
22 ;*****************************************************************************
23
24 %include "x86inc.asm"
25
26 SECTION .text
27
28 ;-----------------------------------------------------------------------------
29 ; int x264_cpu_cpuid_test( void )
30 ; return 0 if unsupported
31 ;-----------------------------------------------------------------------------
32 cglobal x264_cpu_cpuid_test
33     pushfd
34     push    ebx
35     push    ebp
36     push    esi
37     push    edi
38     pushfd
39     pop     eax
40     mov     ebx, eax
41     xor     eax, 0x200000
42     push    eax
43     popfd
44     pushfd
45     pop     eax
46     xor     eax, ebx
47     pop     edi
48     pop     esi
49     pop     ebp
50     pop     ebx
51     popfd
52     ret
53
54 ;-----------------------------------------------------------------------------
55 ; int x264_cpu_cpuid( int op, int *eax, int *ebx, int *ecx, int *edx )
56 ;-----------------------------------------------------------------------------
57 cglobal x264_cpu_cpuid, 0,6
58     mov     eax,    r0m
59     cpuid
60     mov     esi,    r1m
61     mov     [esi],  eax
62     mov     esi,    r2m
63     mov     [esi],  ebx
64     mov     esi,    r3m
65     mov     [esi],  ecx
66     mov     esi,    r4m
67     mov     [esi],  edx
68     RET
69
70 ;-----------------------------------------------------------------------------
71 ; void x264_emms( void )
72 ;-----------------------------------------------------------------------------
73 cglobal x264_emms
74     emms
75     ret
76
77 ;-----------------------------------------------------------------------------
78 ; void x264_stack_align( void (*func)(void*), void *arg );
79 ;-----------------------------------------------------------------------------
80 cglobal x264_stack_align
81     push ebp
82     mov  ebp, esp
83     sub  esp, 4
84     and  esp, ~15
85     mov  ecx, [ebp+8]
86     mov  edx, [ebp+12]
87     mov  [esp], edx
88     call ecx
89     leave
90     ret
91