golang.org/x/arch@v0.17.0/ppc64/ppc64util/hack.h (about)

     1  // Copyright 2021 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  //
     5  // This file requires gcc and binutils with -mcpu=power10 support.
     6  // ppc64util runs a series of commands like:
     7  //   go run map.go -fmt=asm ../pp64.csv > asm.S
     8  //   powerpc64le-linux-gnu-gcc -c asm.S -mcpu=power10 -mbig
     9  //   powerpc64le-linux-gnu-objdump -d asm.o
    10  // to create the file decode_generated.txt used to verify the disassembler.
    11  //
    12  // Note, the golang disassembler is not expected to support every extended
    13  // mnemonic, but it should support those which frequently show up in object
    14  // files compiled by the golang toolchain.
    15  
    16  #define RA 1
    17  #define RB 2
    18  #define RS 3
    19  #define RT 4
    20  #define RC 5
    21  #define RSp 6
    22  #define RTp 8
    23  
    24  #define MB 1
    25  #define ME 7
    26  #define NB 2
    27  #define CY 1
    28  
    29  #define LEV 1
    30  
    31  #define FRBp 2
    32  #define FRAp 4
    33  #define FRTp 6
    34  #define FRSp 8
    35  #define FRT 3
    36  #define FRA 5
    37  #define FRB 7
    38  #define FRC 9
    39  #define FRS 11
    40  #define FLM 8
    41  #define U 3
    42  #define W 0
    43  #define TE 15
    44  #define SP 1
    45  #define S 1
    46  #define DRM 0x7
    47  #define RM 0x3
    48  
    49  #define BF 3
    50  #define SH 7
    51  
    52  #define XT 33
    53  #define XA 35
    54  #define XB 37
    55  #define XS 39
    56  #define XC 41
    57  #define XAp 36
    58  #define XTp 38
    59  #define XSp 40
    60  #define DM 1
    61  #define SHW 2
    62  
    63  #define VRA 1
    64  #define VRB 2
    65  #define VRC 3
    66  #define VRT 4
    67  #define VRS 5
    68  #define SHB 3
    69  #define SIX 1
    70  #define ST 1
    71  #define PS 0
    72  #define MP 1
    73  #define bm 0x45FF
    74  #define N 3
    75  
    76  #define AT 7
    77  #define AS 6
    78  
    79  #define RMC 3
    80  
    81  #define UIM 1
    82  #define DCMX 0x23
    83  #define DCM 0x11
    84  #define DGM 0x11
    85  #define R 1
    86  
    87  #define BA 1
    88  #define BB 2
    89  #define BT 3
    90  #define BO 4
    91  #define BI 6
    92  #define BH 0
    93  #define BFA 7
    94  #define FXM 8
    95  #define BC 11
    96  
    97  #define L 1
    98  #define EH 1
    99  
   100  #define SPR 69
   101  #define BHRBE 69
   102  #define TO 0x11
   103  #define TBR 268
   104  #define CT 2
   105  #define FC 2
   106  #define TH 3
   107  #define WC 1
   108  #define PL 0
   109  #define IH 4
   110  #define RIC 1
   111  #define PRS 1
   112  
   113  #define SIM 6
   114  #define IMM 13
   115  #define IMM8 14
   116  #define D 0x80
   117  #define SC 1
   118  
   119  #define target_addr 0x690
   120  
   121  #define XMSK 0x9
   122  #define YMSK 0x3
   123  #define PMSK 0x2
   124  
   125  #define IX 1
   126  #define IMM32 0x1234567
   127  #define Dpfx 0x160032
   128  #define RApfx 0x0
   129  #define Rpfx 1
   130  #define SIpfx 0xFFFFFFFE00010007
   131  
   132  // A valid displacement value for the hash check and hash store instructions.
   133  #define offset -128
   134  
   135  // These decode as m.fpr* or m.vr*.  This is a matter of preference.  We
   136  // don't support these mnemonics, and I don't think they improve reading
   137  // disassembled code in most cases. so ignore.
   138  //
   139  // Likewise, if you add to this list, add tests to decode.txt to ensure we
   140  // still test these, while ignoring the extended mnemonics which get
   141  // generated.
   142  #define mfvsrd xsrsp
   143  #define mfvsrwz xsrsp
   144  #define mtvsrd xsrsp
   145  #define mtvsrwz xsrsp
   146  #define mtvsrwa xsrsp
   147  
   148  // isel BC bit is not decoded like other BC fields.
   149  // A special test case is added to decode.txt to verify this.
   150  // We decode it like other BC fields.
   151  #define isel rldicl
   152  
   153  
   154  // Likewise, these are obscure book ii instructions with extended mnemonics
   155  // which are almost guaranteed never to show up in go code
   156  #define dcbf add
   157  #define sync xsrsp
   158  #define wait xsrsp
   159  #define rfebb sc
   160  
   161  // sync 1,1 is the stncisync extended mnemonic.  Similar to the above, but
   162  // the lwsync/hwsync extended mnemonics are tested in decode.txt
   163  #define sync xsrsp