1 ;*****************************************************************************
3 ;*****************************************************************************
4 ;* Copyright (C) 2008 Loren Merritt <lorenm@u.washington.edu>
6 ;* This program is free software; you can redistribute it and/or modify
7 ;* it under the terms of the GNU General Public License as published by
8 ;* the Free Software Foundation; either version 2 of the License, or
9 ;* (at your option) any later version.
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.
16 ;* You should have received a copy of the GNU General Public License
17 ;* along with this program; if not, write to the Free Software
18 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
19 ;*****************************************************************************
25 error_message: db "failed to preserve register", 0
28 ; just random numbers to reduce the chance of incidental match
30 n4: dq 0xa77809bf11b239d1
31 n5: dq 0x2ba9bf3d2f05b389
32 x6: ddq 0x79445c159ce790641a1b2550a612b48c
33 x7: ddq 0x86b2536fcd8cf6362eed899d5a28ddcd
34 x8: ddq 0x3f2bf84fc0fcca4eb0856806085e7943
35 x9: ddq 0xd229e1f5b281303facbd382dcf5b8de2
36 x10: ddq 0xab63e2e11fa38ed971aeaff20b095fd9
37 x11: ddq 0x77d410d5c42c882d89b0c0765892729a
38 x12: ddq 0x24b3c1d2a024048bc45ea11a955d8dd5
39 x13: ddq 0xdd7b8919edd427862e8ec680de14b47c
40 x14: ddq 0x11e53e2b2ac655ef135ce6888fa02cbf
41 x15: ddq 0x6de8f4c914c334d5011ff554472a7a10
48 ; max number of args used by any x264 asm function.
49 ; (max_args % 4) must equal 3 for stack alignment
54 ;-----------------------------------------------------------------------------
55 ; intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... )
56 ;-----------------------------------------------------------------------------
57 cglobal x264_checkasm_call, 4,7,16
59 %assign stack_offset stack_offset+max_args*8
61 mov [rsp+stack_offset+16], r1
64 mov r2d, r4m ; FIXME truncates pointer
65 mov r3d, r5m ; FIXME truncates pointer
68 mov r4, [rsp+stack_offset+8+(i+2)*8]
74 movdqa xmm %+ i, [x %+ i GLOBAL]
86 pxor xmm %+ i, [x %+ i GLOBAL]
95 lea r0, [error_message GLOBAL]
97 mov r1, [rsp+stack_offset+16]
102 %assign stack_offset stack_offset-max_args*8
105 %elifndef ARCH_X86_64
107 ; just random numbers to reduce the chance of incidental match
108 %define n3 dword 0x6549315c
109 %define n4 dword 0xe02f3e23
110 %define n5 dword 0xb78d0d1d
111 %define n6 dword 0x33627ba7
113 ;-----------------------------------------------------------------------------
114 ; intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... )
115 ;-----------------------------------------------------------------------------
116 cglobal x264_checkasm_call, 1,7
122 push dword [esp+24+max_args*4]
135 lea r1, [error_message GLOBAL]
147 ;-----------------------------------------------------------------------------
148 ; int x264_stack_pagealign( int (*func)(), int align )
149 ;-----------------------------------------------------------------------------
150 cglobal x264_stack_pagealign, 2,2