Rizin
unix-like reverse engineering framework and cli tools
libhppa.h File Reference

Go to the source code of this file.

Macros

#define BYTES_IN_WORD   4
 
#define PA_PAGESIZE   0x1000
 
#define HPPA_R_ARG_RELOC(a)    (((a) >> 22) & 0x3ff)
 
#define HPPA_R_CONSTANT(a)    ((((bfd_signed_vma)(a)) << (BFD_ARCH_SIZE - 22)) >> (BFD_ARCH_SIZE - 22))
 
#define HPPA_R_ADDEND(r, c)    (((r) << 22) + ((c)&0x3fffff))
 
#define get_opcode(insn)   (((insn) >> 26) & 0x3f)
 

Enumerations

enum  pa_arch { pa10 = 10 , pa11 = 11 , pa20 = 20 , pa20w = 25 }
 
enum  hppa_reloc_field_selector_type {
  RZ_HPPA_FSEL = 0x0 , RZ_HPPA_LSSEL = 0x1 , RZ_HPPA_RSSEL = 0x2 , RZ_HPPA_LSEL = 0x3 ,
  RZ_HPPA_RSEL = 0x4 , RZ_HPPA_LDSEL = 0x5 , RZ_HPPA_RDSEL = 0x6 , RZ_HPPA_LRSEL = 0x7 ,
  RZ_HPPA_RRSEL = 0x8 , RZ_HPPA_NSEL = 0x9 , RZ_HPPA_NLSEL = 0xa , RZ_HPPA_NLRSEL = 0xb ,
  RZ_HPPA_PSEL = 0xc , RZ_HPPA_LPSEL = 0xd , RZ_HPPA_RPSEL = 0xe , RZ_HPPA_TSEL = 0xf ,
  RZ_HPPA_LTSEL = 0x10 , RZ_HPPA_RTSEL = 0x11 , RZ_HPPA_LTPSEL = 0x12 , RZ_HPPA_RTPSEL = 0x13
}
 
enum  hppa_reloc_field_selector_type_alt {
  e_fsel = RZ_HPPA_FSEL , e_lssel = RZ_HPPA_LSSEL , e_rssel = RZ_HPPA_RSSEL , e_lsel = RZ_HPPA_LSEL ,
  e_rsel = RZ_HPPA_RSEL , e_ldsel = RZ_HPPA_LDSEL , e_rdsel = RZ_HPPA_RDSEL , e_lrsel = RZ_HPPA_LRSEL ,
  e_rrsel = RZ_HPPA_RRSEL , e_nsel = RZ_HPPA_NSEL , e_nlsel = RZ_HPPA_NLSEL , e_nlrsel = RZ_HPPA_NLRSEL ,
  e_psel = RZ_HPPA_PSEL , e_lpsel = RZ_HPPA_LPSEL , e_rpsel = RZ_HPPA_RPSEL , e_tsel = RZ_HPPA_TSEL ,
  e_ltsel = RZ_HPPA_LTSEL , e_rtsel = RZ_HPPA_RTSEL , e_ltpsel = RZ_HPPA_LTPSEL , e_rtpsel = RZ_HPPA_RTPSEL
}
 
enum  hppa_reloc_expr_type {
  RZ_HPPA_E_ONE = 0 , RZ_HPPA_E_TWO = 1 , RZ_HPPA_E_PCREL = 2 , RZ_HPPA_E_CON = 3 ,
  RZ_HPPA_E_PLABEL = 7 , RZ_HPPA_E_ABS = 18
}
 
enum  hppa_reloc_expr_type_alt {
  e_one = RZ_HPPA_E_ONE , e_two = RZ_HPPA_E_TWO , e_pcrel = RZ_HPPA_E_PCREL , e_con = RZ_HPPA_E_CON ,
  e_plabel = RZ_HPPA_E_PLABEL , e_abs = RZ_HPPA_E_ABS
}
 
