1 ;*****************************************************************************
2 ;* checkasm-a.asm: assembly check tool
3 ;*****************************************************************************
4 ;* Copyright (C) 2008-2011 x264 project
6 ;* Authors: Loren Merritt <lorenm@u.washington.edu>
8 ;* This program is free software; you can redistribute it and/or modify
9 ;* it under the terms of the GNU General Public License as published by
10 ;* the Free Software Foundation; either version 2 of the License, or
11 ;* (at your option) any later version.
13 ;* This program is distributed in the hope that it will be useful,
14 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;* GNU General Public License for more details.
18 ;* You should have received a copy of the GNU General Public License
19 ;* along with this program; if not, write to the Free Software
20 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
22 ;* This program is also available under a commercial proprietary license.
23 ;* For more information, contact us at licensing@x264.com.
24 ;*****************************************************************************
30 error_message: db "failed to preserve register", 0
33 ; just random numbers to reduce the chance of incidental match
35 x6: ddq 0x79445c159ce790641a1b2550a612b48c
36 x7: ddq 0x86b2536fcd8cf6362eed899d5a28ddcd
37 x8: ddq 0x3f2bf84fc0fcca4eb0856806085e7943
38 x9: ddq 0xd229e1f5b281303facbd382dcf5b8de2
39 x10: ddq 0xab63e2e11fa38ed971aeaff20b095fd9
40 x11: ddq 0x77d410d5c42c882d89b0c0765892729a
41 x12: ddq 0x24b3c1d2a024048bc45ea11a955d8dd5
42 x13: ddq 0xdd7b8919edd427862e8ec680de14b47c
43 x14: ddq 0x11e53e2b2ac655ef135ce6888fa02cbf
44 x15: ddq 0x6de8f4c914c334d5011ff554472a7a10
45 n7: dq 0x21f86d66c8ca00ce
46 n8: dq 0x75b6ba21077c48ad
47 n9: dq 0xed56bb2dcb3c7736
48 n10: dq 0x8bda43d3fd1a7e06
49 n11: dq 0xb64a9c9e5d318408
50 n12: dq 0xdf9a54b303f1d3a3
51 n13: dq 0x4a75479abd64e097
52 n14: dq 0x249214109d5d1c88
59 ; max number of args used by any x264 asm function.
60 ; (max_args % 4) must equal 3 for stack alignment
65 ;-----------------------------------------------------------------------------
66 ; intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... )
67 ;-----------------------------------------------------------------------------
69 cglobal checkasm_call, 4,15,16
72 mov [rsp+stack_offset+16], r1
75 mov r2d, r4m ; FIXME truncates pointer
76 mov r3d, r5m ; FIXME truncates pointer
79 mov r4, [rsp+stack_offset+8+(i+2)*8]
102 pxor m %+ i, [x %+ i]
111 lea r0, [error_message]
113 mov r1, [rsp+stack_offset+16]
120 %elifndef ARCH_X86_64
122 ; just random numbers to reduce the chance of incidental match
123 %define n3 dword 0x6549315c
124 %define n4 dword 0xe02f3e23
125 %define n5 dword 0xb78d0d1d
126 %define n6 dword 0x33627ba7
128 ;-----------------------------------------------------------------------------
129 ; intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... )
130 ;-----------------------------------------------------------------------------
131 cglobal checkasm_call, 1,7
137 push dword [esp+24+max_args*4]
150 lea r1, [error_message]
162 ;-----------------------------------------------------------------------------
163 ; int x264_stack_pagealign( int (*func)(), int align )
164 ;-----------------------------------------------------------------------------
165 cglobal stack_pagealign, 2,2