/[pcsx2_0.9.7]/trunk/common/include/x86emitter/internal.h
ViewVC logotype

Annotation of /trunk/common/include/x86emitter/internal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (hide annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 2567 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16     #pragma once
17    
18     #include "x86types.h"
19     #include "instructions.h"
20    
21    
22     namespace x86Emitter {
23    
24 william 62 #define OpWriteSSE( pre, op ) xOpWrite0F( pre, op, to, from )
25 william 31
26 william 62 extern void SimdPrefix( u8 prefix, u16 opcode );
27     extern void EmitSibMagic( uint regfield, const void* address );
28     extern void EmitSibMagic( uint regfield, const xIndirectVoid& info );
29     extern void EmitSibMagic( uint reg1, const xRegisterBase& reg2 );
30     extern void EmitSibMagic( const xRegisterBase& reg1, const xRegisterBase& reg2 );
31     extern void EmitSibMagic( const xRegisterBase& reg1, const void* src );
32     extern void EmitSibMagic( const xRegisterBase& reg1, const xIndirectVoid& sib );
33 william 31
34 william 62 extern void _xMovRtoR( const xRegisterInt& to, const xRegisterInt& from );
35 william 31
36 william 62 template< typename T > inline
37     void xWrite( T val )
38     {
39     *(T*)x86Ptr = val;
40     x86Ptr += sizeof(T);
41     }
42 william 31
43 william 62 template< typename T1, typename T2 > __emitinline
44     void xOpWrite( u8 prefix, u8 opcode, const T1& param1, const T2& param2 )
45     {
46     if( prefix != 0 )
47     xWrite16( (opcode<<8) | prefix );
48     else
49     xWrite8( opcode );
50 william 31
51 william 62 EmitSibMagic( param1, param2 );
52     }
53 william 31
54 william 62 template< typename T1, typename T2 > __emitinline
55     void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2 )
56     {
57     SimdPrefix( prefix, opcode );
58     EmitSibMagic( param1, param2 );
59     }
60 william 31
61 william 62 template< typename T1, typename T2 > __emitinline
62     void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2, u8 imm8 )
63     {
64     xOpWrite0F( prefix, opcode, param1, param2 );
65     xWrite8( imm8 );
66     }
67 william 31
68 william 62 template< typename T1, typename T2 > __emitinline
69     void xOpWrite0F( u16 opcode, const T1& param1, const T2& param2 ) { xOpWrite0F( 0, opcode, param1, param2 ); }
70 william 31
71 william 62 template< typename T1, typename T2 > __emitinline
72     void xOpWrite0F( u16 opcode, const T1& param1, const T2& param2, u8 imm8 ) { xOpWrite0F( 0, opcode, param1, param2, imm8 ); }
73    
74 william 31 }
75    

  ViewVC Help
Powered by ViewVC 1.1.22