diff options
Diffstat (limited to 'sim/m32r/cpu.h')
-rw-r--r-- | sim/m32r/cpu.h | 656 |
1 files changed, 213 insertions, 443 deletions
diff --git a/sim/m32r/cpu.h b/sim/m32r/cpu.h index 6ebe199..fa475d5 100644 --- a/sim/m32r/cpu.h +++ b/sim/m32r/cpu.h @@ -117,317 +117,109 @@ typedef struct { int empty; } MODEL_TEST_DATA; +/* Instruction argument buffer. */ + union sem_fields { - struct { /* empty sformat for unspecified field list */ - int empty; - } fmt_empty; - struct { /* e.g. add $dr,$sr */ - SI * i_dr; - SI * i_sr; - unsigned char in_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_add; - struct { /* e.g. add3 $dr,$sr,$hash$slo16 */ - INT f_simm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_add3; - struct { /* e.g. and3 $dr,$sr,$uimm16 */ - UINT f_uimm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_and3; - struct { /* e.g. or3 $dr,$sr,$hash$ulo16 */ - UINT f_uimm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_or3; - struct { /* e.g. addi $dr,$simm8 */ - INT f_simm8; - SI * i_dr; - unsigned char in_dr; - unsigned char out_dr; - } fmt_addi; - struct { /* e.g. addv $dr,$sr */ - SI * i_dr; - SI * i_sr; - unsigned char in_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_addv; - struct { /* e.g. addv3 $dr,$sr,$simm16 */ - INT f_simm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_addv3; - struct { /* e.g. addx $dr,$sr */ - SI * i_dr; - SI * i_sr; - unsigned char in_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_addx; - struct { /* e.g. cmp $src1,$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_cmp; - struct { /* e.g. cmpi $src2,$simm16 */ - INT f_simm16; - SI * i_src2; - unsigned char in_src2; - } fmt_cmpi; - struct { /* e.g. div $dr,$sr */ - SI * i_dr; - SI * i_sr; - unsigned char in_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_div; - struct { /* e.g. ld $dr,@$sr */ - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_ld; - struct { /* e.g. ld $dr,@($slo16,$sr) */ - INT f_simm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_ld_d; - struct { /* e.g. ldb $dr,@$sr */ - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_ldb; - struct { /* e.g. ldb $dr,@($slo16,$sr) */ - INT f_simm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_ldb_d; - struct { /* e.g. ldh $dr,@$sr */ - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_ldh; - struct { /* e.g. ldh $dr,@($slo16,$sr) */ - INT f_simm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_ldh_d; - struct { /* e.g. ld $dr,@$sr+ */ - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - unsigned char out_sr; - } fmt_ld_plus; - struct { /* e.g. ld24 $dr,$uimm24 */ - ADDR i_uimm24; - SI * i_dr; - unsigned char out_dr; - } fmt_ld24; - struct { /* e.g. ldi8 $dr,$simm8 */ - INT f_simm8; - SI * i_dr; - unsigned char out_dr; - } fmt_ldi8; - struct { /* e.g. ldi16 $dr,$hash$slo16 */ - INT f_simm16; - SI * i_dr; - unsigned char out_dr; - } fmt_ldi16; - struct { /* e.g. lock $dr,@$sr */ - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_lock; - struct { /* e.g. machi $src1,$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_machi; - struct { /* e.g. mulhi $src1,$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_mulhi; - struct { /* e.g. mv $dr,$sr */ - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_mv; - struct { /* e.g. mvfachi $dr */ - SI * i_dr; - unsigned char out_dr; - } fmt_mvfachi; - struct { /* e.g. mvfc $dr,$scr */ - UINT f_r2; - SI * i_dr; - unsigned char out_dr; - } fmt_mvfc; - struct { /* e.g. mvtachi $src1 */ - SI * i_src1; - unsigned char in_src1; - } fmt_mvtachi; - struct { /* e.g. mvtc $sr,$dcr */ - UINT f_r1; - SI * i_sr; - unsigned char in_sr; - } fmt_mvtc; - struct { /* e.g. nop */ - int empty; - } fmt_nop; - struct { /* e.g. rac */ - int empty; - } fmt_rac; - struct { /* e.g. seth $dr,$hash$hi16 */ - UINT f_hi16; - SI * i_dr; - unsigned char out_dr; - } fmt_seth; - struct { /* e.g. sll3 $dr,$sr,$simm16 */ - INT f_simm16; - SI * i_sr; - SI * i_dr; - unsigned char in_sr; - unsigned char out_dr; - } fmt_sll3; - struct { /* e.g. slli $dr,$uimm5 */ - UINT f_uimm5; - SI * i_dr; - unsigned char in_dr; - unsigned char out_dr; - } fmt_slli; - struct { /* e.g. st $src1,@$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_st; - struct { /* e.g. st $src1,@($slo16,$src2) */ - INT f_simm16; - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_st_d; - struct { /* e.g. stb $src1,@$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_stb; - struct { /* e.g. stb $src1,@($slo16,$src2) */ - INT f_simm16; - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_stb_d; - struct { /* e.g. sth $src1,@$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_sth; - struct { /* e.g. sth $src1,@($slo16,$src2) */ - INT f_simm16; - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_sth_d; - struct { /* e.g. st $src1,@+$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - unsigned char out_src2; - } fmt_st_plus; - struct { /* e.g. unlock $src1,@$src2 */ - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_unlock; - /* cti insns, kept separately so addr_cache is in fixed place */ - struct { - union { - struct { /* e.g. bc.s $disp8 */ - IADDR i_disp8; - } fmt_bc8; - struct { /* e.g. bc.l $disp24 */ - IADDR i_disp24; - } fmt_bc24; - struct { /* e.g. beq $src1,$src2,$disp16 */ - IADDR i_disp16; - SI * i_src1; - SI * i_src2; - unsigned char in_src1; - unsigned char in_src2; - } fmt_beq; - struct { /* e.g. beqz $src2,$disp16 */ - IADDR i_disp16; - SI * i_src2; - unsigned char in_src2; - } fmt_beqz; - struct { /* e.g. bl.s $disp8 */ - IADDR i_disp8; - unsigned char out_h_gr_14; - } fmt_bl8; - struct { /* e.g. bl.l $disp24 */ - IADDR i_disp24; - unsigned char out_h_gr_14; - } fmt_bl24; - struct { /* e.g. bra.s $disp8 */ - IADDR i_disp8; - } fmt_bra8; - struct { /* e.g. bra.l $disp24 */ - IADDR i_disp24; - } fmt_bra24; - struct { /* e.g. jl $sr */ - SI * i_sr; - unsigned char in_sr; - unsigned char out_h_gr_14; - } fmt_jl; - struct { /* e.g. jmp $sr */ - SI * i_sr; - unsigned char in_sr; - } fmt_jmp; - struct { /* e.g. rte */ - int empty; - } fmt_rte; - struct { /* e.g. trap $uimm4 */ - UINT f_uimm4; - } fmt_trap; - } fields; -#if WITH_SCACHE_PBB - SEM_PC addr_cache; -#endif - } cti; + struct { /* no operands */ + int empty; + } fmt_empty; + struct { /* */ + UINT f_uimm4; + } sfmt_trap; + struct { /* */ + IADDR i_disp24; + unsigned char out_h_gr_14; + } sfmt_bl24; + struct { /* */ + IADDR i_disp8; + unsigned char out_h_gr_14; + } sfmt_bl8; + struct { /* */ + SI* i_dr; + UINT f_hi16; + unsigned char out_dr; + } sfmt_seth; + struct { /* */ + SI* i_sr; + UINT f_r1; + unsigned char in_sr; + } sfmt_mvtc; + struct { /* */ + SI* i_dr; + UINT f_r2; + unsigned char out_dr; + } sfmt_mvfc; + struct { /* */ + ADDR i_uimm24; + SI* i_dr; + unsigned char out_dr; + } sfmt_ld24; + struct { /* */ + SI* i_sr; + unsigned char in_sr; + unsigned char out_h_gr_14; + } sfmt_jl; + struct { /* */ + SI* i_dr; + UINT f_uimm5; + unsigned char in_dr; + unsigned char out_dr; + } sfmt_slli; + struct { /* */ + SI* i_dr; + INT f_simm8; + unsigned char in_dr; + unsigned char out_dr; + } sfmt_addi; + struct { /* */ + SI* i_src1; + SI* i_src2; + unsigned char in_src1; + unsigned char in_src2; + unsigned char out_src2; + } sfmt_st_plus; + struct { /* */ + SI* i_src1; + SI* i_src2; + INT f_simm16; + unsigned char in_src1; + unsigned char in_src2; + } sfmt_st_d; + struct { /* */ + SI* i_dr; + SI* i_sr; + unsigned char in_sr; + unsigned char out_dr; + unsigned char out_sr; + } sfmt_ld_plus; + struct { /* */ + IADDR i_disp16; + SI* i_src1; + SI* i_src2; + unsigned char in_src1; + unsigned char in_src2; + } sfmt_beq; + struct { /* */ + SI* i_dr; + SI* i_sr; + UINT f_uimm16; + unsigned char in_sr; + unsigned char out_dr; + } sfmt_and3; + struct { /* */ + SI* i_dr; + SI* i_sr; + INT f_simm16; + unsigned char in_sr; + unsigned char out_dr; + } sfmt_add3; + struct { /* */ + SI* i_dr; + SI* i_sr; + unsigned char in_dr; + unsigned char in_sr; + unsigned char out_dr; + } sfmt_add; #if WITH_SCACHE_PBB /* Writeback handler. */ struct { @@ -449,6 +241,7 @@ union sem_fields { int insn_count; /* Next pbb to execute. */ SCACHE *next; + SCACHE *branch_target; } chain; #endif }; @@ -460,6 +253,9 @@ struct argbuf { const IDESC *idesc; char trace_p; char profile_p; + /* ??? Temporary hack for skip insns. */ + char skip_count; + char unused; /* cpu specific data follows */ union sem semantic; int written; @@ -480,13 +276,11 @@ struct scache { These define and assign the local vars that contain the insn's fields. */ #define EXTRACT_IFMT_EMPTY_VARS \ - /* Instruction fields. */ \ unsigned int length; #define EXTRACT_IFMT_EMPTY_CODE \ length = 0; \ #define EXTRACT_IFMT_ADD_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -494,13 +288,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_ADD_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_ADD3_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -509,14 +302,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_ADD3_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_simm16 = EXTRACT_INT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_AND3_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -525,14 +317,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_AND3_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_uimm16 = EXTRACT_UINT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_OR3_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -541,26 +332,24 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_OR3_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_uimm16 = EXTRACT_UINT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_uimm16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_ADDI_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ INT f_simm8; \ unsigned int length; #define EXTRACT_IFMT_ADDI_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_simm8 = EXTRACT_INT (insn, 16, 8, 8); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_simm8 = EXTRACT_MSB0_INT (insn, 16, 8, 8); \ #define EXTRACT_IFMT_ADDV3_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -569,38 +358,35 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_ADDV3_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_simm16 = EXTRACT_INT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_BC8_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ SI f_disp8; \ unsigned int length; #define EXTRACT_IFMT_BC8_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_disp8 = ((((EXTRACT_INT (insn, 16, 8, 8)) << (2))) + (((pc) & (-4)))); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_disp8 = ((((EXTRACT_MSB0_INT (insn, 16, 8, 8)) << (2))) + (((pc) & (-4)))); \ #define EXTRACT_IFMT_BC24_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ SI f_disp24; \ unsigned int length; #define EXTRACT_IFMT_BC24_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_disp24 = ((((EXTRACT_INT (insn, 32, 8, 24)) << (2))) + (pc)); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_disp24 = ((((EXTRACT_MSB0_INT (insn, 32, 8, 24)) << (2))) + (pc)); \ #define EXTRACT_IFMT_BEQ_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -609,14 +395,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_BEQ_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_disp16 = ((((EXTRACT_INT (insn, 32, 16, 16)) << (2))) + (pc)); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_disp16 = ((((EXTRACT_MSB0_INT (insn, 32, 16, 16)) << (2))) + (pc)); \ #define EXTRACT_IFMT_BEQZ_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -625,14 +410,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_BEQZ_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_disp16 = ((((EXTRACT_INT (insn, 32, 16, 16)) << (2))) + (pc)); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_disp16 = ((((EXTRACT_MSB0_INT (insn, 32, 16, 16)) << (2))) + (pc)); \ #define EXTRACT_IFMT_CMP_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -640,13 +424,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_CMP_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_CMPI_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -655,14 +438,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_CMPI_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_simm16 = EXTRACT_INT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_DIV_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -671,14 +453,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_DIV_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_simm16 = EXTRACT_INT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_JL_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -686,25 +467,23 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_JL_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_LD24_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_uimm24; \ unsigned int length; #define EXTRACT_IFMT_LD24_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_uimm24 = EXTRACT_UINT (insn, 32, 8, 24); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_uimm24 = EXTRACT_MSB0_UINT (insn, 32, 8, 24); \ #define EXTRACT_IFMT_LDI16_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -713,14 +492,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_LDI16_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_simm16 = EXTRACT_INT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_MVFACHI_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -728,13 +506,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_MVFACHI_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_MVFC_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -742,13 +519,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_MVFC_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_MVTACHI_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -756,13 +532,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_MVTACHI_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_MVTC_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -770,13 +545,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_MVTC_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_NOP_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -784,13 +558,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_NOP_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ #define EXTRACT_IFMT_SETH_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -799,14 +572,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_SETH_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_hi16 = EXTRACT_UINT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_hi16 = EXTRACT_MSB0_UINT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_SLLI_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_shift_op2; \ @@ -814,13 +586,12 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_SLLI_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_shift_op2 = EXTRACT_UINT (insn, 16, 8, 3); \ - f_uimm5 = EXTRACT_UINT (insn, 16, 11, 5); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_shift_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 3); \ + f_uimm5 = EXTRACT_MSB0_UINT (insn, 16, 11, 5); \ #define EXTRACT_IFMT_ST_D_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -829,14 +600,13 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_ST_D_CODE \ length = 4; \ - f_op1 = EXTRACT_UINT (insn, 32, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 32, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 32, 8, 4); \ - f_r2 = EXTRACT_UINT (insn, 32, 12, 4); \ - f_simm16 = EXTRACT_INT (insn, 32, 16, 16); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 32, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 32, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 32, 8, 4); \ + f_r2 = EXTRACT_MSB0_UINT (insn, 32, 12, 4); \ + f_simm16 = EXTRACT_MSB0_INT (insn, 32, 16, 16); \ #define EXTRACT_IFMT_TRAP_VARS \ - /* Instruction fields. */ \ UINT f_op1; \ UINT f_r1; \ UINT f_op2; \ @@ -844,10 +614,10 @@ struct scache { unsigned int length; #define EXTRACT_IFMT_TRAP_CODE \ length = 2; \ - f_op1 = EXTRACT_UINT (insn, 16, 0, 4); \ - f_r1 = EXTRACT_UINT (insn, 16, 4, 4); \ - f_op2 = EXTRACT_UINT (insn, 16, 8, 4); \ - f_uimm4 = EXTRACT_UINT (insn, 16, 12, 4); \ + f_op1 = EXTRACT_MSB0_UINT (insn, 16, 0, 4); \ + f_r1 = EXTRACT_MSB0_UINT (insn, 16, 4, 4); \ + f_op2 = EXTRACT_MSB0_UINT (insn, 16, 8, 4); \ + f_uimm4 = EXTRACT_MSB0_UINT (insn, 16, 12, 4); \ /* Collection of various things for the trace handler to use. */ |