enum  hppa_opcode_type {
  OP_SYSOP = 0x00 , OP_MEMMNG = 0x01 , OP_ALU = 0x02 , OP_NDXMEM = 0x03 ,
  OP_SPOP = 0x04 , OP_DIAG = 0x05 , OP_FMPYADD = 0x06 , OP_UNDEF07 = 0x07 ,
  OP_COPRW = 0x09 , OP_COPRDW = 0x0b , OP_COPR = 0x0c , OP_FLOAT = 0x0e ,
  OP_PRDSPEC = 0x0f , OP_UNDEF15 = 0x15 , OP_UNDEF1d = 0x1d , OP_FMPYSUB = 0x26 ,
  OP_FPFUSED = 0x2e , OP_SHEXDP0 = 0x34 , OP_SHEXDP1 = 0x35 , OP_SHEXDP2 = 0x36 ,
  OP_UNDEF37 = 0x37 , OP_SHEXDP3 = 0x3c , OP_SHEXDP4 = 0x3d , OP_MULTMED = 0x3e ,
  OP_UNDEF3f = 0x3f , OP_LDIL = 0x08 , OP_ADDIL = 0x0a , OP_LDO = 0x0d ,
  OP_LDB = 0x10 , OP_LDH = 0x11 , OP_LDW = 0x12 , OP_LDWM = 0x13 ,
  OP_STB = 0x18 , OP_STH = 0x19 , OP_STW = 0x1a , OP_STWM = 0x1b ,
  OP_LDD = 0x14 , OP_STD = 0x1c , OP_FLDW = 0x16 , OP_LDWL = 0x17 ,
  OP_FSTW = 0x1e , OP_STWL = 0x1f , OP_COMBT = 0x20 , OP_COMIBT = 0x21 ,
  OP_COMBF = 0x22 , OP_COMIBF = 0x23 , OP_CMPBDT = 0x27 , OP_ADDBT = 0x28 ,
  OP_ADDIBT = 0x29 , OP_ADDBF = 0x2a , OP_ADDIBF = 0x2b , OP_CMPBDF = 0x2f ,
  OP_BVB = 0x30 , OP_BB = 0x31 , OP_MOVB = 0x32 , OP_MOVIB = 0x33 ,
  OP_CMPIBD = 0x3b , OP_COMICLR = 0x24 , OP_SUBI = 0x25 , OP_ADDIT = 0x2c ,
  OP_ADDI = 0x2d , OP_BE = 0x38 , OP_BLE = 0x39 , OP_BL = 0x3a
}
 

Functions

static int sign_extend (int, int) ATTRIBUTE_UNUSED
 
static int low_sign_extend (int, int) ATTRIBUTE_UNUSED
 
static int sign_unext (int, int) ATTRIBUTE_UNUSED
 
static int low_sign_unext (int, int) ATTRIBUTE_UNUSED
 
static int re_assemble_3 (int) ATTRIBUTE_UNUSED
 
static int re_assemble_12 (int) ATTRIBUTE_UNUSED
 
static int re_assemble_14 (int) ATTRIBUTE_UNUSED
 
static int re_assemble_16 (int) ATTRIBUTE_UNUSED
 
static int re_assemble_17 (int) ATTRIBUTE_UNUSED
 
static int re_assemble_21 (int) ATTRIBUTE_UNUSED
 
static int re_assemble_22 (int) ATTRIBUTE_UNUSED
 
static bfd_signed_vma hppa_field_adjust (bfd_vma, bfd_signed_vma, enum hppa_reloc_field_selector_type_alt) ATTRIBUTE_UNUSED
 
static int bfd_hppa_insn2fmt (bfd *, int) ATTRIBUTE_UNUSED
 
static int hppa_rebuild_insn (int, int, int) ATTRIBUTE_UNUSED
 

Macro Definition Documentation

◆ BYTES_IN_WORD

#define BYTES_IN_WORD   4

Definition at line 30 of file libhppa.h.

◆ get_opcode

#define get_opcode (   insn)    (((insn) >> 26) & 0x3f)

Definition at line 348 of file libhppa.h.

◆ HPPA_R_ADDEND

#define HPPA_R_ADDEND (   r,
  c 
)     (((r) << 22) + ((c)&0x3fffff))

Definition at line 153 of file libhppa.h.

◆ HPPA_R_ARG_RELOC

#define HPPA_R_ARG_RELOC (   a)     (((a) >> 22) & 0x3ff)

Definition at line 149 of file libhppa.h.

◆ HPPA_R_CONSTANT

#define HPPA_R_CONSTANT (   a)     ((((bfd_signed_vma)(a)) << (BFD_ARCH_SIZE - 22)) >> (BFD_ARCH_SIZE - 22))

Definition at line 151 of file libhppa.h.

◆ PA_PAGESIZE

#define PA_PAGESIZE   0x1000

Definition at line 31 of file libhppa.h.

Enumeration Type Documentation

◆ hppa_opcode_type

