Rizin
unix-like reverse engineering framework and cli tools
cpu-tricore.c File Reference
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <stdbool.h>
#include "sysdep.h"
#include "disas-asm.h"
#include "opcode/tricore.h"

Go to the source code of this file.

Functions

int bfd_default_scan (bfd_arch_info_type *info, const char *string) const
 
const bfd_arch_info_typebfd_default_compatible (bfd_arch_info_type *a, const bfd_arch_info_type *b) const
 
void tricore_init_arch_vars PARAMS ((unsigned long))
 
void tricore_init_arch_vars (unsigned long mach)
 

Variables

unsigned long tricore_mask_abs
 
unsigned long tricore_mask_absb
 
unsigned long tricore_mask_b
 
unsigned long tricore_mask_bit
 
unsigned long tricore_mask_bo
 
unsigned long tricore_mask_bol
 
unsigned long tricore_mask_brc
 
unsigned long tricore_mask_brn
 
unsigned long tricore_mask_brr
 
unsigned long tricore_mask_rc
 
unsigned long tricore_mask_rcpw
 
unsigned long tricore_mask_rcr
 
unsigned long tricore_mask_rcrr
 
unsigned long tricore_mask_rcrw
 
unsigned long tricore_mask_rlc
 
unsigned long tricore_mask_rr
 
unsigned long tricore_mask_rr1
 
unsigned long tricore_mask_rr2
 
unsigned long tricore_mask_rrpw
 
unsigned long tricore_mask_rrr
 
unsigned long tricore_mask_rrr1
 
unsigned long tricore_mask_rrr2
 
unsigned long tricore_mask_rrrr
 
unsigned long tricore_mask_rrrw
 
unsigned long tricore_mask_sys
 
unsigned long tricore_mask_sb
 
unsigned long tricore_mask_sbc
 
unsigned long tricore_mask_sbr
 
unsigned long tricore_mask_sbrn
 
unsigned long tricore_mask_sc
 
unsigned long tricore_mask_slr
 
unsigned long tricore_mask_slro
 
unsigned long tricore_mask_sr
 
unsigned long tricore_mask_src
 
unsigned long tricore_mask_sro
 
unsigned long tricore_mask_srr
 
unsigned long tricore_mask_srrs
 
unsigned long tricore_mask_ssr
 
unsigned long tricore_mask_ssro
 
unsigned long tricore_opmask [TRICORE_FMT_MAX]
 
static const bfd_arch_info_type arch_info_struct []
 
const bfd_arch_info_type bfd_tricore_arch
 

Function Documentation

◆ bfd_default_compatible()

const bfd_arch_info_type* bfd_default_compatible ( bfd_arch_info_type a,
const bfd_arch_info_type b 
) const

Definition at line 84 of file cpu-tricore.c.

87 {
88  if (a->arch != b->arch) {
89  return NULL;
90  }
91 
92  if (a->bits_per_word != b->bits_per_word) {
93  return NULL;
94  }
95 
96  if (a->mach > b->mach) {
97  return a;
98  }
99 
100  if (b->mach > a->mach) {
101  return b;
102  }
103 
104  return a;
105 }
#define NULL
Definition: cris-opc.c:27
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41

References a, b, and NULL.

◆ bfd_default_scan()

int bfd_default_scan ( bfd_arch_info_type info,
const char *  string 
) const

Definition at line 76 of file cpu-tricore.c.

79 {
80  return true;
81 }

◆ PARAMS()

