Debian Codegraph @

src/cpu/core_dynrec/risc_armv4le-common.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: risc_armv4le-common.h,v 1.3 2009-05-16 21:52:47 c2woody Exp $ */
20
21
22 /* ARMv4 (little endian) backend by M-HT (common data/functions) */
23
24
25 // some configuring defines that specify the capabilities of this architecture
26 // or aspects of the recompiling
27
28 // protect FC_ADDR over function calls if necessaray
29 // #define DRC_PROTECT_ADDR_REG
30
31 // try to use non-flags generating functions if possible
32 #define DRC_FLAGS_INVALIDATION
33 // try to replace _simple functions by code
34 #define DRC_FLAGS_INVALIDATION_DCODE
35
36 // type with the same size as a pointer
37 #define DRC_PTR_SIZE_IM Bit32u
38
39 // calling convention modifier
40 #define DRC_CALL_CONV /* nothing */
41 #define DRC_FC /* nothing */
42
43 // use FC_REGS_ADDR to hold the address of "cpu_regs" and to access it using FC_REGS_ADDR
44 #define DRC_USE_REGS_ADDR
45 // use FC_SEGS_ADDR to hold the address of "Segs" and to access it using FC_SEGS_ADDR
46 #define DRC_USE_SEGS_ADDR
47
48 // register mapping
49 typedef Bit8u HostReg;
50
51 // "lo" registers
52 #define HOST_r0 0
53 #define HOST_r1 1
54 #define HOST_r2 2
55 #define HOST_r3 3
56 #define HOST_r4 4
57 #define HOST_r5 5
58 #define HOST_r6 6
59 #define HOST_r7 7
60 // "hi" registers
61 #define HOST_r8 8
62 #define HOST_r9 9
63 #define HOST_r10 10
64 #define HOST_r11 11
65 #define HOST_r12 12
66 #define HOST_r13 13
67 #define HOST_r14 14
68 #define HOST_r15 15
69
70 // register aliases
71 // "lo" registers
72 #define HOST_a1 HOST_r0
73 #define HOST_a2 HOST_r1
74 #define HOST_a3 HOST_r2
75 #define HOST_a4 HOST_r3
76 #define HOST_v1 HOST_r4
77 #define HOST_v2 HOST_r5
78 #define HOST_v3 HOST_r6
79 #define HOST_v4 HOST_r7
80 // "hi" registers
81 #define HOST_v5 HOST_r8
82 #define HOST_v6 HOST_r9
83 #define HOST_v7 HOST_r10
84 #define HOST_v8 HOST_r11
85 #define HOST_ip HOST_r12
86 #define HOST_sp HOST_r13
87 #define HOST_lr HOST_r14
88 #define HOST_pc HOST_r15
89
90
91 static void cache_block_closing(Bit8u* block_start,Bitu block_size) {
92 #if (__ARM_EABI__)
93 //flush cache - eabi
94 register unsigned long _beg __asm ("a1") = (unsigned long)(block_start); // block start
95 register unsigned long _end __asm ("a2") = (unsigned long)(block_start+block_size); // block end
96 register unsigned long _flg __asm ("a3") = 0;
97 register unsigned long _par __asm ("r7") = 0xf0002; // sys_cacheflush
98 __asm __volatile ("swi 0x0"
99 : // no outputs
100 : "r" (_beg), "r" (_end), "r" (_flg), "r" (_par)
101 );
102 #else
103 // GP2X BEGIN
104 //flush cache - old abi
105 register unsigned long _beg __asm ("a1") = (unsigned long)(block_start); // block start
106 register unsigned long _end __asm ("a2") = (unsigned long)(block_start+block_size); // block end
107 register unsigned long _flg __asm ("a3") = 0;
108 __asm __volatile ("swi 0x9f0002 @ sys_cacheflush"
109 : // no outputs
110 : "r" (_beg), "r" (_end), "r" (_flg)
111 );
112 // GP2X END
113 #endif
114 }