Enumerator
OP_SYSOP 
OP_MEMMNG 
OP_ALU 
OP_NDXMEM 
OP_SPOP 
OP_DIAG 
OP_FMPYADD 
OP_UNDEF07 
OP_COPRW 
OP_COPRDW 
OP_COPR 
OP_FLOAT 
OP_PRDSPEC 
OP_UNDEF15 
OP_UNDEF1d 
OP_FMPYSUB 
OP_FPFUSED 
OP_SHEXDP0 
OP_SHEXDP1 
OP_SHEXDP2 
OP_UNDEF37 
OP_SHEXDP3 
OP_SHEXDP4 
OP_MULTMED 
OP_UNDEF3f 
OP_LDIL 
OP_ADDIL 
OP_LDO 
OP_LDB 
OP_LDH 
OP_LDW 
OP_LDWM 
OP_STB 
OP_STH 
OP_STW 
OP_STWM 
OP_LDD 
OP_STD 
OP_FLDW 
OP_LDWL 
OP_FSTW 
OP_STWL 
OP_COMBT 
OP_COMIBT 
OP_COMBF 
OP_COMIBF 
OP_CMPBDT 
OP_ADDBT 
OP_ADDIBT 
OP_ADDBF 
OP_ADDIBF 
OP_CMPBDF 
OP_BVB 
OP_BB 
OP_MOVB 
OP_MOVIB 
OP_CMPIBD 
OP_COMICLR 
OP_SUBI 
OP_ADDIT 
OP_ADDI 
OP_BE 
OP_BLE 
OP_BL 

Definition at line 350 of file libhppa.h.

350  {
351  /* None of the opcodes in the first group generate relocs, so we
352  aren't too concerned about them. */
353  OP_SYSOP = 0x00,
354  OP_MEMMNG = 0x01,
355  OP_ALU = 0x02,
356  OP_NDXMEM = 0x03,
357  OP_SPOP = 0x04,
358  OP_DIAG = 0x05,
359  OP_FMPYADD = 0x06,
360  OP_UNDEF07 = 0x07,
361  OP_COPRW = 0x09,
362  OP_COPRDW = 0x0b,
363  OP_COPR = 0x0c,
364  OP_FLOAT = 0x0e,
365  OP_PRDSPEC = 0x0f,
366  OP_UNDEF15 = 0x15,
367  OP_UNDEF1d = 0x1d,
368  OP_FMPYSUB = 0x26,
369  OP_FPFUSED = 0x2e,
370  OP_SHEXDP0 = 0x34,
371  OP_SHEXDP1 = 0x35,
372  OP_SHEXDP2 = 0x36,
373  OP_UNDEF37 = 0x37,
374  OP_SHEXDP3 = 0x3c,
375  OP_SHEXDP4 = 0x3d,
376  OP_MULTMED = 0x3e,
377  OP_UNDEF3f = 0x3f,
378 
379  OP_LDIL = 0x08,
380  OP_ADDIL = 0x0a,
381 
382  OP_LDO = 0x0d,
383  OP_LDB = 0x10,
384  OP_LDH = 0x11,
385  OP_LDW = 0x12,
386  OP_LDWM = 0x13,
387  OP_STB = 0x18,
388  OP_STH = 0x19,
389  OP_STW = 0x1a,
390  OP_STWM = 0x1b,
391 
392  OP_LDD = 0x14,
393  OP_STD = 0x1c,
394 
395  OP_FLDW = 0x16,
396  OP_LDWL = 0x17,
397  OP_FSTW = 0x1e,
398  OP_STWL = 0x1f,
399 
400  OP_COMBT = 0x20,
401  OP_COMIBT = 0x21,
402  OP_COMBF = 0x22,
403  OP_COMIBF = 0x23,
404  OP_CMPBDT = 0x27,
405  OP_ADDBT = 0x28,
406  OP_ADDIBT = 0x29,
407  OP_ADDBF = 0x2a,
408  OP_ADDIBF = 0x2b,
409  OP_CMPBDF = 0x2f,
410  OP_BVB = 0x30,
411  OP_BB = 0x31,
412  OP_MOVB = 0x32,
413  OP_MOVIB = 0x33,
414  OP_CMPIBD = 0x3b,
415 
416  OP_COMICLR = 0x24,
417  OP_SUBI = 0x25,
418  OP_ADDIT = 0x2c,
419  OP_ADDI = 0x2d,
420 
421  OP_BE = 0x38,
422  OP_BLE = 0x39,
423  OP_BL = 0x3a
424 };
@ OP_MULTMED
Definition: libhppa.h:376
@ OP_NDXMEM
Definition: libhppa.h:356
@ OP_MOVB
Definition: libhppa.h:412
@ OP_SHEXDP3
Definition: libhppa.h:374
@ OP_CMPBDF
Definition: libhppa.h:409
@ OP_UNDEF3f
Definition: libhppa.h:377
@ OP_COMIBT
Definition: libhppa.h:401
@ OP_SHEXDP2
Definition: libhppa.h:372
@ OP_BE
Definition: libhppa.h:421
@ OP_STWM
Definition: libhppa.h:390
@ OP_DIAG
Definition: libhppa.h:358
@ OP_SUBI
Definition: libhppa.h:417
@ OP_SHEXDP1
Definition: libhppa.h:371
@ OP_SYSOP
Definition: libhppa.h:353
@ OP_PRDSPEC
Definition: libhppa.h:365
@ OP_STW
Definition: libhppa.h:389
@ OP_MEMMNG
Definition: libhppa.h:354
@ OP_UNDEF1d
Definition: libhppa.h:367
@ OP_BVB
Definition: libhppa.h:410
@ OP_LDH
Definition: libhppa.h:384
@ OP_MOVIB
Definition: libhppa.h:413
@ OP_STWL
Definition: libhppa.h:398
@ OP_FMPYADD
Definition: libhppa.h:359
@ OP_UNDEF15
Definition: libhppa.h:366
@ OP_STD
Definition: libhppa.h:393
@ OP_LDWM
Definition: libhppa.h:386
@ OP_FLDW
Definition: libhppa.h:395
@ OP_FPFUSED
Definition: libhppa.h:369
@ OP_ALU
Definition: libhppa.h:355
@ OP_STH
Definition: libhppa.h:388
@ OP_UNDEF37
Definition: libhppa.h:373
@ OP_FSTW
Definition: libhppa.h:397
@ OP_FMPYSUB
Definition: libhppa.h:368
@ OP_STB
Definition: libhppa.h:387
@ OP_COMIBF
Definition: libhppa.h:403
@ OP_COPR
Definition: libhppa.h:363
@ OP_COPRDW
Definition: libhppa.h:362
@ OP_ADDIT
Definition: libhppa.h:418
@ OP_COMBT
Definition: libhppa.h:400
@ OP_COMICLR
Definition: libhppa.h:416
@ OP_CMPIBD
Definition: libhppa.h:414
@ OP_SHEXDP4
Definition: libhppa.h:375
@ OP_SPOP
Definition: libhppa.h:357
@ OP_LDW
Definition: libhppa.h:385
@ OP_CMPBDT
Definition: libhppa.h:404
@ OP_SHEXDP0
Definition: libhppa.h:370
@ OP_COMBF
Definition: libhppa.h:402
@ OP_ADDBF
Definition: libhppa.h:407
@ OP_UNDEF07
Definition: libhppa.h:360
@ OP_BB
Definition: libhppa.h:411
@ OP_ADDIBT
Definition: libhppa.h:406
@ OP_LDWL
Definition: libhppa.h:396
@ OP_BL
Definition: libhppa.h:423
@ OP_COPRW
Definition: libhppa.h:361
@ OP_LDB
Definition: libhppa.h:383
@ OP_ADDBT
Definition: libhppa.h:405
@ OP_BLE
Definition: libhppa.h:422
@ OP_ADDIBF
Definition: libhppa.h:408
@ OP_FLOAT
Definition: libhppa.h:364
@ OP_ADDI
Definition: libhppa.h:419
@ OP_LDIL
Definition: libhppa.h:379
@ OP_LDO
Definition: libhppa.h:382
@ OP_ADDIL
Definition: libhppa.h:380
@ OP_LDD
Definition: libhppa.h:392

