aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore/new_dynarec/assem_arm.h
blob: bb6114c81cfe0b29e126ac5e4e12b93edfcb9851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#define HOST_REGS 13
#define HOST_CCREG 10
#define HOST_BTREG 8
#define EXCLUDE_REG 11

#define HOST_IMM8 1
#define HAVE_CMOV_IMM 1
#define HAVE_CONDITIONAL_CALL 1
#define RAM_SIZE 0x200000

#define REG_SHIFT 2

/* ARM calling convention:
   r0-r3, r12: caller-save
   r4-r11: callee-save */

#define ARG1_REG 0
#define ARG2_REG 1
#define ARG3_REG 2
#define ARG4_REG 3

/* GCC register naming convention:
   r10 = sl (base)
   r11 = fp (frame pointer)
   r12 = ip (scratch)
   r13 = sp (stack pointer)
   r14 = lr (link register)
   r15 = pc (program counter) */

#define FP 11
#define LR 14
#define HOST_TEMPREG 14

// Note: FP is set to &dynarec_local when executing generated code.
// Thus the local variables are actually global and not on the stack.

extern char *invc_ptr;

#define TARGET_SIZE_2 24 // 2^24 = 16 megabytes

// Code generator target address
#if   defined(BASE_ADDR_FIXED)
  // "round" address helpful for debug
  // this produces best code, but not many platforms allow it,
  // only use if you are sure this range is always free
  #define BASE_ADDR 0x1000000
  #define translation_cache (char *)BASE_ADDR
#elif defined(BASE_ADDR_DYNAMIC)
  // for platforms that can't just use .bss buffer, like vita
  // otherwise better to use the next option for closer branches
  extern char *translation_cache;
  #define BASE_ADDR (u_int)translation_cache
#else
  // using a static buffer in .bss
  extern char translation_cache[1 << TARGET_SIZE_2];
  #define BASE_ADDR (u_int)translation_cache
#endif