OSDN Git Service

* public snapshot of sid simulator
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / cgen-cpu / arm7t / thumb-decode.cxx
1 /* Simulator instruction decoder for thumb.
2
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
4
5 Copyright (C) 2000 Red Hat, Inc.
6
7 This file is part of the Cygnus Simulators.
8
9
10 */
11
12
13 #include "arm7f.h"
14
15 using namespace arm7f; // FIXME: namespace organization still wip
16
17
18 // The instruction descriptor array. 
19
20 // Have label pointers been initialized?
21 // XXX: Note that this is also needed by when semantics are implemented as
22 // functions to handle machine variants.
23 bool thumb_idesc::idesc_table_initialized_p = false;
24
25 thumb_idesc thumb_idesc::idesc_table[THUMB_INSN_MAX] =
26 {
27   { 0, 0, "X_AFTER", THUMB_INSN_X_AFTER, { 0|(1<<CGEN_INSN_PBB)|(1<<CGEN_INSN_VIRTUAL), (1<<MACH_BASE), (1<<ISA_THUMB) } },
28   { 0, 0, "X_BEFORE", THUMB_INSN_X_BEFORE, { 0|(1<<CGEN_INSN_PBB)|(1<<CGEN_INSN_VIRTUAL), (1<<MACH_BASE), (1<<ISA_THUMB) } },
29   { 0, 0, "X_CTI_CHAIN", THUMB_INSN_X_CTI_CHAIN, { 0|(1<<CGEN_INSN_PBB)|(1<<CGEN_INSN_VIRTUAL), (1<<MACH_BASE), (1<<ISA_THUMB) } },
30   { 0, 0, "X_CHAIN", THUMB_INSN_X_CHAIN, { 0|(1<<CGEN_INSN_PBB)|(1<<CGEN_INSN_VIRTUAL), (1<<MACH_BASE), (1<<ISA_THUMB) } },
31   { 0, 0, "X_BEGIN", THUMB_INSN_X_BEGIN, { 0|(1<<CGEN_INSN_PBB)|(1<<CGEN_INSN_VIRTUAL), (1<<MACH_BASE), (1<<ISA_THUMB) } },
32   { 0, thumb_sem_x_invalid, "X_INVALID", THUMB_INSN_X_INVALID, { 0|(1<<CGEN_INSN_VIRTUAL), (1<<MACH_BASE), (1<<ISA_THUMB) } },
33   { 0, thumb_sem_lsl, "LSL", THUMB_INSN_LSL, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
34   { 0, thumb_sem_lsr, "LSR", THUMB_INSN_LSR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
35   { 0, thumb_sem_asr, "ASR", THUMB_INSN_ASR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
36   { 0, thumb_sem_add, "ADD", THUMB_INSN_ADD, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
37   { 0, thumb_sem_addi, "ADDI", THUMB_INSN_ADDI, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
38   { 0, thumb_sem_sub, "SUB", THUMB_INSN_SUB, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
39   { 0, thumb_sem_subi, "SUBI", THUMB_INSN_SUBI, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
40   { 0, thumb_sem_mov, "MOV", THUMB_INSN_MOV, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
41   { 0, thumb_sem_cmp, "CMP", THUMB_INSN_CMP, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
42   { 0, thumb_sem_addi8, "ADDI8", THUMB_INSN_ADDI8, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
43   { 0, thumb_sem_subi8, "SUBI8", THUMB_INSN_SUBI8, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
44   { 0, thumb_sem_alu_and, "ALU_AND", THUMB_INSN_ALU_AND, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
45   { 0, thumb_sem_alu_eor, "ALU_EOR", THUMB_INSN_ALU_EOR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
46   { 0, thumb_sem_alu_lsl, "ALU_LSL", THUMB_INSN_ALU_LSL, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
47   { 0, thumb_sem_alu_lsr, "ALU_LSR", THUMB_INSN_ALU_LSR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
48   { 0, thumb_sem_alu_asr, "ALU_ASR", THUMB_INSN_ALU_ASR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
49   { 0, thumb_sem_alu_ror, "ALU_ROR", THUMB_INSN_ALU_ROR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
50   { 0, thumb_sem_alu_adc, "ALU_ADC", THUMB_INSN_ALU_ADC, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
51   { 0, thumb_sem_alu_sbc, "ALU_SBC", THUMB_INSN_ALU_SBC, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
52   { 0, thumb_sem_alu_tst, "ALU_TST", THUMB_INSN_ALU_TST, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
53   { 0, thumb_sem_alu_neg, "ALU_NEG", THUMB_INSN_ALU_NEG, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
54   { 0, thumb_sem_alu_cmp, "ALU_CMP", THUMB_INSN_ALU_CMP, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
55   { 0, thumb_sem_alu_cmn, "ALU_CMN", THUMB_INSN_ALU_CMN, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
56   { 0, thumb_sem_alu_orr, "ALU_ORR", THUMB_INSN_ALU_ORR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
57   { 0, thumb_sem_alu_mul, "ALU_MUL", THUMB_INSN_ALU_MUL, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
58   { 0, thumb_sem_alu_bic, "ALU_BIC", THUMB_INSN_ALU_BIC, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
59   { 0, thumb_sem_alu_mvn, "ALU_MVN", THUMB_INSN_ALU_MVN, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
60   { 0, thumb_sem_add_rd_hs, "ADD_RD_HS", THUMB_INSN_ADD_RD_HS, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
61   { 0, thumb_sem_add_hd_rs, "ADD_HD_RS", THUMB_INSN_ADD_HD_RS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
62   { 0, thumb_sem_add_hd_hs, "ADD_HD_HS", THUMB_INSN_ADD_HD_HS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
63   { 0, thumb_sem_cmp_rd_hs, "CMP_RD_HS", THUMB_INSN_CMP_RD_HS, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
64   { 0, thumb_sem_cmp_hd_rs, "CMP_HD_RS", THUMB_INSN_CMP_HD_RS, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
65   { 0, thumb_sem_cmp_hd_hs, "CMP_HD_HS", THUMB_INSN_CMP_HD_HS, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
66   { 0, thumb_sem_mov_rd_hs, "MOV_RD_HS", THUMB_INSN_MOV_RD_HS, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
67   { 0, thumb_sem_mov_hd_rs, "MOV_HD_RS", THUMB_INSN_MOV_HD_RS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
68   { 0, thumb_sem_mov_hd_hs, "MOV_HD_HS", THUMB_INSN_MOV_HD_HS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
69   { 0, thumb_sem_bx_rs, "BX_RS", THUMB_INSN_BX_RS, { 0|(1<<CGEN_INSN_UNCOND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
70   { 0, thumb_sem_bx_hs, "BX_HS", THUMB_INSN_BX_HS, { 0|(1<<CGEN_INSN_UNCOND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
71   { 0, thumb_sem_ldr_pc, "LDR_PC", THUMB_INSN_LDR_PC, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
72   { 0, thumb_sem_str, "STR", THUMB_INSN_STR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
73   { 0, thumb_sem_strb, "STRB", THUMB_INSN_STRB, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
74   { 0, thumb_sem_ldr, "LDR", THUMB_INSN_LDR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
75   { 0, thumb_sem_ldrb, "LDRB", THUMB_INSN_LDRB, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
76   { 0, thumb_sem_strh, "STRH", THUMB_INSN_STRH, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
77   { 0, thumb_sem_ldrh, "LDRH", THUMB_INSN_LDRH, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
78   { 0, thumb_sem_ldsb, "LDSB", THUMB_INSN_LDSB, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
79   { 0, thumb_sem_ldsh, "LDSH", THUMB_INSN_LDSH, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
80   { 0, thumb_sem_str_imm, "STR_IMM", THUMB_INSN_STR_IMM, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
81   { 0, thumb_sem_ldr_imm, "LDR_IMM", THUMB_INSN_LDR_IMM, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
82   { 0, thumb_sem_strb_imm, "STRB_IMM", THUMB_INSN_STRB_IMM, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
83   { 0, thumb_sem_ldrb_imm, "LDRB_IMM", THUMB_INSN_LDRB_IMM, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
84   { 0, thumb_sem_strh_imm, "STRH_IMM", THUMB_INSN_STRH_IMM, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
85   { 0, thumb_sem_ldrh_imm, "LDRH_IMM", THUMB_INSN_LDRH_IMM, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
86   { 0, thumb_sem_str_sprel, "STR_SPREL", THUMB_INSN_STR_SPREL, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
87   { 0, thumb_sem_ldr_sprel, "LDR_SPREL", THUMB_INSN_LDR_SPREL, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
88   { 0, thumb_sem_lda_pc, "LDA_PC", THUMB_INSN_LDA_PC, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
89   { 0, thumb_sem_lda_sp, "LDA_SP", THUMB_INSN_LDA_SP, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
90   { 0, thumb_sem_add_sp, "ADD_SP", THUMB_INSN_ADD_SP, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
91   { 0, thumb_sem_sub_sp, "SUB_SP", THUMB_INSN_SUB_SP, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
92   { 0, thumb_sem_push, "PUSH", THUMB_INSN_PUSH, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
93   { 0, thumb_sem_push_lr, "PUSH_LR", THUMB_INSN_PUSH_LR, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
94   { 0, thumb_sem_pop, "POP", THUMB_INSN_POP, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
95   { 0, thumb_sem_pop_pc, "POP_PC", THUMB_INSN_POP_PC, { 0|(1<<CGEN_INSN_UNCOND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
96   { 0, thumb_sem_stmia, "STMIA", THUMB_INSN_STMIA, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
97   { 0, thumb_sem_ldmia, "LDMIA", THUMB_INSN_LDMIA, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
98   { 0, thumb_sem_beq, "BEQ", THUMB_INSN_BEQ, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
99   { 0, thumb_sem_bne, "BNE", THUMB_INSN_BNE, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
100   { 0, thumb_sem_bcs, "BCS", THUMB_INSN_BCS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
101   { 0, thumb_sem_bcc, "BCC", THUMB_INSN_BCC, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
102   { 0, thumb_sem_bmi, "BMI", THUMB_INSN_BMI, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
103   { 0, thumb_sem_bpl, "BPL", THUMB_INSN_BPL, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
104   { 0, thumb_sem_bvs, "BVS", THUMB_INSN_BVS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
105   { 0, thumb_sem_bvc, "BVC", THUMB_INSN_BVC, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
106   { 0, thumb_sem_bhi, "BHI", THUMB_INSN_BHI, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
107   { 0, thumb_sem_bls, "BLS", THUMB_INSN_BLS, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
108   { 0, thumb_sem_bge, "BGE", THUMB_INSN_BGE, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
109   { 0, thumb_sem_blt, "BLT", THUMB_INSN_BLT, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
110   { 0, thumb_sem_bgt, "BGT", THUMB_INSN_BGT, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
111   { 0, thumb_sem_ble, "BLE", THUMB_INSN_BLE, { 0|(1<<CGEN_INSN_COND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
112   { 0, thumb_sem_swi, "SWI", THUMB_INSN_SWI, { 0|(1<<CGEN_INSN_UNCOND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
113   { 0, thumb_sem_b, "B", THUMB_INSN_B, { 0|(1<<CGEN_INSN_UNCOND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
114   { 0, thumb_sem_bl_hi, "BL_HI", THUMB_INSN_BL_HI, { 0, (1<<MACH_BASE), (1<<ISA_THUMB) } },
115   { 0, thumb_sem_bl_lo, "BL_LO", THUMB_INSN_BL_LO, { 0|(1<<CGEN_INSN_UNCOND_CTI), (1<<MACH_BASE), (1<<ISA_THUMB) } },
116
117 };
118
119 // Given a canonical virtual insn id, return the target specific one.
120
121 thumb_insn_type
122 thumb_idesc::lookup_virtual (virtual_insn_type vit)
123 {
124   switch (vit)
125     {
126       case VIRTUAL_INSN_INVALID: return THUMB_INSN_X_INVALID;
127       case VIRTUAL_INSN_BEGIN: return THUMB_INSN_X_BEGIN;
128       case VIRTUAL_INSN_CHAIN: return THUMB_INSN_X_CHAIN;
129       case VIRTUAL_INSN_CTI_CHAIN: return THUMB_INSN_X_CTI_CHAIN;
130       case VIRTUAL_INSN_BEFORE: return THUMB_INSN_X_BEFORE;
131       case VIRTUAL_INSN_AFTER: return THUMB_INSN_X_AFTER;
132       case VIRTUAL_INSN_COND: return THUMB_INSN_X_INVALID;
133     }
134   abort ();
135 }
136
137
138 // Declare extractor functions
139
140 static void
141 thumb_extract_sfmt_empty (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
142 static void
143 thumb_extract_sfmt_lsl (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
144 static void
145 thumb_extract_sfmt_add (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
146 static void
147 thumb_extract_sfmt_addi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
148 static void
149 thumb_extract_sfmt_mov (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
150 static void
151 thumb_extract_sfmt_cmp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
152 static void
153 thumb_extract_sfmt_addi8 (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
154 static void
155 thumb_extract_sfmt_alu_and (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
156 static void
157 thumb_extract_sfmt_alu_lsl (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
158 static void
159 thumb_extract_sfmt_alu_adc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
160 static void
161 thumb_extract_sfmt_alu_tst (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
162 static void
163 thumb_extract_sfmt_alu_neg (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
164 static void
165 thumb_extract_sfmt_alu_cmp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
166 static void
167 thumb_extract_sfmt_add_rd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
168 static void
169 thumb_extract_sfmt_add_hd_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
170 static void
171 thumb_extract_sfmt_add_hd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
172 static void
173 thumb_extract_sfmt_cmp_rd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
174 static void
175 thumb_extract_sfmt_cmp_hd_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
176 static void
177 thumb_extract_sfmt_cmp_hd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
178 static void
179 thumb_extract_sfmt_mov_rd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
180 static void
181 thumb_extract_sfmt_mov_hd_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
182 static void
183 thumb_extract_sfmt_mov_hd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
184 static void
185 thumb_extract_sfmt_bx_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
186 static void
187 thumb_extract_sfmt_bx_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
188 static void
189 thumb_extract_sfmt_ldr_pc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
190 static void
191 thumb_extract_sfmt_str (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
192 static void
193 thumb_extract_sfmt_ldr (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
194 static void
195 thumb_extract_sfmt_str_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
196 static void
197 thumb_extract_sfmt_ldr_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
198 static void
199 thumb_extract_sfmt_strb_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
200 static void
201 thumb_extract_sfmt_ldrb_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
202 static void
203 thumb_extract_sfmt_strh_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
204 static void
205 thumb_extract_sfmt_ldrh_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
206 static void
207 thumb_extract_sfmt_str_sprel (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
208 static void
209 thumb_extract_sfmt_ldr_sprel (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
210 static void
211 thumb_extract_sfmt_lda_pc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
212 static void
213 thumb_extract_sfmt_lda_sp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
214 static void
215 thumb_extract_sfmt_add_sp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
216 static void
217 thumb_extract_sfmt_push (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
218 static void
219 thumb_extract_sfmt_push_lr (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
220 static void
221 thumb_extract_sfmt_pop (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
222 static void
223 thumb_extract_sfmt_pop_pc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
224 static void
225 thumb_extract_sfmt_stmia (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
226 static void
227 thumb_extract_sfmt_ldmia (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
228 static void
229 thumb_extract_sfmt_beq (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
230 static void
231 thumb_extract_sfmt_bcs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
232 static void
233 thumb_extract_sfmt_bmi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
234 static void
235 thumb_extract_sfmt_bvs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
236 static void
237 thumb_extract_sfmt_bhi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
238 static void
239 thumb_extract_sfmt_bge (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
240 static void
241 thumb_extract_sfmt_bgt (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
242 static void
243 thumb_extract_sfmt_swi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
244 static void
245 thumb_extract_sfmt_b (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
246 static void
247 thumb_extract_sfmt_bl_hi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
248 static void
249 thumb_extract_sfmt_bl_lo (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn);
250
251 // Fetch & decode instruction
252 void
253 thumb_scache::decode (arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn)
254 {
255   /* Result of decoder.  */
256   THUMB_INSN_TYPE itype;
257
258   {
259     thumb_insn_word insn = base_insn;
260
261     {
262       unsigned int val = (((insn >> 8) & (255 << 0)));
263       switch (val)
264       {
265       case 0 : /* fall through */
266       case 1 : /* fall through */
267       case 2 : /* fall through */
268       case 3 : /* fall through */
269       case 4 : /* fall through */
270       case 5 : /* fall through */
271       case 6 : /* fall through */
272       case 7 : itype = THUMB_INSN_LSL; thumb_extract_sfmt_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
273       case 8 : /* fall through */
274       case 9 : /* fall through */
275       case 10 : /* fall through */
276       case 11 : /* fall through */
277       case 12 : /* fall through */
278       case 13 : /* fall through */
279       case 14 : /* fall through */
280       case 15 : itype = THUMB_INSN_LSR; thumb_extract_sfmt_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
281       case 16 : /* fall through */
282       case 17 : /* fall through */
283       case 18 : /* fall through */
284       case 19 : /* fall through */
285       case 20 : /* fall through */
286       case 21 : /* fall through */
287       case 22 : /* fall through */
288       case 23 : itype = THUMB_INSN_ASR; thumb_extract_sfmt_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
289       case 24 : /* fall through */
290       case 25 : itype = THUMB_INSN_ADD; thumb_extract_sfmt_add (this, current_cpu, pc, base_insn, entire_insn);  goto done;
291       case 26 : /* fall through */
292       case 27 : itype = THUMB_INSN_SUB; thumb_extract_sfmt_add (this, current_cpu, pc, base_insn, entire_insn);  goto done;
293       case 28 : /* fall through */
294       case 29 : itype = THUMB_INSN_ADDI; thumb_extract_sfmt_addi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
295       case 30 : /* fall through */
296       case 31 : itype = THUMB_INSN_SUBI; thumb_extract_sfmt_addi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
297       case 32 : /* fall through */
298       case 33 : /* fall through */
299       case 34 : /* fall through */
300       case 35 : /* fall through */
301       case 36 : /* fall through */
302       case 37 : /* fall through */
303       case 38 : /* fall through */
304       case 39 : itype = THUMB_INSN_MOV; thumb_extract_sfmt_mov (this, current_cpu, pc, base_insn, entire_insn);  goto done;
305       case 40 : /* fall through */
306       case 41 : /* fall through */
307       case 42 : /* fall through */
308       case 43 : /* fall through */
309       case 44 : /* fall through */
310       case 45 : /* fall through */
311       case 46 : /* fall through */
312       case 47 : itype = THUMB_INSN_CMP; thumb_extract_sfmt_cmp (this, current_cpu, pc, base_insn, entire_insn);  goto done;
313       case 48 : /* fall through */
314       case 49 : /* fall through */
315       case 50 : /* fall through */
316       case 51 : /* fall through */
317       case 52 : /* fall through */
318       case 53 : /* fall through */
319       case 54 : /* fall through */
320       case 55 : itype = THUMB_INSN_ADDI8; thumb_extract_sfmt_addi8 (this, current_cpu, pc, base_insn, entire_insn);  goto done;
321       case 56 : /* fall through */
322       case 57 : /* fall through */
323       case 58 : /* fall through */
324       case 59 : /* fall through */
325       case 60 : /* fall through */
326       case 61 : /* fall through */
327       case 62 : /* fall through */
328       case 63 : itype = THUMB_INSN_SUBI8; thumb_extract_sfmt_addi8 (this, current_cpu, pc, base_insn, entire_insn);  goto done;
329       case 64 :
330         {
331           unsigned int val = (((insn >> 6) & (3 << 0)));
332           switch (val)
333           {
334           case 0 : itype = THUMB_INSN_ALU_AND; thumb_extract_sfmt_alu_and (this, current_cpu, pc, base_insn, entire_insn);  goto done;
335           case 1 : itype = THUMB_INSN_ALU_EOR; thumb_extract_sfmt_alu_and (this, current_cpu, pc, base_insn, entire_insn);  goto done;
336           case 2 : itype = THUMB_INSN_ALU_LSL; thumb_extract_sfmt_alu_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
337           case 3 : itype = THUMB_INSN_ALU_LSR; thumb_extract_sfmt_alu_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
338           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
339           }
340         }
341       case 65 :
342         {
343           unsigned int val = (((insn >> 6) & (3 << 0)));
344           switch (val)
345           {
346           case 0 : itype = THUMB_INSN_ALU_ASR; thumb_extract_sfmt_alu_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
347           case 1 : itype = THUMB_INSN_ALU_ADC; thumb_extract_sfmt_alu_adc (this, current_cpu, pc, base_insn, entire_insn);  goto done;
348           case 2 : itype = THUMB_INSN_ALU_SBC; thumb_extract_sfmt_alu_adc (this, current_cpu, pc, base_insn, entire_insn);  goto done;
349           case 3 : itype = THUMB_INSN_ALU_ROR; thumb_extract_sfmt_alu_lsl (this, current_cpu, pc, base_insn, entire_insn);  goto done;
350           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
351           }
352         }
353       case 66 :
354         {
355           unsigned int val = (((insn >> 6) & (3 << 0)));
356           switch (val)
357           {
358           case 0 : itype = THUMB_INSN_ALU_TST; thumb_extract_sfmt_alu_tst (this, current_cpu, pc, base_insn, entire_insn);  goto done;
359           case 1 : itype = THUMB_INSN_ALU_NEG; thumb_extract_sfmt_alu_neg (this, current_cpu, pc, base_insn, entire_insn);  goto done;
360           case 2 : itype = THUMB_INSN_ALU_CMP; thumb_extract_sfmt_alu_cmp (this, current_cpu, pc, base_insn, entire_insn);  goto done;
361           case 3 : itype = THUMB_INSN_ALU_CMN; thumb_extract_sfmt_alu_cmp (this, current_cpu, pc, base_insn, entire_insn);  goto done;
362           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
363           }
364         }
365       case 67 :
366         {
367           unsigned int val = (((insn >> 6) & (3 << 0)));
368           switch (val)
369           {
370           case 0 : itype = THUMB_INSN_ALU_ORR; thumb_extract_sfmt_alu_and (this, current_cpu, pc, base_insn, entire_insn);  goto done;
371           case 1 : itype = THUMB_INSN_ALU_MUL; thumb_extract_sfmt_alu_and (this, current_cpu, pc, base_insn, entire_insn);  goto done;
372           case 2 : itype = THUMB_INSN_ALU_BIC; thumb_extract_sfmt_alu_and (this, current_cpu, pc, base_insn, entire_insn);  goto done;
373           case 3 : itype = THUMB_INSN_ALU_MVN; thumb_extract_sfmt_alu_and (this, current_cpu, pc, base_insn, entire_insn);  goto done;
374           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
375           }
376         }
377       case 68 :
378         {
379           unsigned int val = (((insn >> 6) & (3 << 0)));
380           switch (val)
381           {
382           case 1 : itype = THUMB_INSN_ADD_RD_HS; thumb_extract_sfmt_add_rd_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
383           case 2 : itype = THUMB_INSN_ADD_HD_RS; thumb_extract_sfmt_add_hd_rs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
384           case 3 : itype = THUMB_INSN_ADD_HD_HS; thumb_extract_sfmt_add_hd_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
385           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
386           }
387         }
388       case 69 :
389         {
390           unsigned int val = (((insn >> 6) & (3 << 0)));
391           switch (val)
392           {
393           case 1 : itype = THUMB_INSN_CMP_RD_HS; thumb_extract_sfmt_cmp_rd_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
394           case 2 : itype = THUMB_INSN_CMP_HD_RS; thumb_extract_sfmt_cmp_hd_rs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
395           case 3 : itype = THUMB_INSN_CMP_HD_HS; thumb_extract_sfmt_cmp_hd_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
396           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
397           }
398         }
399       case 70 :
400         {
401           unsigned int val = (((insn >> 6) & (3 << 0)));
402           switch (val)
403           {
404           case 1 : itype = THUMB_INSN_MOV_RD_HS; thumb_extract_sfmt_mov_rd_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
405           case 2 : itype = THUMB_INSN_MOV_HD_RS; thumb_extract_sfmt_mov_hd_rs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
406           case 3 : itype = THUMB_INSN_MOV_HD_HS; thumb_extract_sfmt_mov_hd_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
407           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
408           }
409         }
410       case 71 :
411         {
412           unsigned int val = (((insn >> 6) & (1 << 0)));
413           switch (val)
414           {
415           case 0 : itype = THUMB_INSN_BX_RS; thumb_extract_sfmt_bx_rs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
416           case 1 : itype = THUMB_INSN_BX_HS; thumb_extract_sfmt_bx_hs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
417           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
418           }
419         }
420       case 72 : /* fall through */
421       case 73 : /* fall through */
422       case 74 : /* fall through */
423       case 75 : /* fall through */
424       case 76 : /* fall through */
425       case 77 : /* fall through */
426       case 78 : /* fall through */
427       case 79 : itype = THUMB_INSN_LDR_PC; thumb_extract_sfmt_ldr_pc (this, current_cpu, pc, base_insn, entire_insn);  goto done;
428       case 80 : /* fall through */
429       case 81 : itype = THUMB_INSN_STR; thumb_extract_sfmt_str (this, current_cpu, pc, base_insn, entire_insn);  goto done;
430       case 82 : /* fall through */
431       case 83 : itype = THUMB_INSN_STRH; thumb_extract_sfmt_str (this, current_cpu, pc, base_insn, entire_insn);  goto done;
432       case 84 : /* fall through */
433       case 85 : itype = THUMB_INSN_STRB; thumb_extract_sfmt_str (this, current_cpu, pc, base_insn, entire_insn);  goto done;
434       case 86 : /* fall through */
435       case 87 : itype = THUMB_INSN_LDSB; thumb_extract_sfmt_ldr (this, current_cpu, pc, base_insn, entire_insn);  goto done;
436       case 88 : /* fall through */
437       case 89 : itype = THUMB_INSN_LDR; thumb_extract_sfmt_ldr (this, current_cpu, pc, base_insn, entire_insn);  goto done;
438       case 90 : /* fall through */
439       case 91 : itype = THUMB_INSN_LDRH; thumb_extract_sfmt_ldr (this, current_cpu, pc, base_insn, entire_insn);  goto done;
440       case 92 : /* fall through */
441       case 93 : itype = THUMB_INSN_LDRB; thumb_extract_sfmt_ldr (this, current_cpu, pc, base_insn, entire_insn);  goto done;
442       case 94 : /* fall through */
443       case 95 : itype = THUMB_INSN_LDSH; thumb_extract_sfmt_ldr (this, current_cpu, pc, base_insn, entire_insn);  goto done;
444       case 96 : /* fall through */
445       case 97 : /* fall through */
446       case 98 : /* fall through */
447       case 99 : /* fall through */
448       case 100 : /* fall through */
449       case 101 : /* fall through */
450       case 102 : /* fall through */
451       case 103 : itype = THUMB_INSN_STR_IMM; thumb_extract_sfmt_str_imm (this, current_cpu, pc, base_insn, entire_insn);  goto done;
452       case 104 : /* fall through */
453       case 105 : /* fall through */
454       case 106 : /* fall through */
455       case 107 : /* fall through */
456       case 108 : /* fall through */
457       case 109 : /* fall through */
458       case 110 : /* fall through */
459       case 111 : itype = THUMB_INSN_LDR_IMM; thumb_extract_sfmt_ldr_imm (this, current_cpu, pc, base_insn, entire_insn);  goto done;
460       case 112 : /* fall through */
461       case 113 : /* fall through */
462       case 114 : /* fall through */
463       case 115 : /* fall through */
464       case 116 : /* fall through */
465       case 117 : /* fall through */
466       case 118 : /* fall through */
467       case 119 : itype = THUMB_INSN_STRB_IMM; thumb_extract_sfmt_strb_imm (this, current_cpu, pc, base_insn, entire_insn);  goto done;
468       case 120 : /* fall through */
469       case 121 : /* fall through */
470       case 122 : /* fall through */
471       case 123 : /* fall through */
472       case 124 : /* fall through */
473       case 125 : /* fall through */
474       case 126 : /* fall through */
475       case 127 : itype = THUMB_INSN_LDRB_IMM; thumb_extract_sfmt_ldrb_imm (this, current_cpu, pc, base_insn, entire_insn);  goto done;
476       case 128 : /* fall through */
477       case 129 : /* fall through */
478       case 130 : /* fall through */
479       case 131 : /* fall through */
480       case 132 : /* fall through */
481       case 133 : /* fall through */
482       case 134 : /* fall through */
483       case 135 : itype = THUMB_INSN_STRH_IMM; thumb_extract_sfmt_strh_imm (this, current_cpu, pc, base_insn, entire_insn);  goto done;
484       case 136 : /* fall through */
485       case 137 : /* fall through */
486       case 138 : /* fall through */
487       case 139 : /* fall through */
488       case 140 : /* fall through */
489       case 141 : /* fall through */
490       case 142 : /* fall through */
491       case 143 : itype = THUMB_INSN_LDRH_IMM; thumb_extract_sfmt_ldrh_imm (this, current_cpu, pc, base_insn, entire_insn);  goto done;
492       case 144 : /* fall through */
493       case 145 : /* fall through */
494       case 146 : /* fall through */
495       case 147 : /* fall through */
496       case 148 : /* fall through */
497       case 149 : /* fall through */
498       case 150 : /* fall through */
499       case 151 : itype = THUMB_INSN_STR_SPREL; thumb_extract_sfmt_str_sprel (this, current_cpu, pc, base_insn, entire_insn);  goto done;
500       case 152 : /* fall through */
501       case 153 : /* fall through */
502       case 154 : /* fall through */
503       case 155 : /* fall through */
504       case 156 : /* fall through */
505       case 157 : /* fall through */
506       case 158 : /* fall through */
507       case 159 : itype = THUMB_INSN_LDR_SPREL; thumb_extract_sfmt_ldr_sprel (this, current_cpu, pc, base_insn, entire_insn);  goto done;
508       case 160 : /* fall through */
509       case 161 : /* fall through */
510       case 162 : /* fall through */
511       case 163 : /* fall through */
512       case 164 : /* fall through */
513       case 165 : /* fall through */
514       case 166 : /* fall through */
515       case 167 : itype = THUMB_INSN_LDA_PC; thumb_extract_sfmt_lda_pc (this, current_cpu, pc, base_insn, entire_insn);  goto done;
516       case 168 : /* fall through */
517       case 169 : /* fall through */
518       case 170 : /* fall through */
519       case 171 : /* fall through */
520       case 172 : /* fall through */
521       case 173 : /* fall through */
522       case 174 : /* fall through */
523       case 175 : itype = THUMB_INSN_LDA_SP; thumb_extract_sfmt_lda_sp (this, current_cpu, pc, base_insn, entire_insn);  goto done;
524       case 176 :
525         {
526           unsigned int val = (((insn >> 7) & (1 << 0)));
527           switch (val)
528           {
529           case 0 : itype = THUMB_INSN_ADD_SP; thumb_extract_sfmt_add_sp (this, current_cpu, pc, base_insn, entire_insn);  goto done;
530           case 1 : itype = THUMB_INSN_SUB_SP; thumb_extract_sfmt_add_sp (this, current_cpu, pc, base_insn, entire_insn);  goto done;
531           default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
532           }
533         }
534       case 180 : itype = THUMB_INSN_PUSH; thumb_extract_sfmt_push (this, current_cpu, pc, base_insn, entire_insn);  goto done;
535       case 181 : itype = THUMB_INSN_PUSH_LR; thumb_extract_sfmt_push_lr (this, current_cpu, pc, base_insn, entire_insn);  goto done;
536       case 188 : itype = THUMB_INSN_POP; thumb_extract_sfmt_pop (this, current_cpu, pc, base_insn, entire_insn);  goto done;
537       case 189 : itype = THUMB_INSN_POP_PC; thumb_extract_sfmt_pop_pc (this, current_cpu, pc, base_insn, entire_insn);  goto done;
538       case 192 : /* fall through */
539       case 193 : /* fall through */
540       case 194 : /* fall through */
541       case 195 : /* fall through */
542       case 196 : /* fall through */
543       case 197 : /* fall through */
544       case 198 : /* fall through */
545       case 199 : itype = THUMB_INSN_STMIA; thumb_extract_sfmt_stmia (this, current_cpu, pc, base_insn, entire_insn);  goto done;
546       case 200 : /* fall through */
547       case 201 : /* fall through */
548       case 202 : /* fall through */
549       case 203 : /* fall through */
550       case 204 : /* fall through */
551       case 205 : /* fall through */
552       case 206 : /* fall through */
553       case 207 : itype = THUMB_INSN_LDMIA; thumb_extract_sfmt_ldmia (this, current_cpu, pc, base_insn, entire_insn);  goto done;
554       case 208 : itype = THUMB_INSN_BEQ; thumb_extract_sfmt_beq (this, current_cpu, pc, base_insn, entire_insn);  goto done;
555       case 209 : itype = THUMB_INSN_BNE; thumb_extract_sfmt_beq (this, current_cpu, pc, base_insn, entire_insn);  goto done;
556       case 210 : itype = THUMB_INSN_BCS; thumb_extract_sfmt_bcs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
557       case 211 : itype = THUMB_INSN_BCC; thumb_extract_sfmt_bcs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
558       case 212 : itype = THUMB_INSN_BMI; thumb_extract_sfmt_bmi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
559       case 213 : itype = THUMB_INSN_BPL; thumb_extract_sfmt_bmi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
560       case 214 : itype = THUMB_INSN_BVS; thumb_extract_sfmt_bvs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
561       case 215 : itype = THUMB_INSN_BVC; thumb_extract_sfmt_bvs (this, current_cpu, pc, base_insn, entire_insn);  goto done;
562       case 216 : itype = THUMB_INSN_BHI; thumb_extract_sfmt_bhi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
563       case 217 : itype = THUMB_INSN_BLS; thumb_extract_sfmt_bhi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
564       case 218 : itype = THUMB_INSN_BGE; thumb_extract_sfmt_bge (this, current_cpu, pc, base_insn, entire_insn);  goto done;
565       case 219 : itype = THUMB_INSN_BLT; thumb_extract_sfmt_bge (this, current_cpu, pc, base_insn, entire_insn);  goto done;
566       case 220 : itype = THUMB_INSN_BGT; thumb_extract_sfmt_bgt (this, current_cpu, pc, base_insn, entire_insn);  goto done;
567       case 221 : itype = THUMB_INSN_BLE; thumb_extract_sfmt_bgt (this, current_cpu, pc, base_insn, entire_insn);  goto done;
568       case 223 : itype = THUMB_INSN_SWI; thumb_extract_sfmt_swi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
569       case 224 : /* fall through */
570       case 225 : /* fall through */
571       case 226 : /* fall through */
572       case 227 : /* fall through */
573       case 228 : /* fall through */
574       case 229 : /* fall through */
575       case 230 : /* fall through */
576       case 231 : itype = THUMB_INSN_B; thumb_extract_sfmt_b (this, current_cpu, pc, base_insn, entire_insn);  goto done;
577       case 240 : /* fall through */
578       case 241 : /* fall through */
579       case 242 : /* fall through */
580       case 243 : /* fall through */
581       case 244 : /* fall through */
582       case 245 : /* fall through */
583       case 246 : /* fall through */
584       case 247 : itype = THUMB_INSN_BL_HI; thumb_extract_sfmt_bl_hi (this, current_cpu, pc, base_insn, entire_insn);  goto done;
585       case 248 : /* fall through */
586       case 249 : /* fall through */
587       case 250 : /* fall through */
588       case 251 : /* fall through */
589       case 252 : /* fall through */
590       case 253 : /* fall through */
591       case 254 : /* fall through */
592       case 255 : itype = THUMB_INSN_BL_LO; thumb_extract_sfmt_bl_lo (this, current_cpu, pc, base_insn, entire_insn);  goto done;
593       default : itype = THUMB_INSN_X_INVALID; thumb_extract_sfmt_empty (this, current_cpu, pc, base_insn, entire_insn);  goto done;
594       }
595     }
596
597   }
598
599   /* The instruction has been decoded and fields extracted.  */
600   done:
601
602   this->addr = pc;
603   // FIXME: To be redone (to handle ISA variants).
604   this->idesc = & thumb_idesc::idesc_table[itype];
605   // ??? record semantic handler?
606   assert(this->idesc->sem_index == itype);
607 }
608
609 void
610 thumb_extract_sfmt_empty (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
611     thumb_insn_word insn = entire_insn;
612 #define FLD(f) abuf->fields.fmt_empty.f
613
614
615   /* Record the fields for the semantic handler.  */
616   if (current_cpu->trace_extract_p)
617     {
618       current_cpu->trace_stream 
619         << "0x" << hex << pc << dec << " (sfmt_empty)\t"
620         << endl;
621     }
622
623 #undef FLD
624 }
625
626 void
627 thumb_extract_sfmt_lsl (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
628     thumb_insn_word insn = entire_insn;
629 #define FLD(f) abuf->fields.sfmt_lsl.f
630     UINT f_offset5;
631     UINT f_rs;
632     UINT f_rd;
633
634     f_offset5 = EXTRACT_LSB0_UINT (insn, 16, 10, 5);
635     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
636     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
637
638   /* Record the fields for the semantic handler.  */
639   FLD (f_offset5) = f_offset5;
640   FLD (f_rd) = f_rd;
641   FLD (f_rs) = f_rs;
642   if (current_cpu->trace_extract_p)
643     {
644       current_cpu->trace_stream 
645         << "0x" << hex << pc << dec << " (sfmt_lsl)\t"
646         << " f_offset5:0x" << hex << f_offset5 << dec
647         << " f_rd:0x" << hex << f_rd << dec
648         << " f_rs:0x" << hex << f_rs << dec
649         << endl;
650     }
651
652 #undef FLD
653 }
654
655 void
656 thumb_extract_sfmt_add (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
657     thumb_insn_word insn = entire_insn;
658 #define FLD(f) abuf->fields.sfmt_add.f
659     UINT f_rn;
660     UINT f_rs;
661     UINT f_rd;
662
663     f_rn = EXTRACT_LSB0_UINT (insn, 16, 8, 3);
664     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
665     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
666
667   /* Record the fields for the semantic handler.  */
668   FLD (f_rn) = f_rn;
669   FLD (f_rs) = f_rs;
670   FLD (f_rd) = f_rd;
671   if (current_cpu->trace_extract_p)
672     {
673       current_cpu->trace_stream 
674         << "0x" << hex << pc << dec << " (sfmt_add)\t"
675         << " f_rn:0x" << hex << f_rn << dec
676         << " f_rs:0x" << hex << f_rs << dec
677         << " f_rd:0x" << hex << f_rd << dec
678         << endl;
679     }
680
681 #undef FLD
682 }
683
684 void
685 thumb_extract_sfmt_addi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
686     thumb_insn_word insn = entire_insn;
687 #define FLD(f) abuf->fields.sfmt_addi.f
688     UINT f_offset3;
689     UINT f_rs;
690     UINT f_rd;
691
692     f_offset3 = EXTRACT_LSB0_UINT (insn, 16, 8, 3);
693     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
694     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
695
696   /* Record the fields for the semantic handler.  */
697   FLD (f_offset3) = f_offset3;
698   FLD (f_rs) = f_rs;
699   FLD (f_rd) = f_rd;
700   if (current_cpu->trace_extract_p)
701     {
702       current_cpu->trace_stream 
703         << "0x" << hex << pc << dec << " (sfmt_addi)\t"
704         << " f_offset3:0x" << hex << f_offset3 << dec
705         << " f_rs:0x" << hex << f_rs << dec
706         << " f_rd:0x" << hex << f_rd << dec
707         << endl;
708     }
709
710 #undef FLD
711 }
712
713 void
714 thumb_extract_sfmt_mov (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
715     thumb_insn_word insn = entire_insn;
716 #define FLD(f) abuf->fields.sfmt_mov.f
717     UINT f_bit10_rd;
718     UINT f_offset8;
719
720     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
721     f_offset8 = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
722
723   /* Record the fields for the semantic handler.  */
724   FLD (f_bit10_rd) = f_bit10_rd;
725   FLD (f_offset8) = f_offset8;
726   if (current_cpu->trace_extract_p)
727     {
728       current_cpu->trace_stream 
729         << "0x" << hex << pc << dec << " (sfmt_mov)\t"
730         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
731         << " f_offset8:0x" << hex << f_offset8 << dec
732         << endl;
733     }
734
735 #undef FLD
736 }
737
738 void
739 thumb_extract_sfmt_cmp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
740     thumb_insn_word insn = entire_insn;
741 #define FLD(f) abuf->fields.sfmt_mov.f
742     UINT f_bit10_rd;
743     UINT f_offset8;
744
745     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
746     f_offset8 = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
747
748   /* Record the fields for the semantic handler.  */
749   FLD (f_bit10_rd) = f_bit10_rd;
750   FLD (f_offset8) = f_offset8;
751   if (current_cpu->trace_extract_p)
752     {
753       current_cpu->trace_stream 
754         << "0x" << hex << pc << dec << " (sfmt_cmp)\t"
755         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
756         << " f_offset8:0x" << hex << f_offset8 << dec
757         << endl;
758     }
759
760 #undef FLD
761 }
762
763 void
764 thumb_extract_sfmt_addi8 (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
765     thumb_insn_word insn = entire_insn;
766 #define FLD(f) abuf->fields.sfmt_mov.f
767     UINT f_bit10_rd;
768     UINT f_offset8;
769
770     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
771     f_offset8 = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
772
773   /* Record the fields for the semantic handler.  */
774   FLD (f_bit10_rd) = f_bit10_rd;
775   FLD (f_offset8) = f_offset8;
776   if (current_cpu->trace_extract_p)
777     {
778       current_cpu->trace_stream 
779         << "0x" << hex << pc << dec << " (sfmt_addi8)\t"
780         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
781         << " f_offset8:0x" << hex << f_offset8 << dec
782         << endl;
783     }
784
785 #undef FLD
786 }
787
788 void
789 thumb_extract_sfmt_alu_and (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
790     thumb_insn_word insn = entire_insn;
791 #define FLD(f) abuf->fields.sfmt_addi.f
792     UINT f_rs;
793     UINT f_rd;
794
795     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
796     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
797
798   /* Record the fields for the semantic handler.  */
799   FLD (f_rd) = f_rd;
800   FLD (f_rs) = f_rs;
801   if (current_cpu->trace_extract_p)
802     {
803       current_cpu->trace_stream 
804         << "0x" << hex << pc << dec << " (sfmt_alu_and)\t"
805         << " f_rd:0x" << hex << f_rd << dec
806         << " f_rs:0x" << hex << f_rs << dec
807         << endl;
808     }
809
810 #undef FLD
811 }
812
813 void
814 thumb_extract_sfmt_alu_lsl (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
815     thumb_insn_word insn = entire_insn;
816 #define FLD(f) abuf->fields.sfmt_addi.f
817     UINT f_rs;
818     UINT f_rd;
819
820     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
821     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
822
823   /* Record the fields for the semantic handler.  */
824   FLD (f_rd) = f_rd;
825   FLD (f_rs) = f_rs;
826   if (current_cpu->trace_extract_p)
827     {
828       current_cpu->trace_stream 
829         << "0x" << hex << pc << dec << " (sfmt_alu_lsl)\t"
830         << " f_rd:0x" << hex << f_rd << dec
831         << " f_rs:0x" << hex << f_rs << dec
832         << endl;
833     }
834
835 #undef FLD
836 }
837
838 void
839 thumb_extract_sfmt_alu_adc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
840     thumb_insn_word insn = entire_insn;
841 #define FLD(f) abuf->fields.sfmt_addi.f
842     UINT f_rs;
843     UINT f_rd;
844
845     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
846     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
847
848   /* Record the fields for the semantic handler.  */
849   FLD (f_rd) = f_rd;
850   FLD (f_rs) = f_rs;
851   if (current_cpu->trace_extract_p)
852     {
853       current_cpu->trace_stream 
854         << "0x" << hex << pc << dec << " (sfmt_alu_adc)\t"
855         << " f_rd:0x" << hex << f_rd << dec
856         << " f_rs:0x" << hex << f_rs << dec
857         << endl;
858     }
859
860 #undef FLD
861 }
862
863 void
864 thumb_extract_sfmt_alu_tst (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
865     thumb_insn_word insn = entire_insn;
866 #define FLD(f) abuf->fields.sfmt_addi.f
867     UINT f_rs;
868     UINT f_rd;
869
870     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
871     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
872
873   /* Record the fields for the semantic handler.  */
874   FLD (f_rd) = f_rd;
875   FLD (f_rs) = f_rs;
876   if (current_cpu->trace_extract_p)
877     {
878       current_cpu->trace_stream 
879         << "0x" << hex << pc << dec << " (sfmt_alu_tst)\t"
880         << " f_rd:0x" << hex << f_rd << dec
881         << " f_rs:0x" << hex << f_rs << dec
882         << endl;
883     }
884
885 #undef FLD
886 }
887
888 void
889 thumb_extract_sfmt_alu_neg (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
890     thumb_insn_word insn = entire_insn;
891 #define FLD(f) abuf->fields.sfmt_addi.f
892     UINT f_rs;
893     UINT f_rd;
894
895     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
896     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
897
898   /* Record the fields for the semantic handler.  */
899   FLD (f_rs) = f_rs;
900   FLD (f_rd) = f_rd;
901   if (current_cpu->trace_extract_p)
902     {
903       current_cpu->trace_stream 
904         << "0x" << hex << pc << dec << " (sfmt_alu_neg)\t"
905         << " f_rs:0x" << hex << f_rs << dec
906         << " f_rd:0x" << hex << f_rd << dec
907         << endl;
908     }
909
910 #undef FLD
911 }
912
913 void
914 thumb_extract_sfmt_alu_cmp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
915     thumb_insn_word insn = entire_insn;
916 #define FLD(f) abuf->fields.sfmt_addi.f
917     UINT f_rs;
918     UINT f_rd;
919
920     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
921     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
922
923   /* Record the fields for the semantic handler.  */
924   FLD (f_rd) = f_rd;
925   FLD (f_rs) = f_rs;
926   if (current_cpu->trace_extract_p)
927     {
928       current_cpu->trace_stream 
929         << "0x" << hex << pc << dec << " (sfmt_alu_cmp)\t"
930         << " f_rd:0x" << hex << f_rd << dec
931         << " f_rs:0x" << hex << f_rs << dec
932         << endl;
933     }
934
935 #undef FLD
936 }
937
938 void
939 thumb_extract_sfmt_add_rd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
940     thumb_insn_word insn = entire_insn;
941 #define FLD(f) abuf->fields.sfmt_addi.f
942     UINT f_rs;
943     UINT f_rd;
944
945     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
946     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
947
948   /* Record the fields for the semantic handler.  */
949   FLD (f_rs) = f_rs;
950   FLD (f_rd) = f_rd;
951   if (current_cpu->trace_extract_p)
952     {
953       current_cpu->trace_stream 
954         << "0x" << hex << pc << dec << " (sfmt_add_rd_hs)\t"
955         << " f_rs:0x" << hex << f_rs << dec
956         << " f_rd:0x" << hex << f_rd << dec
957         << endl;
958     }
959
960 #undef FLD
961 }
962
963 void
964 thumb_extract_sfmt_add_hd_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
965     thumb_insn_word insn = entire_insn;
966 #define FLD(f) abuf->fields.sfmt_addi.f
967     UINT f_rs;
968     UINT f_rd;
969
970     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
971     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
972
973   /* Record the fields for the semantic handler.  */
974   FLD (f_rd) = f_rd;
975   FLD (f_rs) = f_rs;
976   if (current_cpu->trace_extract_p)
977     {
978       current_cpu->trace_stream 
979         << "0x" << hex << pc << dec << " (sfmt_add_hd_rs)\t"
980         << " f_rd:0x" << hex << f_rd << dec
981         << " f_rs:0x" << hex << f_rs << dec
982         << endl;
983     }
984
985 #undef FLD
986 }
987
988 void
989 thumb_extract_sfmt_add_hd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
990     thumb_insn_word insn = entire_insn;
991 #define FLD(f) abuf->fields.sfmt_addi.f
992     UINT f_rs;
993     UINT f_rd;
994
995     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
996     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
997
998   /* Record the fields for the semantic handler.  */
999   FLD (f_rd) = f_rd;
1000   FLD (f_rs) = f_rs;
1001   if (current_cpu->trace_extract_p)
1002     {
1003       current_cpu->trace_stream 
1004         << "0x" << hex << pc << dec << " (sfmt_add_hd_hs)\t"
1005         << " f_rd:0x" << hex << f_rd << dec
1006         << " f_rs:0x" << hex << f_rs << dec
1007         << endl;
1008     }
1009
1010 #undef FLD
1011 }
1012
1013 void
1014 thumb_extract_sfmt_cmp_rd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1015     thumb_insn_word insn = entire_insn;
1016 #define FLD(f) abuf->fields.sfmt_addi.f
1017     UINT f_rs;
1018     UINT f_rd;
1019
1020     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1021     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1022
1023   /* Record the fields for the semantic handler.  */
1024   FLD (f_rs) = f_rs;
1025   FLD (f_rd) = f_rd;
1026   if (current_cpu->trace_extract_p)
1027     {
1028       current_cpu->trace_stream 
1029         << "0x" << hex << pc << dec << " (sfmt_cmp_rd_hs)\t"
1030         << " f_rs:0x" << hex << f_rs << dec
1031         << " f_rd:0x" << hex << f_rd << dec
1032         << endl;
1033     }
1034
1035 #undef FLD
1036 }
1037
1038 void
1039 thumb_extract_sfmt_cmp_hd_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1040     thumb_insn_word insn = entire_insn;
1041 #define FLD(f) abuf->fields.sfmt_addi.f
1042     UINT f_rs;
1043     UINT f_rd;
1044
1045     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1046     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1047
1048   /* Record the fields for the semantic handler.  */
1049   FLD (f_rd) = f_rd;
1050   FLD (f_rs) = f_rs;
1051   if (current_cpu->trace_extract_p)
1052     {
1053       current_cpu->trace_stream 
1054         << "0x" << hex << pc << dec << " (sfmt_cmp_hd_rs)\t"
1055         << " f_rd:0x" << hex << f_rd << dec
1056         << " f_rs:0x" << hex << f_rs << dec
1057         << endl;
1058     }
1059
1060 #undef FLD
1061 }
1062
1063 void
1064 thumb_extract_sfmt_cmp_hd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1065     thumb_insn_word insn = entire_insn;
1066 #define FLD(f) abuf->fields.sfmt_addi.f
1067     UINT f_rs;
1068     UINT f_rd;
1069
1070     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1071     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1072
1073   /* Record the fields for the semantic handler.  */
1074   FLD (f_rd) = f_rd;
1075   FLD (f_rs) = f_rs;
1076   if (current_cpu->trace_extract_p)
1077     {
1078       current_cpu->trace_stream 
1079         << "0x" << hex << pc << dec << " (sfmt_cmp_hd_hs)\t"
1080         << " f_rd:0x" << hex << f_rd << dec
1081         << " f_rs:0x" << hex << f_rs << dec
1082         << endl;
1083     }
1084
1085 #undef FLD
1086 }
1087
1088 void
1089 thumb_extract_sfmt_mov_rd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1090     thumb_insn_word insn = entire_insn;
1091 #define FLD(f) abuf->fields.sfmt_addi.f
1092     UINT f_rs;
1093     UINT f_rd;
1094
1095     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1096     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1097
1098   /* Record the fields for the semantic handler.  */
1099   FLD (f_rs) = f_rs;
1100   FLD (f_rd) = f_rd;
1101   if (current_cpu->trace_extract_p)
1102     {
1103       current_cpu->trace_stream 
1104         << "0x" << hex << pc << dec << " (sfmt_mov_rd_hs)\t"
1105         << " f_rs:0x" << hex << f_rs << dec
1106         << " f_rd:0x" << hex << f_rd << dec
1107         << endl;
1108     }
1109
1110 #undef FLD
1111 }
1112
1113 void
1114 thumb_extract_sfmt_mov_hd_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1115     thumb_insn_word insn = entire_insn;
1116 #define FLD(f) abuf->fields.sfmt_addi.f
1117     UINT f_rs;
1118     UINT f_rd;
1119
1120     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1121     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1122
1123   /* Record the fields for the semantic handler.  */
1124   FLD (f_rd) = f_rd;
1125   FLD (f_rs) = f_rs;
1126   if (current_cpu->trace_extract_p)
1127     {
1128       current_cpu->trace_stream 
1129         << "0x" << hex << pc << dec << " (sfmt_mov_hd_rs)\t"
1130         << " f_rd:0x" << hex << f_rd << dec
1131         << " f_rs:0x" << hex << f_rs << dec
1132         << endl;
1133     }
1134
1135 #undef FLD
1136 }
1137
1138 void
1139 thumb_extract_sfmt_mov_hd_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1140     thumb_insn_word insn = entire_insn;
1141 #define FLD(f) abuf->fields.sfmt_addi.f
1142     UINT f_rs;
1143     UINT f_rd;
1144
1145     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1146     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1147
1148   /* Record the fields for the semantic handler.  */
1149   FLD (f_rd) = f_rd;
1150   FLD (f_rs) = f_rs;
1151   if (current_cpu->trace_extract_p)
1152     {
1153       current_cpu->trace_stream 
1154         << "0x" << hex << pc << dec << " (sfmt_mov_hd_hs)\t"
1155         << " f_rd:0x" << hex << f_rd << dec
1156         << " f_rs:0x" << hex << f_rs << dec
1157         << endl;
1158     }
1159
1160 #undef FLD
1161 }
1162
1163 void
1164 thumb_extract_sfmt_bx_rs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1165     thumb_insn_word insn = entire_insn;
1166 #define FLD(f) abuf->fields.sfmt_addi.f
1167     UINT f_rs;
1168
1169     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1170
1171   /* Record the fields for the semantic handler.  */
1172   FLD (f_rs) = f_rs;
1173   if (current_cpu->trace_extract_p)
1174     {
1175       current_cpu->trace_stream 
1176         << "0x" << hex << pc << dec << " (sfmt_bx_rs)\t"
1177         << " f_rs:0x" << hex << f_rs << dec
1178         << endl;
1179     }
1180
1181 #undef FLD
1182 }
1183
1184 void
1185 thumb_extract_sfmt_bx_hs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1186     thumb_insn_word insn = entire_insn;
1187 #define FLD(f) abuf->fields.sfmt_addi.f
1188     UINT f_rs;
1189
1190     f_rs = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1191
1192   /* Record the fields for the semantic handler.  */
1193   FLD (f_rs) = f_rs;
1194   if (current_cpu->trace_extract_p)
1195     {
1196       current_cpu->trace_stream 
1197         << "0x" << hex << pc << dec << " (sfmt_bx_hs)\t"
1198         << " f_rs:0x" << hex << f_rs << dec
1199         << endl;
1200     }
1201
1202 #undef FLD
1203 }
1204
1205 void
1206 thumb_extract_sfmt_ldr_pc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1207     thumb_insn_word insn = entire_insn;
1208 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
1209     UINT f_bit10_rd;
1210     SI f_word8;
1211
1212     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1213     f_word8 = ((EXTRACT_LSB0_UINT (insn, 16, 7, 8)) << (2));
1214
1215   /* Record the fields for the semantic handler.  */
1216   FLD (f_word8) = f_word8;
1217   FLD (f_bit10_rd) = f_bit10_rd;
1218   if (current_cpu->trace_extract_p)
1219     {
1220       current_cpu->trace_stream 
1221         << "0x" << hex << pc << dec << " (sfmt_ldr_pc)\t"
1222         << " f_word8:0x" << hex << f_word8 << dec
1223         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
1224         << endl;
1225     }
1226
1227 #undef FLD
1228 }
1229
1230 void
1231 thumb_extract_sfmt_str (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1232     thumb_insn_word insn = entire_insn;
1233 #define FLD(f) abuf->fields.sfmt_str.f
1234     UINT f_ro;
1235     UINT f_rb;
1236     UINT f_rd;
1237
1238     f_ro = EXTRACT_LSB0_UINT (insn, 16, 8, 3);
1239     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1240     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1241
1242   /* Record the fields for the semantic handler.  */
1243   FLD (f_rb) = f_rb;
1244   FLD (f_rd) = f_rd;
1245   FLD (f_ro) = f_ro;
1246   if (current_cpu->trace_extract_p)
1247     {
1248       current_cpu->trace_stream 
1249         << "0x" << hex << pc << dec << " (sfmt_str)\t"
1250         << " f_rb:0x" << hex << f_rb << dec
1251         << " f_rd:0x" << hex << f_rd << dec
1252         << " f_ro:0x" << hex << f_ro << dec
1253         << endl;
1254     }
1255
1256 #undef FLD
1257 }
1258
1259 void
1260 thumb_extract_sfmt_ldr (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1261     thumb_insn_word insn = entire_insn;
1262 #define FLD(f) abuf->fields.sfmt_str.f
1263     UINT f_ro;
1264     UINT f_rb;
1265     UINT f_rd;
1266
1267     f_ro = EXTRACT_LSB0_UINT (insn, 16, 8, 3);
1268     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1269     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1270
1271   /* Record the fields for the semantic handler.  */
1272   FLD (f_rb) = f_rb;
1273   FLD (f_ro) = f_ro;
1274   FLD (f_rd) = f_rd;
1275   if (current_cpu->trace_extract_p)
1276     {
1277       current_cpu->trace_stream 
1278         << "0x" << hex << pc << dec << " (sfmt_ldr)\t"
1279         << " f_rb:0x" << hex << f_rb << dec
1280         << " f_ro:0x" << hex << f_ro << dec
1281         << " f_rd:0x" << hex << f_rd << dec
1282         << endl;
1283     }
1284
1285 #undef FLD
1286 }
1287
1288 void
1289 thumb_extract_sfmt_str_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1290     thumb_insn_word insn = entire_insn;
1291 #define FLD(f) abuf->fields.sfmt_str_imm.f
1292     SI f_offset5_7;
1293     UINT f_rb;
1294     UINT f_rd;
1295
1296     f_offset5_7 = ((EXTRACT_LSB0_UINT (insn, 16, 10, 5)) << (2));
1297     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1298     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1299
1300   /* Record the fields for the semantic handler.  */
1301   FLD (f_offset5_7) = f_offset5_7;
1302   FLD (f_rb) = f_rb;
1303   FLD (f_rd) = f_rd;
1304   if (current_cpu->trace_extract_p)
1305     {
1306       current_cpu->trace_stream 
1307         << "0x" << hex << pc << dec << " (sfmt_str_imm)\t"
1308         << " f_offset5_7:0x" << hex << f_offset5_7 << dec
1309         << " f_rb:0x" << hex << f_rb << dec
1310         << " f_rd:0x" << hex << f_rd << dec
1311         << endl;
1312     }
1313
1314 #undef FLD
1315 }
1316
1317 void
1318 thumb_extract_sfmt_ldr_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1319     thumb_insn_word insn = entire_insn;
1320 #define FLD(f) abuf->fields.sfmt_str_imm.f
1321     SI f_offset5_7;
1322     UINT f_rb;
1323     UINT f_rd;
1324
1325     f_offset5_7 = ((EXTRACT_LSB0_UINT (insn, 16, 10, 5)) << (2));
1326     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1327     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1328
1329   /* Record the fields for the semantic handler.  */
1330   FLD (f_offset5_7) = f_offset5_7;
1331   FLD (f_rb) = f_rb;
1332   FLD (f_rd) = f_rd;
1333   if (current_cpu->trace_extract_p)
1334     {
1335       current_cpu->trace_stream 
1336         << "0x" << hex << pc << dec << " (sfmt_ldr_imm)\t"
1337         << " f_offset5_7:0x" << hex << f_offset5_7 << dec
1338         << " f_rb:0x" << hex << f_rb << dec
1339         << " f_rd:0x" << hex << f_rd << dec
1340         << endl;
1341     }
1342
1343 #undef FLD
1344 }
1345
1346 void
1347 thumb_extract_sfmt_strb_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1348     thumb_insn_word insn = entire_insn;
1349 #define FLD(f) abuf->fields.sfmt_strb_imm.f
1350     UINT f_offset5;
1351     UINT f_rb;
1352     UINT f_rd;
1353
1354     f_offset5 = EXTRACT_LSB0_UINT (insn, 16, 10, 5);
1355     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1356     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1357
1358   /* Record the fields for the semantic handler.  */
1359   FLD (f_offset5) = f_offset5;
1360   FLD (f_rb) = f_rb;
1361   FLD (f_rd) = f_rd;
1362   if (current_cpu->trace_extract_p)
1363     {
1364       current_cpu->trace_stream 
1365         << "0x" << hex << pc << dec << " (sfmt_strb_imm)\t"
1366         << " f_offset5:0x" << hex << f_offset5 << dec
1367         << " f_rb:0x" << hex << f_rb << dec
1368         << " f_rd:0x" << hex << f_rd << dec
1369         << endl;
1370     }
1371
1372 #undef FLD
1373 }
1374
1375 void
1376 thumb_extract_sfmt_ldrb_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1377     thumb_insn_word insn = entire_insn;
1378 #define FLD(f) abuf->fields.sfmt_strb_imm.f
1379     UINT f_offset5;
1380     UINT f_rb;
1381     UINT f_rd;
1382
1383     f_offset5 = EXTRACT_LSB0_UINT (insn, 16, 10, 5);
1384     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1385     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1386
1387   /* Record the fields for the semantic handler.  */
1388   FLD (f_offset5) = f_offset5;
1389   FLD (f_rb) = f_rb;
1390   FLD (f_rd) = f_rd;
1391   if (current_cpu->trace_extract_p)
1392     {
1393       current_cpu->trace_stream 
1394         << "0x" << hex << pc << dec << " (sfmt_ldrb_imm)\t"
1395         << " f_offset5:0x" << hex << f_offset5 << dec
1396         << " f_rb:0x" << hex << f_rb << dec
1397         << " f_rd:0x" << hex << f_rd << dec
1398         << endl;
1399     }
1400
1401 #undef FLD
1402 }
1403
1404 void
1405 thumb_extract_sfmt_strh_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1406     thumb_insn_word insn = entire_insn;
1407 #define FLD(f) abuf->fields.sfmt_strh_imm.f
1408     SI f_offset5_6;
1409     UINT f_rb;
1410     UINT f_rd;
1411
1412     f_offset5_6 = ((EXTRACT_LSB0_UINT (insn, 16, 10, 5)) << (1));
1413     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1414     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1415
1416   /* Record the fields for the semantic handler.  */
1417   FLD (f_offset5_6) = f_offset5_6;
1418   FLD (f_rb) = f_rb;
1419   FLD (f_rd) = f_rd;
1420   if (current_cpu->trace_extract_p)
1421     {
1422       current_cpu->trace_stream 
1423         << "0x" << hex << pc << dec << " (sfmt_strh_imm)\t"
1424         << " f_offset5_6:0x" << hex << f_offset5_6 << dec
1425         << " f_rb:0x" << hex << f_rb << dec
1426         << " f_rd:0x" << hex << f_rd << dec
1427         << endl;
1428     }
1429
1430 #undef FLD
1431 }
1432
1433 void
1434 thumb_extract_sfmt_ldrh_imm (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1435     thumb_insn_word insn = entire_insn;
1436 #define FLD(f) abuf->fields.sfmt_strh_imm.f
1437     SI f_offset5_6;
1438     UINT f_rb;
1439     UINT f_rd;
1440
1441     f_offset5_6 = ((EXTRACT_LSB0_UINT (insn, 16, 10, 5)) << (1));
1442     f_rb = EXTRACT_LSB0_UINT (insn, 16, 5, 3);
1443     f_rd = EXTRACT_LSB0_UINT (insn, 16, 2, 3);
1444
1445   /* Record the fields for the semantic handler.  */
1446   FLD (f_offset5_6) = f_offset5_6;
1447   FLD (f_rb) = f_rb;
1448   FLD (f_rd) = f_rd;
1449   if (current_cpu->trace_extract_p)
1450     {
1451       current_cpu->trace_stream 
1452         << "0x" << hex << pc << dec << " (sfmt_ldrh_imm)\t"
1453         << " f_offset5_6:0x" << hex << f_offset5_6 << dec
1454         << " f_rb:0x" << hex << f_rb << dec
1455         << " f_rd:0x" << hex << f_rd << dec
1456         << endl;
1457     }
1458
1459 #undef FLD
1460 }
1461
1462 void
1463 thumb_extract_sfmt_str_sprel (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1464     thumb_insn_word insn = entire_insn;
1465 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
1466     UINT f_bit10_rd;
1467     SI f_word8;
1468
1469     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1470     f_word8 = ((EXTRACT_LSB0_UINT (insn, 16, 7, 8)) << (2));
1471
1472   /* Record the fields for the semantic handler.  */
1473   FLD (f_bit10_rd) = f_bit10_rd;
1474   FLD (f_word8) = f_word8;
1475   if (current_cpu->trace_extract_p)
1476     {
1477       current_cpu->trace_stream 
1478         << "0x" << hex << pc << dec << " (sfmt_str_sprel)\t"
1479         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
1480         << " f_word8:0x" << hex << f_word8 << dec
1481         << endl;
1482     }
1483
1484 #undef FLD
1485 }
1486
1487 void
1488 thumb_extract_sfmt_ldr_sprel (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1489     thumb_insn_word insn = entire_insn;
1490 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
1491     UINT f_bit10_rd;
1492     SI f_word8;
1493
1494     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1495     f_word8 = ((EXTRACT_LSB0_UINT (insn, 16, 7, 8)) << (2));
1496
1497   /* Record the fields for the semantic handler.  */
1498   FLD (f_word8) = f_word8;
1499   FLD (f_bit10_rd) = f_bit10_rd;
1500   if (current_cpu->trace_extract_p)
1501     {
1502       current_cpu->trace_stream 
1503         << "0x" << hex << pc << dec << " (sfmt_ldr_sprel)\t"
1504         << " f_word8:0x" << hex << f_word8 << dec
1505         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
1506         << endl;
1507     }
1508
1509 #undef FLD
1510 }
1511
1512 void
1513 thumb_extract_sfmt_lda_pc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1514     thumb_insn_word insn = entire_insn;
1515 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
1516     UINT f_bit10_rd;
1517     SI f_word8;
1518
1519     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1520     f_word8 = ((EXTRACT_LSB0_UINT (insn, 16, 7, 8)) << (2));
1521
1522   /* Record the fields for the semantic handler.  */
1523   FLD (f_word8) = f_word8;
1524   FLD (f_bit10_rd) = f_bit10_rd;
1525   if (current_cpu->trace_extract_p)
1526     {
1527       current_cpu->trace_stream 
1528         << "0x" << hex << pc << dec << " (sfmt_lda_pc)\t"
1529         << " f_word8:0x" << hex << f_word8 << dec
1530         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
1531         << endl;
1532     }
1533
1534 #undef FLD
1535 }
1536
1537 void
1538 thumb_extract_sfmt_lda_sp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1539     thumb_insn_word insn = entire_insn;
1540 #define FLD(f) abuf->fields.sfmt_ldr_pc.f
1541     UINT f_bit10_rd;
1542     SI f_word8;
1543
1544     f_bit10_rd = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1545     f_word8 = ((EXTRACT_LSB0_UINT (insn, 16, 7, 8)) << (2));
1546
1547   /* Record the fields for the semantic handler.  */
1548   FLD (f_word8) = f_word8;
1549   FLD (f_bit10_rd) = f_bit10_rd;
1550   if (current_cpu->trace_extract_p)
1551     {
1552       current_cpu->trace_stream 
1553         << "0x" << hex << pc << dec << " (sfmt_lda_sp)\t"
1554         << " f_word8:0x" << hex << f_word8 << dec
1555         << " f_bit10_rd:0x" << hex << f_bit10_rd << dec
1556         << endl;
1557     }
1558
1559 #undef FLD
1560 }
1561
1562 void
1563 thumb_extract_sfmt_add_sp (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1564     thumb_insn_word insn = entire_insn;
1565 #define FLD(f) abuf->fields.sfmt_add_sp.f
1566     SI f_sword7;
1567
1568     f_sword7 = ((EXTRACT_LSB0_UINT (insn, 16, 6, 7)) << (2));
1569
1570   /* Record the fields for the semantic handler.  */
1571   FLD (f_sword7) = f_sword7;
1572   if (current_cpu->trace_extract_p)
1573     {
1574       current_cpu->trace_stream 
1575         << "0x" << hex << pc << dec << " (sfmt_add_sp)\t"
1576         << " f_sword7:0x" << hex << f_sword7 << dec
1577         << endl;
1578     }
1579
1580 #undef FLD
1581 }
1582
1583 void
1584 thumb_extract_sfmt_push (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1585     thumb_insn_word insn = entire_insn;
1586 #define FLD(f) abuf->fields.sfmt_stmia.f
1587     UINT f_rlist;
1588
1589     f_rlist = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1590
1591   /* Record the fields for the semantic handler.  */
1592   FLD (f_rlist) = f_rlist;
1593   if (current_cpu->trace_extract_p)
1594     {
1595       current_cpu->trace_stream 
1596         << "0x" << hex << pc << dec << " (sfmt_push)\t"
1597         << " f_rlist:0x" << hex << f_rlist << dec
1598         << endl;
1599     }
1600
1601 #undef FLD
1602 }
1603
1604 void
1605 thumb_extract_sfmt_push_lr (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1606     thumb_insn_word insn = entire_insn;
1607 #define FLD(f) abuf->fields.sfmt_stmia.f
1608     UINT f_rlist;
1609
1610     f_rlist = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1611
1612   /* Record the fields for the semantic handler.  */
1613   FLD (f_rlist) = f_rlist;
1614   if (current_cpu->trace_extract_p)
1615     {
1616       current_cpu->trace_stream 
1617         << "0x" << hex << pc << dec << " (sfmt_push_lr)\t"
1618         << " f_rlist:0x" << hex << f_rlist << dec
1619         << endl;
1620     }
1621
1622 #undef FLD
1623 }
1624
1625 void
1626 thumb_extract_sfmt_pop (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1627     thumb_insn_word insn = entire_insn;
1628 #define FLD(f) abuf->fields.sfmt_stmia.f
1629     UINT f_rlist;
1630
1631     f_rlist = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1632
1633   /* Record the fields for the semantic handler.  */
1634   FLD (f_rlist) = f_rlist;
1635   if (current_cpu->trace_extract_p)
1636     {
1637       current_cpu->trace_stream 
1638         << "0x" << hex << pc << dec << " (sfmt_pop)\t"
1639         << " f_rlist:0x" << hex << f_rlist << dec
1640         << endl;
1641     }
1642
1643 #undef FLD
1644 }
1645
1646 void
1647 thumb_extract_sfmt_pop_pc (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1648     thumb_insn_word insn = entire_insn;
1649 #define FLD(f) abuf->fields.sfmt_stmia.f
1650     UINT f_rlist;
1651
1652     f_rlist = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1653
1654   /* Record the fields for the semantic handler.  */
1655   FLD (f_rlist) = f_rlist;
1656   if (current_cpu->trace_extract_p)
1657     {
1658       current_cpu->trace_stream 
1659         << "0x" << hex << pc << dec << " (sfmt_pop_pc)\t"
1660         << " f_rlist:0x" << hex << f_rlist << dec
1661         << endl;
1662     }
1663
1664 #undef FLD
1665 }
1666
1667 void
1668 thumb_extract_sfmt_stmia (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1669     thumb_insn_word insn = entire_insn;
1670 #define FLD(f) abuf->fields.sfmt_stmia.f
1671     UINT f_bit10_rb;
1672     UINT f_rlist;
1673
1674     f_bit10_rb = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1675     f_rlist = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1676
1677   /* Record the fields for the semantic handler.  */
1678   FLD (f_bit10_rb) = f_bit10_rb;
1679   FLD (f_rlist) = f_rlist;
1680   if (current_cpu->trace_extract_p)
1681     {
1682       current_cpu->trace_stream 
1683         << "0x" << hex << pc << dec << " (sfmt_stmia)\t"
1684         << " f_bit10_rb:0x" << hex << f_bit10_rb << dec
1685         << " f_rlist:0x" << hex << f_rlist << dec
1686         << endl;
1687     }
1688
1689 #undef FLD
1690 }
1691
1692 void
1693 thumb_extract_sfmt_ldmia (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1694     thumb_insn_word insn = entire_insn;
1695 #define FLD(f) abuf->fields.sfmt_stmia.f
1696     UINT f_bit10_rb;
1697     UINT f_rlist;
1698
1699     f_bit10_rb = EXTRACT_LSB0_UINT (insn, 16, 10, 3);
1700     f_rlist = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1701
1702   /* Record the fields for the semantic handler.  */
1703   FLD (f_bit10_rb) = f_bit10_rb;
1704   FLD (f_rlist) = f_rlist;
1705   if (current_cpu->trace_extract_p)
1706     {
1707       current_cpu->trace_stream 
1708         << "0x" << hex << pc << dec << " (sfmt_ldmia)\t"
1709         << " f_bit10_rb:0x" << hex << f_bit10_rb << dec
1710         << " f_rlist:0x" << hex << f_rlist << dec
1711         << endl;
1712     }
1713
1714 #undef FLD
1715 }
1716
1717 void
1718 thumb_extract_sfmt_beq (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1719     thumb_insn_word insn = entire_insn;
1720 #define FLD(f) abuf->fields.sfmt_beq.f
1721     SI f_soffset8;
1722
1723     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1724
1725   /* Record the fields for the semantic handler.  */
1726   FLD (i_soffset8) = f_soffset8;
1727   if (current_cpu->trace_extract_p)
1728     {
1729       current_cpu->trace_stream 
1730         << "0x" << hex << pc << dec << " (sfmt_beq)\t"
1731         << endl;
1732     }
1733
1734 #undef FLD
1735 }
1736
1737 void
1738 thumb_extract_sfmt_bcs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1739     thumb_insn_word insn = entire_insn;
1740 #define FLD(f) abuf->fields.sfmt_beq.f
1741     SI f_soffset8;
1742
1743     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1744
1745   /* Record the fields for the semantic handler.  */
1746   FLD (i_soffset8) = f_soffset8;
1747   if (current_cpu->trace_extract_p)
1748     {
1749       current_cpu->trace_stream 
1750         << "0x" << hex << pc << dec << " (sfmt_bcs)\t"
1751         << endl;
1752     }
1753
1754 #undef FLD
1755 }
1756
1757 void
1758 thumb_extract_sfmt_bmi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1759     thumb_insn_word insn = entire_insn;
1760 #define FLD(f) abuf->fields.sfmt_beq.f
1761     SI f_soffset8;
1762
1763     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1764
1765   /* Record the fields for the semantic handler.  */
1766   FLD (i_soffset8) = f_soffset8;
1767   if (current_cpu->trace_extract_p)
1768     {
1769       current_cpu->trace_stream 
1770         << "0x" << hex << pc << dec << " (sfmt_bmi)\t"
1771         << endl;
1772     }
1773
1774 #undef FLD
1775 }
1776
1777 void
1778 thumb_extract_sfmt_bvs (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1779     thumb_insn_word insn = entire_insn;
1780 #define FLD(f) abuf->fields.sfmt_beq.f
1781     SI f_soffset8;
1782
1783     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1784
1785   /* Record the fields for the semantic handler.  */
1786   FLD (i_soffset8) = f_soffset8;
1787   if (current_cpu->trace_extract_p)
1788     {
1789       current_cpu->trace_stream 
1790         << "0x" << hex << pc << dec << " (sfmt_bvs)\t"
1791         << endl;
1792     }
1793
1794 #undef FLD
1795 }
1796
1797 void
1798 thumb_extract_sfmt_bhi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1799     thumb_insn_word insn = entire_insn;
1800 #define FLD(f) abuf->fields.sfmt_beq.f
1801     SI f_soffset8;
1802
1803     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1804
1805   /* Record the fields for the semantic handler.  */
1806   FLD (i_soffset8) = f_soffset8;
1807   if (current_cpu->trace_extract_p)
1808     {
1809       current_cpu->trace_stream 
1810         << "0x" << hex << pc << dec << " (sfmt_bhi)\t"
1811         << endl;
1812     }
1813
1814 #undef FLD
1815 }
1816
1817 void
1818 thumb_extract_sfmt_bge (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1819     thumb_insn_word insn = entire_insn;
1820 #define FLD(f) abuf->fields.sfmt_beq.f
1821     SI f_soffset8;
1822
1823     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1824
1825   /* Record the fields for the semantic handler.  */
1826   FLD (i_soffset8) = f_soffset8;
1827   if (current_cpu->trace_extract_p)
1828     {
1829       current_cpu->trace_stream 
1830         << "0x" << hex << pc << dec << " (sfmt_bge)\t"
1831         << endl;
1832     }
1833
1834 #undef FLD
1835 }
1836
1837 void
1838 thumb_extract_sfmt_bgt (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1839     thumb_insn_word insn = entire_insn;
1840 #define FLD(f) abuf->fields.sfmt_beq.f
1841     SI f_soffset8;
1842
1843     f_soffset8 = ((((EXTRACT_LSB0_INT (insn, 16, 7, 8)) << (1))) + (((pc) + (4))));
1844
1845   /* Record the fields for the semantic handler.  */
1846   FLD (i_soffset8) = f_soffset8;
1847   if (current_cpu->trace_extract_p)
1848     {
1849       current_cpu->trace_stream 
1850         << "0x" << hex << pc << dec << " (sfmt_bgt)\t"
1851         << endl;
1852     }
1853
1854 #undef FLD
1855 }
1856
1857 void
1858 thumb_extract_sfmt_swi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1859     thumb_insn_word insn = entire_insn;
1860 #define FLD(f) abuf->fields.sfmt_swi.f
1861     UINT f_value8;
1862
1863     f_value8 = EXTRACT_LSB0_UINT (insn, 16, 7, 8);
1864
1865   /* Record the fields for the semantic handler.  */
1866   FLD (f_value8) = f_value8;
1867   if (current_cpu->trace_extract_p)
1868     {
1869       current_cpu->trace_stream 
1870         << "0x" << hex << pc << dec << " (sfmt_swi)\t"
1871         << " f_value8:0x" << hex << f_value8 << dec
1872         << endl;
1873     }
1874
1875 #undef FLD
1876 }
1877
1878 void
1879 thumb_extract_sfmt_b (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1880     thumb_insn_word insn = entire_insn;
1881 #define FLD(f) abuf->fields.sfmt_b.f
1882     SI f_offset11;
1883
1884     f_offset11 = ((((EXTRACT_LSB0_INT (insn, 16, 10, 11)) << (1))) + (((pc) + (4))));
1885
1886   /* Record the fields for the semantic handler.  */
1887   FLD (i_offset11) = f_offset11;
1888   if (current_cpu->trace_extract_p)
1889     {
1890       current_cpu->trace_stream 
1891         << "0x" << hex << pc << dec << " (sfmt_b)\t"
1892         << endl;
1893     }
1894
1895 #undef FLD
1896 }
1897
1898 void
1899 thumb_extract_sfmt_bl_hi (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1900     thumb_insn_word insn = entire_insn;
1901 #define FLD(f) abuf->fields.sfmt_bl_hi.f
1902     INT f_lbwl_hi;
1903
1904     f_lbwl_hi = EXTRACT_LSB0_INT (insn, 16, 10, 11);
1905
1906   /* Record the fields for the semantic handler.  */
1907   FLD (f_lbwl_hi) = f_lbwl_hi;
1908   if (current_cpu->trace_extract_p)
1909     {
1910       current_cpu->trace_stream 
1911         << "0x" << hex << pc << dec << " (sfmt_bl_hi)\t"
1912         << " f_lbwl_hi:0x" << hex << f_lbwl_hi << dec
1913         << endl;
1914     }
1915
1916 #undef FLD
1917 }
1918
1919 void
1920 thumb_extract_sfmt_bl_lo (thumb_scache* abuf, arm7f_cpu* current_cpu, PCADDR pc, thumb_insn_word base_insn, thumb_insn_word entire_insn){
1921     thumb_insn_word insn = entire_insn;
1922 #define FLD(f) abuf->fields.sfmt_bl_lo.f
1923     UINT f_lbwl_lo;
1924
1925     f_lbwl_lo = EXTRACT_LSB0_UINT (insn, 16, 10, 11);
1926
1927   /* Record the fields for the semantic handler.  */
1928   FLD (f_lbwl_lo) = f_lbwl_lo;
1929   if (current_cpu->trace_extract_p)
1930     {
1931       current_cpu->trace_stream 
1932         << "0x" << hex << pc << dec << " (sfmt_bl_lo)\t"
1933         << " f_lbwl_lo:0x" << hex << f_lbwl_lo << dec
1934         << endl;
1935     }
1936
1937 #undef FLD
1938 }
1939