◆ hppa_reloc_expr_type

Enumerator
RZ_HPPA_E_ONE 
RZ_HPPA_E_TWO 
RZ_HPPA_E_PCREL 
RZ_HPPA_E_CON 
RZ_HPPA_E_PLABEL 
RZ_HPPA_E_ABS 

Definition at line 118 of file libhppa.h.

118  {
119  RZ_HPPA_E_ONE = 0,
120  RZ_HPPA_E_TWO = 1,
121  RZ_HPPA_E_PCREL = 2,
122  RZ_HPPA_E_CON = 3,
123  RZ_HPPA_E_PLABEL = 7,
124  RZ_HPPA_E_ABS = 18
125 };
@ RZ_HPPA_E_CON
Definition: libhppa.h:122
@ RZ_HPPA_E_ONE
Definition: libhppa.h:119
@ RZ_HPPA_E_TWO
Definition: libhppa.h:120
@ RZ_HPPA_E_ABS
Definition: libhppa.h:124
@ RZ_HPPA_E_PLABEL
Definition: libhppa.h:123
@ RZ_HPPA_E_PCREL
Definition: libhppa.h:121

◆ hppa_reloc_expr_type_alt

Enumerator
e_one 
e_two 
e_pcrel 
e_con 
e_plabel 
e_abs 

Definition at line 128 of file libhppa.h.

128  {
135 };
@ e_two
Definition: libhppa.h:130
@ e_abs
Definition: libhppa.h:134
@ e_plabel
Definition: libhppa.h:133
@ e_one
Definition: libhppa.h:129
@ e_con
Definition: libhppa.h:132
@ e_pcrel
Definition: libhppa.h:131

◆ hppa_reloc_field_selector_type

