147 }
148
149 // print annotations (instruction control bits)
150 void Disassembler::annotate(address here, outputStream* st) {
151 // Currently, annotation doesn't work when decoding error files.
152 // When decoding an instruction from a hs_err file, the given
153 // instruction address 'start' points to the instruction's virtual address
154 // which is not equal to the address where the instruction is located.
155 // Therefore, we will either crash or decode garbage.
156 if (is_decode_error_file()) {
157 return;
158 }
159
160 uint32_t instruction = *(uint32_t*)here;
161
162 // Align at next tab position.
163 const uint tabspacing = 8;
164 const uint pos = st->position();
165 const uint aligned_pos = ((pos+tabspacing-1)/tabspacing)*tabspacing;
166
167 if (MacroAssembler::is_bcxx(instruction)) {
168 st->print(",bo=0b");
169 print_instruction_bits(st, instruction, 6, 10);
170 print_decoded_bo_bits(st, instruction, 10);
171 } else if (MacroAssembler::is_bctr(instruction) ||
172 MacroAssembler::is_bctrl(instruction) ||
173 MacroAssembler::is_bclr(instruction)) {
174 st->fill_to(aligned_pos);
175 st->print("bo=0b");
176 print_instruction_bits(st, instruction, 6, 10);
177 print_decoded_bo_bits(st, instruction, 10);
178 st->print(",bh=0b");
179 print_instruction_bits(st, instruction, 19, 20);
180 print_decoded_bh_bits(st, instruction, 20,
181 !(MacroAssembler::is_bctr(instruction) ||
182 MacroAssembler::is_bctrl(instruction)));
183 } else if (MacroAssembler::is_trap_should_not_reach_here(instruction)) {
184 st->fill_to(aligned_pos + tabspacing);
185 st->print(";trap: should not reach here");
186 } else if (MacroAssembler::is_trap_null_check(instruction)) {
187 st->fill_to(aligned_pos + tabspacing);
188 st->print(";trap: null check");
189 } else if (MacroAssembler::is_trap_range_check(instruction)) {
190 st->fill_to(aligned_pos + tabspacing);
191 st->print(";trap: range check");
192 } else if (MacroAssembler::is_trap_ic_miss_check(instruction)) {
193 st->fill_to(aligned_pos + tabspacing);
194 st->print(";trap: ic miss check");
195 } else if (MacroAssembler::is_trap_zombie_not_entrant(instruction)) {
196 st->fill_to(aligned_pos + tabspacing);
197 st->print(";trap: zombie");
198 }
199 }
|
147 }
148
149 // print annotations (instruction control bits)
150 void Disassembler::annotate(address here, outputStream* st) {
151 // Currently, annotation doesn't work when decoding error files.
152 // When decoding an instruction from a hs_err file, the given
153 // instruction address 'start' points to the instruction's virtual address
154 // which is not equal to the address where the instruction is located.
155 // Therefore, we will either crash or decode garbage.
156 if (is_decode_error_file()) {
157 return;
158 }
159
160 uint32_t instruction = *(uint32_t*)here;
161
162 // Align at next tab position.
163 const uint tabspacing = 8;
164 const uint pos = st->position();
165 const uint aligned_pos = ((pos+tabspacing-1)/tabspacing)*tabspacing;
166
167 int stop_type = -1;
168
169 if (MacroAssembler::is_bcxx(instruction)) {
170 st->print(",bo=0b");
171 print_instruction_bits(st, instruction, 6, 10);
172 print_decoded_bo_bits(st, instruction, 10);
173 } else if (MacroAssembler::is_bctr(instruction) ||
174 MacroAssembler::is_bctrl(instruction) ||
175 MacroAssembler::is_bclr(instruction)) {
176 st->fill_to(aligned_pos);
177 st->print("bo=0b");
178 print_instruction_bits(st, instruction, 6, 10);
179 print_decoded_bo_bits(st, instruction, 10);
180 st->print(",bh=0b");
181 print_instruction_bits(st, instruction, 19, 20);
182 print_decoded_bh_bits(st, instruction, 20,
183 !(MacroAssembler::is_bctr(instruction) ||
184 MacroAssembler::is_bctrl(instruction)));
185 } else if (MacroAssembler::is_trap_null_check(instruction)) {
186 st->fill_to(aligned_pos + tabspacing);
187 st->print(";trap: null check");
188 } else if (MacroAssembler::is_trap_range_check(instruction)) {
189 st->fill_to(aligned_pos + tabspacing);
190 st->print(";trap: range check");
191 } else if (MacroAssembler::is_trap_ic_miss_check(instruction)) {
192 st->fill_to(aligned_pos + tabspacing);
193 st->print(";trap: ic miss check");
194 } else if ((stop_type = MacroAssembler::tdi_get_si16(instruction, Assembler::traptoUnconditional, 0)) != -1) {
195 st->fill_to(aligned_pos + tabspacing);
196 st->print(";trap: stop type %d", stop_type);
197 }
198 }
|