void tricore_init_arch_vars PARAMS ( (unsigned long )

◆ tricore_init_arch_vars()

void tricore_init_arch_vars ( unsigned long  mach)

Definition at line 187 of file cpu-tricore.c.

189 {
190  switch (mach & bfd_mach_rider_mask)
191  {
192  case bfd_mach_rider_a:
193  tricore_mask_abs = 0x0c0000ff;
194  tricore_mask_absb = 0x0c0000ff;
195  tricore_mask_b = 0x000000ff;
196  tricore_mask_bit = 0x006000ff;
197  tricore_mask_bo = 0x0fc000ff;
198  tricore_mask_bol = 0x000000ff;
199  tricore_mask_brc = 0x800000ff;
200  tricore_mask_brn = 0x8000007f;
201  tricore_mask_brr = 0x800000ff;
202  tricore_mask_rc = 0x0fe000ff;
203  tricore_mask_rcpw = 0x006000ff;
204  tricore_mask_rcr = 0x00e000ff;
205  tricore_mask_rcrr = 0x00e000ff;
206  tricore_mask_rcrw = 0x00e000ff;
207  tricore_mask_rlc = 0x000000ff;
208  tricore_mask_rr = 0x0ff000ff;
209  tricore_mask_rrpw = 0x006000ff;
210  tricore_mask_rrr = 0x00f000ff;
211  tricore_mask_rrr1 = 0x00fc00ff;
212  tricore_mask_rrr2 = 0x00ff00ff;
213  tricore_mask_rrrr = 0x00e000ff;
214  tricore_mask_rrrw = 0x00e000ff;
215  tricore_mask_sys = 0x07c000ff;
216  tricore_mask_sb = 0x00ff;
217  tricore_mask_sbc = 0x00ff;
218  tricore_mask_sbr = 0x00ff;
219  tricore_mask_sbrn = 0x007f;
220  tricore_mask_sc = 0x00ff;
221  tricore_mask_slr = 0x00ff;
222  tricore_mask_slro = 0x00ff;
223  tricore_mask_sr = 0xf0ff;
224  tricore_mask_src = 0x00ff;
225  tricore_mask_sro = 0x00ff;
226  tricore_mask_srr = 0x00ff;
227  tricore_mask_srrs = 0x003f;
228  tricore_mask_ssr = 0x00ff;
229  tricore_mask_ssro = 0x00ff;
230  break;
231 
232  case bfd_mach_rider_b: /* Same as bfd_mach_rider_d! */
233  case bfd_mach_rider_2:
234  tricore_mask_abs = 0x0c0000ff;
235  tricore_mask_absb = 0x0c0000ff;
236  tricore_mask_b = 0x000000ff;
237  tricore_mask_bit = 0x006000ff;
238  tricore_mask_bo = 0x0fc000ff;
239  tricore_mask_bol = 0x000000ff;
240  tricore_mask_brc = 0x800000ff;
241  tricore_mask_brn = 0x8000007f;
242  tricore_mask_brr = 0x800000ff;
243  tricore_mask_rc = 0x0fe000ff;
244  tricore_mask_rcpw = 0x006000ff;
245  tricore_mask_rcr = 0x00e000ff;
246  tricore_mask_rcrr = 0x00e000ff;
247  tricore_mask_rcrw = 0x00e000ff;
248  tricore_mask_rlc = 0x000000ff;
249  tricore_mask_rr = 0x0ff300ff;
250  tricore_mask_rr1 = 0x0ffc00ff;
251  tricore_mask_rr2 = 0x0fff00ff;
252  tricore_mask_rrpw = 0x006000ff;
253  tricore_mask_rrr = 0x00f300ff;
254  tricore_mask_rrr1 = 0x00fc00ff;
255  tricore_mask_rrr2 = 0x00ff00ff;
256  tricore_mask_rrrr = 0x00e000ff;
257  tricore_mask_rrrw = 0x00e000ff;
258  if ((mach & bfd_mach_rider_mask) == bfd_mach_rider_2) {
259  tricore_mask_sys = 0x0fc000ff;
260  } else {
261  tricore_mask_sys = 0x07c000ff;
262  }
263  tricore_mask_sb = 0x00ff;
264  tricore_mask_sbc = 0x00ff;
265  tricore_mask_sbr = 0x00ff;
266  tricore_mask_sbrn = 0x00ff;
267  tricore_mask_sc = 0x00ff;
268  tricore_mask_slr = 0x00ff;
269  tricore_mask_slro = 0x00ff;
270  tricore_mask_sr = 0xf0ff;
271  tricore_mask_src = 0x00ff;
272  tricore_mask_sro = 0x00ff;
273  tricore_mask_srr = 0x00ff;
274  tricore_mask_srrs = 0x003f;
275  tricore_mask_ssr = 0x00ff;
276  tricore_mask_ssro = 0x00ff;
277  break;
278  }
279 
280  /* Now fill in tricore_opmask[]. */
281 
321 }
unsigned long tricore_mask_brn
Definition: cpu-tricore.c:41
unsigned long tricore_mask_ssr
Definition: cpu-tricore.c:71
unsigned long tricore_mask_rrrr
Definition: cpu-tricore.c:56
unsigned long tricore_mask_rrr
Definition: cpu-tricore.c:53
unsigned long tricore_mask_ssro
Definition: cpu-tricore.c:72
unsigned long tricore_mask_srr
Definition: cpu-tricore.c:69
unsigned long tricore_mask_sb
Definition: cpu-tricore.c:59
unsigned long tricore_mask_bo
Definition: cpu-tricore.c:38
unsigned long tricore_mask_rcr
Definition: cpu-tricore.c:45
unsigned long tricore_mask_sc
Definition: cpu-tricore.c:63
unsigned long tricore_mask_slr
Definition: cpu-tricore.c:64
unsigned long tricore_mask_rc
Definition: cpu-tricore.c:43
unsigned long tricore_mask_rrpw
Definition: cpu-tricore.c:52
unsigned long tricore_mask_srrs
Definition: cpu-tricore.c:70
unsigned long tricore_mask_bol
Definition: cpu-tricore.c:39
unsigned long tricore_mask_slro
Definition: cpu-tricore.c:65
unsigned long tricore_mask_rr
Definition: cpu-tricore.c:49
unsigned long tricore_mask_rrr2
Definition: cpu-tricore.c:55
unsigned long tricore_mask_bit
Definition: cpu-tricore.c:37
unsigned long tricore_mask_brc
Definition: cpu-tricore.c:40
unsigned long tricore_mask_rr2
Definition: cpu-tricore.c:51
unsigned long tricore_mask_sro
Definition: cpu-tricore.c:68
unsigned long tricore_mask_rcpw
Definition: cpu-tricore.c:44
unsigned long tricore_mask_sbr
Definition: cpu-tricore.c:61
unsigned long tricore_mask_b
Definition: cpu-tricore.c:36
unsigned long tricore_mask_sys
Definition: cpu-tricore.c:58
unsigned long tricore_mask_rlc
Definition: cpu-tricore.c:48
unsigned long tricore_mask_sbrn
Definition: cpu-tricore.c:62
unsigned long tricore_mask_abs
Definition: cpu-tricore.c:34
unsigned long tricore_mask_rrrw
Definition: cpu-tricore.c:57
unsigned long tricore_opmask[TRICORE_FMT_MAX]
Definition: cpu-tricore.c:73
unsigned long tricore_mask_rcrw
Definition: cpu-tricore.c:47
unsigned long tricore_mask_rrr1
Definition: cpu-tricore.c:54
unsigned long tricore_mask_rcrr
Definition: cpu-tricore.c:46
unsigned long tricore_mask_sr
Definition: cpu-tricore.c:66
unsigned long tricore_mask_src
Definition: cpu-tricore.c:67
unsigned long tricore_mask_absb
Definition: cpu-tricore.c:35
unsigned long tricore_mask_sbc
Definition: cpu-tricore.c:60
unsigned long tricore_mask_rr1
Definition: cpu-tricore.c:50
unsigned long tricore_mask_brr
Definition: cpu-tricore.c:42
@ TRICORE_FMT_RLC
Definition: tricore.h:75
@ TRICORE_FMT_BO
Definition: tricore.h:65
@ TRICORE_FMT_SRC
Definition: tricore.h:97
@ TRICORE_FMT_SRO
Definition: tricore.h:98
@ TRICORE_FMT_SYS
Definition: tricore.h:85
@ TRICORE_FMT_SBRN
Definition: tricore.h:92
@ TRICORE_FMT_RR
Definition: tricore.h:76
@ TRICORE_FMT_RRPW
Definition: tricore.h:79
@ TRICORE_FMT_RR1
Definition: tricore.h:77
@ TRICORE_FMT_SSR
Definition: tricore.h:101
@ TRICORE_FMT_RRRR
Definition: tricore.h:83
@ TRICORE_FMT_RRR2
Definition: tricore.h:82
@ TRICORE_FMT_SLR
Definition: tricore.h:94
@ TRICORE_FMT_ABS
Definition: tricore.h:61
@ TRICORE_FMT_RCR
Definition: tricore.h:72
@ TRICORE_FMT_RRR
Definition: tricore.h:80
@ TRICORE_FMT_SR
Definition: tricore.h:96
@ TRICORE_FMT_RCRW
Definition: tricore.h:74
@ TRICORE_FMT_SSRO
Definition: tricore.h:102
@ TRICORE_FMT_SLRO
Definition: tricore.h:95
@ TRICORE_FMT_SC
Definition: tricore.h:93
@ TRICORE_FMT_RRRW
Definition: tricore.h:84
@ TRICORE_FMT_BOL
Definition: tricore.h:66
@ TRICORE_FMT_BRN
Definition: tricore.h:68
@ TRICORE_FMT_B
Definition: tricore.h:63
@ TRICORE_FMT_RCPW
Definition: tricore.h:71
@ TRICORE_FMT_SBC
Definition: tricore.h:90
@ TRICORE_FMT_RRR1
Definition: tricore.h:81
@ TRICORE_FMT_BRR
Definition: tricore.h:69
@ TRICORE_FMT_RCRR
Definition: tricore.h:73
@ TRICORE_FMT_ABSB
Definition: tricore.h:62
@ TRICORE_FMT_RR2
Definition: tricore.h:78
@ TRICORE_FMT_SRR
Definition: tricore.h:99
@ TRICORE_FMT_RC
Definition: tricore.h:70
@ TRICORE_FMT_SRRS
Definition: tricore.h:100
@ TRICORE_FMT_BRC
Definition: tricore.h:67
@ TRICORE_FMT_BIT
Definition: tricore.h:64
@ TRICORE_FMT_SBR
Definition: tricore.h:91
@ TRICORE_FMT_SB
Definition: tricore.h:89
#define bfd_mach_rider_2
Definition: tricore.h:41
#define bfd_mach_rider_mask
Definition: tricore.h:43
#define bfd_mach_rider_a
Definition: tricore.h:38
#define bfd_mach_rider_b
Definition: tricore.h:39

References bfd_mach_rider_2, bfd_mach_rider_a, bfd_mach_rider_b, bfd_mach_rider_mask, TRICORE_FMT_ABS, TRICORE_FMT_ABSB, TRICORE_FMT_B, TRICORE_FMT_BIT, TRICORE_FMT_BO, TRICORE_FMT_BOL, TRICORE_FMT_BRC, TRICORE_FMT_BRN, TRICORE_FMT_BRR, TRICORE_FMT_RC, TRICORE_FMT_RCPW, TRICORE_FMT_RCR, TRICORE_FMT_RCRR, TRICORE_FMT_RCRW, TRICORE_FMT_RLC, TRICORE_FMT_RR, TRICORE_FMT_RR1, TRICORE_FMT_RR2, TRICORE_FMT_RRPW, TRICORE_FMT_RRR, TRICORE_FMT_RRR1, TRICORE_FMT_RRR2, TRICORE_FMT_RRRR, TRICORE_FMT_RRRW, TRICORE_FMT_SB, TRICORE_FMT_SBC, TRICORE_FMT_SBR, TRICORE_FMT_SBRN, TRICORE_FMT_SC, TRICORE_FMT_SLR, TRICORE_FMT_SLRO, TRICORE_FMT_SR, TRICORE_FMT_SRC, TRICORE_FMT_SRO, TRICORE_FMT_SRR, TRICORE_FMT_SRRS, TRICORE_FMT_SSR, TRICORE_FMT_SSRO, TRICORE_FMT_SYS, tricore_mask_abs, tricore_mask_absb, tricore_mask_b, tricore_mask_bit, tricore_mask_bo, tricore_mask_bol, tricore_mask_brc, tricore_mask_brn, tricore_mask_brr, tricore_mask_rc, tricore_mask_rcpw, tricore_mask_rcr, tricore_mask_rcrr, tricore_mask_rcrw, tricore_mask_rlc, tricore_mask_rr, tricore_mask_rr1, tricore_mask_rr2, tricore_mask_rrpw, tricore_mask_rrr, tricore_mask_rrr1, tricore_mask_rrr2, tricore_mask_rrrr, tricore_mask_rrrw, tricore_mask_sb, tricore_mask_sbc, tricore_mask_sbr, tricore_mask_sbrn, tricore_mask_sc, tricore_mask_slr, tricore_mask_slro, tricore_mask_sr, tricore_mask_src, tricore_mask_sro, tricore_mask_srr, tricore_mask_srrs, tricore_mask_ssr, tricore_mask_ssro, tricore_mask_sys, and tricore_opmask.

Referenced by print_insn_tricore().

Variable Documentation

◆ arch_info_struct

const bfd_arch_info_type arch_info_struct[]
static

Definition at line 111 of file cpu-tricore.c.

◆ bfd_tricore_arch

const bfd_arch_info_type bfd_tricore_arch
Initial value:
=
{
32,
32,
8,
"tricore",
"TriCore:Rider-B",
3,
true,
}
int bfd_default_scan(bfd_arch_info_type *info, const char *string) const
Definition: cpu-tricore.c:76
const bfd_arch_info_type * bfd_default_compatible(bfd_arch_info_type *a, const bfd_arch_info_type *b) const
Definition: cpu-tricore.c:84
static const bfd_arch_info_type arch_info_struct[]
Definition: cpu-tricore.c:111
@ bfd_arch_tricore
Definition: mybfd.h:1872

Definition at line 162 of file cpu-tricore.c.

◆ tricore_mask_abs

unsigned long tricore_mask_abs

Definition at line 34 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_absb

unsigned long tricore_mask_absb

Definition at line 35 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_b

unsigned long tricore_mask_b

Definition at line 36 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_bit

unsigned long tricore_mask_bit

Definition at line 37 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_bo

unsigned long tricore_mask_bo

Definition at line 38 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_bol

unsigned long tricore_mask_bol

Definition at line 39 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_brc

unsigned long tricore_mask_brc

Definition at line 40 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_brn

unsigned long tricore_mask_brn

Definition at line 41 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_brr

unsigned long tricore_mask_brr

Definition at line 42 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rc

unsigned long tricore_mask_rc

Definition at line 43 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rcpw

unsigned long tricore_mask_rcpw

Definition at line 44 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rcr

unsigned long tricore_mask_rcr

Definition at line 45 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rcrr

unsigned long tricore_mask_rcrr

Definition at line 46 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rcrw

unsigned long tricore_mask_rcrw

Definition at line 47 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rlc

unsigned long tricore_mask_rlc

Definition at line 48 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rr

unsigned long tricore_mask_rr

Definition at line 49 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rr1

unsigned long tricore_mask_rr1

Definition at line 50 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rr2

unsigned long tricore_mask_rr2

Definition at line 51 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rrpw

unsigned long tricore_mask_rrpw

Definition at line 52 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rrr

unsigned long tricore_mask_rrr

Definition at line 53 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rrr1

unsigned long tricore_mask_rrr1

Definition at line 54 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rrr2

unsigned long tricore_mask_rrr2

Definition at line 55 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rrrr

unsigned long tricore_mask_rrrr

Definition at line 56 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_rrrw

unsigned long tricore_mask_rrrw

Definition at line 57 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sb

unsigned long tricore_mask_sb

Definition at line 59 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sbc

unsigned long tricore_mask_sbc

Definition at line 60 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sbr

unsigned long tricore_mask_sbr

Definition at line 61 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sbrn

unsigned long tricore_mask_sbrn

Definition at line 62 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sc

unsigned long tricore_mask_sc

Definition at line 63 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_slr

unsigned long tricore_mask_slr

Definition at line 64 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_slro

unsigned long tricore_mask_slro

Definition at line 65 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sr

unsigned long tricore_mask_sr

Definition at line 66 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_src

unsigned long tricore_mask_src

Definition at line 67 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sro

unsigned long tricore_mask_sro

Definition at line 68 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_srr

unsigned long tricore_mask_srr

Definition at line 69 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_srrs

unsigned long tricore_mask_srrs

Definition at line 70 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_ssr

unsigned long tricore_mask_ssr

Definition at line 71 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_ssro

unsigned long tricore_mask_ssro

Definition at line 72 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_mask_sys

unsigned long tricore_mask_sys

Definition at line 58 of file cpu-tricore.c.

Referenced by tricore_init_arch_vars().

◆ tricore_opmask

unsigned long tricore_opmask[TRICORE_FMT_MAX]

Definition at line 73 of file cpu-tricore.c.

Referenced by decode_tricore_insn(), and tricore_init_arch_vars().