Enumerator
RZ_HPPA_FSEL 
RZ_HPPA_LSSEL 
RZ_HPPA_RSSEL 
RZ_HPPA_LSEL 
RZ_HPPA_RSEL 
RZ_HPPA_LDSEL 
RZ_HPPA_RDSEL 
RZ_HPPA_LRSEL 
RZ_HPPA_RRSEL 
RZ_HPPA_NSEL 
RZ_HPPA_NLSEL 
RZ_HPPA_NLRSEL 
RZ_HPPA_PSEL 
RZ_HPPA_LPSEL 
RZ_HPPA_RPSEL 
RZ_HPPA_TSEL 
RZ_HPPA_LTSEL 
RZ_HPPA_RTSEL 
RZ_HPPA_LTPSEL 
RZ_HPPA_RTPSEL 

Definition at line 41 of file libhppa.h.

41  {
42  RZ_HPPA_FSEL = 0x0,
43  RZ_HPPA_LSSEL = 0x1,
44  RZ_HPPA_RSSEL = 0x2,
45  RZ_HPPA_LSEL = 0x3,
46  RZ_HPPA_RSEL = 0x4,
47  RZ_HPPA_LDSEL = 0x5,
48  RZ_HPPA_RDSEL = 0x6,
49  RZ_HPPA_LRSEL = 0x7,
50  RZ_HPPA_RRSEL = 0x8,
51  RZ_HPPA_NSEL = 0x9,
52  RZ_HPPA_NLSEL = 0xa,
53  RZ_HPPA_NLRSEL = 0xb,
54  RZ_HPPA_PSEL = 0xc,
55  RZ_HPPA_LPSEL = 0xd,
56  RZ_HPPA_RPSEL = 0xe,
57  RZ_HPPA_TSEL = 0xf,
58  RZ_HPPA_LTSEL = 0x10,
59  RZ_HPPA_RTSEL = 0x11,
60  RZ_HPPA_LTPSEL = 0x12,
61  RZ_HPPA_RTPSEL = 0x13
62 };
@ RZ_HPPA_TSEL
Definition: libhppa.h:57
@ RZ_HPPA_PSEL
Definition: libhppa.h:54
@ RZ_HPPA_NLRSEL
Definition: libhppa.h:53
@ RZ_HPPA_LDSEL
Definition: libhppa.h:47
@ RZ_HPPA_LRSEL
Definition: libhppa.h:49
@ RZ_HPPA_LSEL
Definition: libhppa.h:45
@ RZ_HPPA_RTSEL
Definition: libhppa.h:59
@ RZ_HPPA_NSEL
Definition: libhppa.h:51
@ RZ_HPPA_RSEL
Definition: libhppa.h:46
@ RZ_HPPA_RSSEL
Definition: libhppa.h:44
@ RZ_HPPA_LSSEL
Definition: libhppa.h:43
@ RZ_HPPA_RRSEL
Definition: libhppa.h:50
@ RZ_HPPA_LTPSEL
Definition: libhppa.h:60
@ RZ_HPPA_NLSEL
Definition: libhppa.h:52
@ RZ_HPPA_FSEL
Definition: libhppa.h:42
@ RZ_HPPA_LTSEL
Definition: libhppa.h:58
@ RZ_HPPA_RDSEL
Definition: libhppa.h:48
@ RZ_HPPA_LPSEL
Definition: libhppa.h:55
@ RZ_HPPA_RPSEL
Definition: libhppa.h:56
@ RZ_HPPA_RTPSEL
Definition: libhppa.h:61

◆ hppa_reloc_field_selector_type_alt

Enumerator
e_fsel 
e_lssel 
e_rssel 
e_lsel 
e_rsel 
e_ldsel 
e_rdsel 
e_lrsel 
e_rrsel 
e_nsel 
e_nlsel 
e_nlrsel 
e_psel 
e_lpsel 
e_rpsel 
e_tsel 
e_ltsel 
e_rtsel 
e_ltpsel 
e_rtpsel 

Definition at line 95 of file libhppa.h.

95  {
116 };
@ e_rsel
Definition: libhppa.h:100
@ e_tsel
Definition: libhppa.h:111
@ e_rtpsel
Definition: libhppa.h:115
@ e_ltsel
Definition: libhppa.h:112
@ e_nlsel
Definition: libhppa.h:106
@ e_lpsel
Definition: libhppa.h:109
@ e_rdsel
Definition: libhppa.h:102
@ e_nsel
Definition: libhppa.h:105
@ e_rtsel
Definition: libhppa.h:113
@ e_rssel
Definition: libhppa.h:98
@ e_lsel
Definition: libhppa.h:99
@ e_ldsel
Definition: libhppa.h:101
@ e_psel
Definition: libhppa.h:108
@ e_rpsel
Definition: libhppa.h:110
@ e_ltpsel
Definition: libhppa.h:114
@ e_fsel
Definition: libhppa.h:96
@ e_nlrsel
Definition: libhppa.h:107
@ e_lssel
Definition: libhppa.h:97
@ e_lrsel
Definition: libhppa.h:103
@ e_rrsel
Definition: libhppa.h:104

