Home | History | Annotate | Line # | Download | only in unwind
decode.h revision 1.1.10.2
      1  1.1.10.2  tron /*	$NetBSD: decode.h,v 1.1.10.2 2006/05/24 15:48:09 tron Exp $	*/
      2  1.1.10.2  tron 
      3  1.1.10.2  tron /* Contributed to the NetBSD Foundation by Cherry G. Mathew <cherry (at) mahiti.org>
      4  1.1.10.2  tron  * This file contains prototypes to decode unwind descriptors.
      5  1.1.10.2  tron  */
      6  1.1.10.2  tron 
      7  1.1.10.2  tron #define MAXSTATERECS 20	/* The maximum number of descriptor records per region */
      8  1.1.10.2  tron 
      9  1.1.10.2  tron #define IS_R1(byte) (( (byte) & 0xc0) == 0)
     10  1.1.10.2  tron #define IS_R2(byte) (((byte) & 0xf8) == 0x40)
     11  1.1.10.2  tron #define IS_R3(byte) (((byte) & 0xfc) == 0x60)
     12  1.1.10.2  tron #define IS_P1(byte) (((byte) & 0xe0) == 0x80)
     13  1.1.10.2  tron #define IS_P2(byte) (((byte) & 0xf0) == 0xa0)
     14  1.1.10.2  tron #define IS_P3(byte) (((byte) & 0xf8) == 0xb0)
     15  1.1.10.2  tron #define IS_P4(byte) ((byte) == (char) 0xb8)
     16  1.1.10.2  tron #define IS_P5(byte) ((byte) == (char) 0xb9)
     17  1.1.10.2  tron #define IS_P6(byte) (((byte) & 0xe0) == 0xc0)
     18  1.1.10.2  tron #define IS_P7(byte) (((byte) & 0xf0) == 0xe0)
     19  1.1.10.2  tron #define IS_P8(byte) ((byte) == (char) 0xf0)
     20  1.1.10.2  tron #define IS_P9(byte) ((byte) == (char) 0xf1)
     21  1.1.10.2  tron #define IS_P10(byte) ((byte) ==(char) 0xff)
     22  1.1.10.2  tron #define IS_B1(byte) (((byte) & 0xc0) == 0x80)
     23  1.1.10.2  tron #define IS_B2(byte) (((byte) & 0xe0) == 0xc0)
     24  1.1.10.2  tron #define IS_B3(byte) ((byte) == (char) 0xe0)
     25  1.1.10.2  tron #define IS_B4(byte) (((byte) & 0xf7) == 0xf0)
     26  1.1.10.2  tron #define IS_X1(byte) ((byte) == (char) 0xf9)
     27  1.1.10.2  tron #define IS_X2(byte) ((byte) == (char) 0xfa)
     28  1.1.10.2  tron #define IS_X3(byte) ((byte) == (char) 0xfb)
     29  1.1.10.2  tron #define IS_X4(byte) ((byte) == (char) 0xfc)
     30  1.1.10.2  tron 
     31  1.1.10.2  tron struct unwind_desc_R1 {
     32  1.1.10.2  tron 	boolean_t r;
     33  1.1.10.2  tron 	vsize_t rlen;
     34  1.1.10.2  tron };
     35  1.1.10.2  tron 
     36  1.1.10.2  tron struct unwind_desc_R2 {
     37  1.1.10.2  tron 	u_int mask;
     38  1.1.10.2  tron #define R2MASKRP	0x8
     39  1.1.10.2  tron #define R2MASKPFS	0x4
     40  1.1.10.2  tron #define R2MASKPSP	0x2
     41  1.1.10.2  tron 
     42  1.1.10.2  tron 	u_int grsave;
     43  1.1.10.2  tron 	vsize_t rlen;
     44  1.1.10.2  tron };
     45  1.1.10.2  tron 
     46  1.1.10.2  tron struct unwind_desc_R3 {
     47  1.1.10.2  tron 	boolean_t r;
     48  1.1.10.2  tron 	vsize_t rlen;
     49  1.1.10.2  tron };
     50  1.1.10.2  tron 
     51  1.1.10.2  tron struct unwind_desc_P1 {
     52  1.1.10.2  tron 	u_int brmask;
     53  1.1.10.2  tron };
     54  1.1.10.2  tron 
     55  1.1.10.2  tron struct unwind_desc_P2 {
     56  1.1.10.2  tron 	u_int brmask;
     57  1.1.10.2  tron 	u_int gr;
     58  1.1.10.2  tron };
     59  1.1.10.2  tron 
     60  1.1.10.2  tron struct unwind_desc_P3 {
     61  1.1.10.2  tron 	u_int r;
     62  1.1.10.2  tron 	u_int grbr;
     63  1.1.10.2  tron };
     64  1.1.10.2  tron 
     65  1.1.10.2  tron struct unwind_desc_P4 {
     66  1.1.10.2  tron 	vsize_t imask;
     67  1.1.10.2  tron };
     68  1.1.10.2  tron 
     69  1.1.10.2  tron struct unwind_desc_P5 {
     70  1.1.10.2  tron 	u_int grmask;
     71  1.1.10.2  tron 	u_int frmask;
     72  1.1.10.2  tron };
     73  1.1.10.2  tron 
     74  1.1.10.2  tron struct unwind_desc_P6 {
     75  1.1.10.2  tron 	boolean_t r;
     76  1.1.10.2  tron 	u_int rmask;
     77  1.1.10.2  tron };
     78  1.1.10.2  tron 
     79  1.1.10.2  tron struct unwind_desc_P7 {
     80  1.1.10.2  tron 	u_int r;
     81  1.1.10.2  tron 	vsize_t t;
     82  1.1.10.2  tron 	vsize_t size;
     83  1.1.10.2  tron };
     84  1.1.10.2  tron 
     85  1.1.10.2  tron struct unwind_desc_P8 {
     86  1.1.10.2  tron 	u_int r;
     87  1.1.10.2  tron 	vsize_t t;
     88  1.1.10.2  tron };
     89  1.1.10.2  tron 
     90  1.1.10.2  tron struct unwind_desc_P9 {
     91  1.1.10.2  tron 	u_int grmask;
     92  1.1.10.2  tron 	u_int gr;
     93  1.1.10.2  tron };
     94  1.1.10.2  tron 
     95  1.1.10.2  tron struct unwind_desc_P10 {
     96  1.1.10.2  tron 	u_int abi;
     97  1.1.10.2  tron 	u_int context;
     98  1.1.10.2  tron };
     99  1.1.10.2  tron 
    100  1.1.10.2  tron struct unwind_desc_B1 {
    101  1.1.10.2  tron 	boolean_t r;
    102  1.1.10.2  tron 	u_int label;
    103  1.1.10.2  tron };
    104  1.1.10.2  tron 
    105  1.1.10.2  tron struct unwind_desc_B2 {
    106  1.1.10.2  tron 	u_int ecount;
    107  1.1.10.2  tron 	vsize_t t;
    108  1.1.10.2  tron };
    109  1.1.10.2  tron 
    110  1.1.10.2  tron struct unwind_desc_B3 {
    111  1.1.10.2  tron 	vsize_t t;
    112  1.1.10.2  tron 	vsize_t ecount;
    113  1.1.10.2  tron };
    114  1.1.10.2  tron 
    115  1.1.10.2  tron struct unwind_desc_B4 {
    116  1.1.10.2  tron 	boolean_t r;
    117  1.1.10.2  tron 	vsize_t label;
    118  1.1.10.2  tron };
    119  1.1.10.2  tron 
    120  1.1.10.2  tron struct unwind_desc_X1 {
    121  1.1.10.2  tron 	boolean_t r;
    122  1.1.10.2  tron 	boolean_t a;
    123  1.1.10.2  tron 	boolean_t b;
    124  1.1.10.2  tron 	u_int reg;
    125  1.1.10.2  tron 	vsize_t t;
    126  1.1.10.2  tron 	vsize_t offset;
    127  1.1.10.2  tron };
    128  1.1.10.2  tron 
    129  1.1.10.2  tron struct unwind_desc_X2 {
    130  1.1.10.2  tron 	boolean_t x;
    131  1.1.10.2  tron 	boolean_t a;
    132  1.1.10.2  tron 	boolean_t b;
    133  1.1.10.2  tron 	u_int reg;
    134  1.1.10.2  tron 	boolean_t y;
    135  1.1.10.2  tron 	u_int treg;
    136  1.1.10.2  tron 	vsize_t t;
    137  1.1.10.2  tron };
    138  1.1.10.2  tron 
    139  1.1.10.2  tron 
    140  1.1.10.2  tron 
    141  1.1.10.2  tron struct unwind_desc_X3 {
    142  1.1.10.2  tron 	boolean_t r;
    143  1.1.10.2  tron 	u_int qp;
    144  1.1.10.2  tron 	boolean_t a;
    145  1.1.10.2  tron 	boolean_t b;
    146  1.1.10.2  tron 	u_int reg;
    147  1.1.10.2  tron 	vsize_t t;
    148  1.1.10.2  tron 	vsize_t offset;
    149  1.1.10.2  tron };
    150  1.1.10.2  tron 
    151  1.1.10.2  tron struct unwind_desc_X4 {
    152  1.1.10.2  tron 	u_int qp;
    153  1.1.10.2  tron 	boolean_t x;
    154  1.1.10.2  tron 	boolean_t a;
    155  1.1.10.2  tron 	boolean_t b;
    156  1.1.10.2  tron 	u_int reg;
    157  1.1.10.2  tron 	boolean_t y;
    158  1.1.10.2  tron 	u_int treg;
    159  1.1.10.2  tron 	vsize_t t;
    160  1.1.10.2  tron };
    161  1.1.10.2  tron 
    162  1.1.10.2  tron union unwind_desc {
    163  1.1.10.2  tron 	struct unwind_desc_R1 R1;
    164  1.1.10.2  tron 	struct unwind_desc_R2 R2;
    165  1.1.10.2  tron 	struct unwind_desc_R3 R3;
    166  1.1.10.2  tron 
    167  1.1.10.2  tron 	struct unwind_desc_P1 P1;
    168  1.1.10.2  tron 	struct unwind_desc_P2 P2;
    169  1.1.10.2  tron 	struct unwind_desc_P3 P3;
    170  1.1.10.2  tron 	struct unwind_desc_P4 P4;
    171  1.1.10.2  tron 	struct unwind_desc_P5 P5;
    172  1.1.10.2  tron 	struct unwind_desc_P6 P6;
    173  1.1.10.2  tron 	struct unwind_desc_P7 P7;
    174  1.1.10.2  tron 	struct unwind_desc_P8 P8;
    175  1.1.10.2  tron 	struct unwind_desc_P9 P9;
    176  1.1.10.2  tron 	struct unwind_desc_P10 P10;
    177  1.1.10.2  tron 
    178  1.1.10.2  tron 	struct unwind_desc_B1 B1;
    179  1.1.10.2  tron 	struct unwind_desc_B2 B2;
    180  1.1.10.2  tron 	struct unwind_desc_B3 B3;
    181  1.1.10.2  tron 	struct unwind_desc_B4 B4;
    182  1.1.10.2  tron 
    183  1.1.10.2  tron 	struct unwind_desc_X1 X1;
    184  1.1.10.2  tron 	struct unwind_desc_X2 X2;
    185  1.1.10.2  tron 	struct unwind_desc_X3 X3;
    186  1.1.10.2  tron 	struct unwind_desc_X4 X4;
    187  1.1.10.2  tron };
    188  1.1.10.2  tron 
    189  1.1.10.2  tron enum record_type {
    190  1.1.10.2  tron 	R1, R2, R3,
    191  1.1.10.2  tron 	P1, P2, P3, P4, P5, P6, P7, P8, P9, P10,
    192  1.1.10.2  tron 	B1, B2, B3, B4,
    193  1.1.10.2  tron 	X1, X2, X3, X4
    194  1.1.10.2  tron };
    195  1.1.10.2  tron 
    196  1.1.10.2  tron 
    197  1.1.10.2  tron /* A record chain is a decoded unwind descriptor.
    198  1.1.10.2  tron  * It is usefull for post processing unwind descriptors.
    199  1.1.10.2  tron  */
    200  1.1.10.2  tron 
    201  1.1.10.2  tron struct recordchain {
    202  1.1.10.2  tron 	enum record_type type;
    203  1.1.10.2  tron 	union unwind_desc udesc;
    204  1.1.10.2  tron };
    205  1.1.10.2  tron 
    206  1.1.10.2  tron 
    207  1.1.10.2  tron 
    208  1.1.10.2  tron /* Decode Function prototypes. */
    209  1.1.10.2  tron 
    210  1.1.10.2  tron char *
    211  1.1.10.2  tron unwind_decode_ule128(char *buf, unsigned long *);
    212  1.1.10.2  tron char *
    213  1.1.10.2  tron unwind_decode_R1(char *buf, union unwind_desc *uwd);
    214  1.1.10.2  tron char *
    215  1.1.10.2  tron unwind_decode_R2(char *buf, union unwind_desc *uwd);
    216  1.1.10.2  tron char *
    217  1.1.10.2  tron unwind_decode_R3(char *buf, union unwind_desc *uwd);
    218  1.1.10.2  tron char *
    219  1.1.10.2  tron unwind_decode_P1(char *buf, union unwind_desc *uwd);
    220  1.1.10.2  tron char *
    221  1.1.10.2  tron unwind_decode_P2(char *buf, union unwind_desc *uwd);
    222  1.1.10.2  tron char *
    223  1.1.10.2  tron unwind_decode_P3(char *buf, union unwind_desc *uwd);
    224  1.1.10.2  tron char *
    225  1.1.10.2  tron unwind_decode_P4(char *buf, union unwind_desc *uwd, vsize_t len);
    226  1.1.10.2  tron char *
    227  1.1.10.2  tron unwind_decode_P5(char *buf, union unwind_desc *uwd);
    228  1.1.10.2  tron char *
    229  1.1.10.2  tron unwind_decode_P6(char *buf, union unwind_desc *uwd);
    230  1.1.10.2  tron char *
    231  1.1.10.2  tron unwind_decode_P7(char *buf, union unwind_desc *uwd);
    232  1.1.10.2  tron char *
    233  1.1.10.2  tron unwind_decode_P8(char *buf, union unwind_desc *uwd);
    234  1.1.10.2  tron char *
    235  1.1.10.2  tron unwind_decode_P9(char *buf, union unwind_desc *uwd);
    236  1.1.10.2  tron char *
    237  1.1.10.2  tron unwind_decode_P10(char *buf, union unwind_desc *uwd);
    238  1.1.10.2  tron char *
    239  1.1.10.2  tron unwind_decode_B1(char *buf, union unwind_desc *uwd);
    240  1.1.10.2  tron char *
    241  1.1.10.2  tron unwind_decode_B2(char *buf, union unwind_desc *uwd);
    242  1.1.10.2  tron char *
    243  1.1.10.2  tron unwind_decode_B3(char *buf, union unwind_desc *uwd);
    244  1.1.10.2  tron char *
    245  1.1.10.2  tron unwind_decode_B4(char *buf, union unwind_desc *uwd);
    246  1.1.10.2  tron char *
    247  1.1.10.2  tron unwind_decode_X1(char *buf, union unwind_desc *uwd);
    248  1.1.10.2  tron char *
    249  1.1.10.2  tron unwind_decode_X2(char *buf, union unwind_desc *uwd);
    250  1.1.10.2  tron char *
    251  1.1.10.2  tron unwind_decode_X3(char *buf, union unwind_desc *uwd);
    252  1.1.10.2  tron char *
    253  1.1.10.2  tron unwind_decode_X4(char *buf, union unwind_desc *uwd);
    254  1.1.10.2  tron 
    255  1.1.10.2  tron 
    256  1.1.10.2  tron 
    257  1.1.10.2  tron 
    258  1.1.10.2  tron 
    259  1.1.10.2  tron 
    260