◆ pa_arch

enum pa_arch
Enumerator
pa10 
pa11 
pa20 
pa20w 

Definition at line 34 of file libhppa.h.

34  { pa10 = 10,
35  pa11 = 11,
36  pa20 = 20,
37  pa20w = 25 };
@ pa20
Definition: libhppa.h:36
@ pa11
Definition: libhppa.h:35
@ pa20w
Definition: libhppa.h:37
@ pa10
Definition: libhppa.h:34

Function Documentation

◆ bfd_hppa_insn2fmt()

static int bfd_hppa_insn2fmt ( bfd abfd,
int  insn 
)
inlinestatic

Definition at line 429 of file libhppa.h.

429  {
430  enum hppa_opcode_type op = get_opcode(insn);
431 
432  switch (op) {
433  case OP_COMICLR:
434  case OP_SUBI:
435  case OP_ADDIT:
436  case OP_ADDI:
437  return 11;
438 
439  case OP_COMBT:
440  case OP_COMIBT:
441  case OP_COMBF:
442  case OP_COMIBF:
443  case OP_CMPBDT:
444  case OP_ADDBT:
445  case OP_ADDIBT:
446  case OP_ADDBF:
447  case OP_ADDIBF:
448  case OP_CMPBDF:
449  case OP_BVB:
450  case OP_BB:
451  case OP_MOVB:
452  case OP_MOVIB:
453  case OP_CMPIBD:
454  return 12;
455 
456  case OP_LDO:
457  case OP_LDB:
458  case OP_LDH:
459  case OP_LDW:
460  case OP_LDWM:
461  case OP_STB:
462  case OP_STH:
463  case OP_STW:
464  case OP_STWM:
465  if (abfd->arch_info->mach >= 25)
466  return 16; /* Wide mode, format 16. */
467  return 14;
468 
469  case OP_FLDW:
470  case OP_LDWL:
471  case OP_FSTW:
472  case OP_STWL:
473  /* This is a hack. Unfortunately, format 11 is already taken
474  and we're using integers rather than an enum, so it's hard
475  to describe the 11a format. */
476  if (abfd->arch_info->mach >= 25)
477  return -16; /* Wide mode, format 16a. */
478  return -11;
479 
480  case OP_LDD:
481  case OP_STD:
482  if (abfd->arch_info->mach >= 25)
483  return -10; /* Wide mode, format 10a. */
484  return 10;
485 
486  case OP_BL:
487  if ((insn & 0x8000) != 0)
488  return 22;
489  /* fall thru */
490  case OP_BE:
491  case OP_BLE:
492  return 17;
493 
494  case OP_LDIL:
495  case OP_ADDIL:
496  return 21;
497 
498  default:
499  break;
500  }
501  return 32;
502 }
hppa_opcode_type
Definition: libhppa.h:350
#define get_opcode(insn)
Definition: libhppa.h:348
unsigned long mach
Definition: mybfd.h:1890
const struct bfd_arch_info * arch_info
Definition: mybfd.h:4306
Definition: dis.c:32

References bfd::arch_info, get_opcode, bfd_arch_info::mach, OP_ADDBF, OP_ADDBT, OP_ADDI, OP_ADDIBF, OP_ADDIBT, OP_ADDIL, OP_ADDIT, OP_BB, OP_BE, OP_BL, OP_BLE, OP_BVB, OP_CMPBDF, OP_CMPBDT, OP_CMPIBD, OP_COMBF, OP_COMBT, OP_COMIBF, OP_COMIBT, OP_COMICLR, OP_FLDW, OP_FSTW, OP_LDB, OP_LDD, OP_LDH, OP_LDIL, OP_LDO, OP_LDW, OP_LDWL, OP_LDWM, OP_MOVB, OP_MOVIB, OP_STB, OP_STD, OP_STH, OP_STW, OP_STWL, OP_STWM, and OP_SUBI.

◆ hppa_field_adjust()

static bfd_signed_vma hppa_field_adjust ( bfd_vma  sym_val,
bfd_signed_vma  addend,
enum hppa_reloc_field_selector_type_alt  rz_field 
)
inlinestatic

Definition at line 267 of file libhppa.h.

269  {
271 
272  value = sym_val + addend;
273  switch (rz_field) {
274  case e_fsel:
275  /* F: No change. */
276  break;
277 
278  case e_nsel:
279  /* N: null selector. I don't really understand what this is all
280  about, but HP's documentation says "this indicates that zero
281  bits are to be used for the displacement on the instruction.
282  This fixup is used to identify three-instruction sequences to
283  access data (for importing shared library data)." */
284  value = 0;
285  break;
286 
287  case e_lsel:
288  case e_nlsel:
289  /* L: Select top 21 bits. */
290  value = value >> 11;
291  break;
292 
293  case e_rsel:
294  /* R: Select bottom 11 bits. */
295  value = value & 0x7ff;
296  break;
297 
298  case e_lssel:
299  /* LS: Round to nearest multiple of 2048 then select top 21 bits. */
300  value = value + 0x400;
301  value = value >> 11;
302  break;
303 
304  case e_rssel:
305  /* RS: Select bottom 11 bits for LS.
306  We need to return a value such that 2048 * LS'x + RS'x == x.
307  ie. RS'x = x - ((x + 0x400) & -0x800)
308  this is just a sign extension from bit 21. */
309  value = ((value & 0x7ff) ^ 0x400) - 0x400;
310  break;
311 
312  case e_ldsel:
313  /* LD: Round to next multiple of 2048 then select top 21 bits.
314  Yes, if we are already on a multiple of 2048, we go up to the
315  next one. RD in this case will be -2048. */
316  value = value + 0x800;
317  value = value >> 11;
318  break;
319 
320  case e_rdsel:
321  /* RD: Set bits 0-20 to one. */
322  value = value | -0x800;
323  break;
324 
325  case e_lrsel:
326  case e_nlrsel:
327  /* LR: L with rounding of the addend to nearest 8k. */
328  value = sym_val + ((addend + 0x1000) & -0x2000);
329  value = value >> 11;
330  break;
331 
332  case e_rrsel:
333  /* RR: R with rounding of the addend to nearest 8k.
334  We need to return a value such that 2048 * LR'x + RR'x == x
335  ie. RR'x = s+a - (s + (((a + 0x1000) & -0x2000) & -0x800))
336  . = s+a - ((s & -0x800) + ((a + 0x1000) & -0x2000))
337  . = (s & 0x7ff) + a - ((a + 0x1000) & -0x2000) */
338  value = (sym_val & 0x7ff) + (((addend & 0x1fff) ^ 0x1000) - 0x1000);
339  break;
340 
341  default:
342  return -1;
343  }
344  return value;
345 }
static int value
Definition: cmd_api.c:93
BFD_HOST_64_BIT bfd_signed_vma
Definition: mybfd.h:112

References e_fsel, e_ldsel, e_lrsel, e_lsel, e_lssel, e_nlrsel, e_nlsel, e_nsel, e_rdsel, e_rrsel, e_rsel, e_rssel, and value.

◆ hppa_rebuild_insn()

static int hppa_rebuild_insn ( int  insn,
int  value,
int  rz_format 
)
inlinestatic

Definition at line 508 of file libhppa.h.

508  {
509  switch (rz_format) {
510  case 11:
511  return (insn & ~0x7ff) | low_sign_unext(value, 11);
512 
513  case 12:
514  return (insn & ~0x1ffd) | re_assemble_12(value);
515 
516  case 10:
517  return (insn & ~0x3ff1) | re_assemble_14(value & -8);
518 
519  case -11:
520  return (insn & ~0x3ff9) | re_assemble_14(value & -4);
521 
522  case 14:
523  return (insn & ~0x3fff) | re_assemble_14(value);
524 
525  case -10:
526  return (insn & ~0xfff1) | re_assemble_16(value & -8);
527 
528  case -16:
529  return (insn & ~0xfff9) | re_assemble_16(value & -4);
530 
531  case 16:
532  return (insn & ~0xffff) | re_assemble_16(value);
533 
534  case 17:
535  return (insn & ~0x1f1ffd) | re_assemble_17(value);
536 
537  case 21:
538  return (insn & ~0x1fffff) | re_assemble_21(value);
539 
540  case 22:
541  return (insn & ~0x3ff1ffd) | re_assemble_22(value);
542 
543  case 32:
544  return value;
545 
546  default:
547  return -1;
548  }
549  return insn;
550 }
static int re_assemble_12(int) ATTRIBUTE_UNUSED
Definition: libhppa.h:222
static int re_assemble_21(int) ATTRIBUTE_UNUSED
Definition: libhppa.h:247
static int re_assemble_17(int) ATTRIBUTE_UNUSED
Definition: libhppa.h:242
static int low_sign_unext(int, int) ATTRIBUTE_UNUSED
Definition: libhppa.h:205
static int re_assemble_16(int) ATTRIBUTE_UNUSED
Definition: libhppa.h:232
static int re_assemble_14(int) ATTRIBUTE_UNUSED
Definition: libhppa.h:227
static int re_assemble_22(int) ATTRIBUTE_UNUSED
Definition: libhppa.h:252

References low_sign_unext(), re_assemble_12(), re_assemble_14(), re_assemble_16(), re_assemble_17(), re_assemble_21(), re_assemble_22(), and value.

◆ low_sign_extend()

static int low_sign_extend ( int  x,
int  len 
)
inlinestatic

Definition at line 187 of file libhppa.h.

187  {
188  return (x >> 1) - ((x & 1) << (len - 1));
189 }
size_t len
Definition: 6502dis.c:15
int x
Definition: mipsasm.c:20

References len, and x.

Referenced by extract_11(), extract_14(), extract_5_load(), and extract_5_store().

◆ low_sign_unext()

static int low_sign_unext ( int  x,
int  len 
)
inlinestatic

Definition at line 205 of file libhppa.h.

205  {
206  int temp;
207  int sign;
208 
209  sign = (x >> (len - 1)) & 1;
210 
211  temp = sign_unext(x, len - 1);
212 
213  return (temp << 1) | sign;
214 }
static int sign_unext(int, int) ATTRIBUTE_UNUSED
Definition: libhppa.h:196

References len, sign_unext(), and x.

Referenced by hppa_rebuild_insn().

◆ re_assemble_12()

static int re_assemble_12 ( int  as12)
inlinestatic

Definition at line 222 of file libhppa.h.

222  {
223  return (((as12 & 0x800) >> 11) | ((as12 & 0x400) >> (10 - 2)) | ((as12 & 0x3ff) << (1 + 2)));
224 }

Referenced by hppa_rebuild_insn().

◆ re_assemble_14()

static int re_assemble_14 ( int  as14)
inlinestatic

Definition at line 227 of file libhppa.h.

227  {
228  return (((as14 & 0x1fff) << 1) | ((as14 & 0x2000) >> 13));
229 }

Referenced by hppa_rebuild_insn().

◆ re_assemble_16()

static int re_assemble_16 ( int  as16)
inlinestatic

Definition at line 232 of file libhppa.h.

232  {
233  int s, t;
234 
235  /* Unusual 16-bit encoding, for wide mode only. */
236  t = (as16 << 1) & 0xffff;
237  s = (as16 & 0x8000);
238  return (t ^ s ^ (s >> 1)) | (s >> 15);
239 }
static RzSocket * s
Definition: rtr.c:28

References s.

Referenced by hppa_rebuild_insn().

◆ re_assemble_17()

static int re_assemble_17 ( int  as17)
inlinestatic

Definition at line 242 of file libhppa.h.

242  {
243  return (((as17 & 0x10000) >> 16) | ((as17 & 0x0f800) << (16 - 11)) | ((as17 & 0x00400) >> (10 - 2)) | ((as17 & 0x003ff) << (1 + 2)));
244 }

Referenced by hppa_rebuild_insn().

◆ re_assemble_21()

static int re_assemble_21 ( int  as21)
inlinestatic

Definition at line 247 of file libhppa.h.

247  {
248  return (((as21 & 0x100000) >> 20) | ((as21 & 0x0ffe00) >> 8) | ((as21 & 0x000180) << 7) | ((as21 & 0x00007c) << 14) | ((as21 & 0x000003) << 12));
249 }

Referenced by hppa_rebuild_insn().

◆ re_assemble_22()

static int re_assemble_22 ( int  as22)
inlinestatic

Definition at line 252 of file libhppa.h.

252  {
253  return (((as22 & 0x200000) >> 21) | ((as22 & 0x1f0000) << (21 - 16)) | ((as22 & 0x00f800) << (16 - 11)) | ((as22 & 0x000400) >> (10 - 2)) | ((as22 & 0x0003ff) << (1 + 2)));
254 }

Referenced by hppa_rebuild_insn().

◆ re_assemble_3()

static int re_assemble_3 ( int  as3)
inlinestatic

Definition at line 217 of file libhppa.h.

217  {
218  return (((as3 & 4) << (13 - 2)) | ((as3 & 3) << (13 + 1)));
219 }

◆ sign_extend()

static int sign_extend ( int  x,
int  len 
)
inlinestatic

Definition at line 180 of file libhppa.h.

180  {
181  int signbit = (1 << (len - 1));
182  int mask = (signbit << 1) - 1;
183  return ((x & mask) ^ signbit) - signbit;
184 }
#define mask()

References len, mask, and x.

◆ sign_unext()

static int sign_unext ( int  x,
int  len 
)
inlinestatic

Definition at line 196 of file libhppa.h.

196  {
197  int len_ones;
198 
199  len_ones = (1 << len) - 1;
200 
201  return x & len_ones;
202 }

References len, and x.

Referenced by low_sign_unext().