Lines Matching refs:ctx

83 	struct ppc_ctx ctx;  in disppc()  local
97 ctx.flags = flags; in disppc()
98 ctx.virtual = virtual; in disppc()
102 if (ctx.flags & F_RADOCTAL) { in disppc()
104 strcpy (ctx.radix_fmt, "O%o"); in disppc()
105 } else if (ctx.flags & F_RADUDECIMAL) { in disppc()
107 strcpy (ctx.radix_fmt, "%u"); in disppc()
108 } else if (ctx.flags & F_RADSDECIMAL) { in disppc()
110 strcpy (ctx.radix_fmt, "%d"); in disppc()
113 strcpy (ctx.radix_fmt, "0x%x"); in disppc()
116 if (ctx.virtual == 0) { in disppc()
117 ctx.virtual = memaddr; in disppc()
120 if (ctx.flags & F_SYMBOL) { in disppc()
122 ctx.flags &= ~F_SYMBOL; in disppc()
137 for (i = 0; i < num_instr; ++i, memaddr += 4, ctx.virtual += 4) { in disppc()
139 if (ctx.flags & F_LINENO) { in disppc()
140 if ((line_info_from_addr ((Elf32_Word) ctx.virtual, in disppc()
151 sprintf (ctx.data, "%08lx: ", (unsigned long) ctx.virtual); in disppc()
152 ctx.datalen = 10; in disppc()
155 if (ctx.flags & F_SYMBOL) { in disppc()
157 symbol_name_from_addr((Elf32_Word) ctx.virtual, in disppc()
164 symbol_name_from_addr((Elf32_Word) ctx.virtual, in disppc()
173 sprintf (&ctx.data[ctx.datalen], "<%s+", cursym); in disppc()
174 ctx.datalen = strlen (ctx.data); in disppc()
175 sprintf (&ctx.data[ctx.datalen], ctx.radix_fmt, symoffset); in disppc()
176 strcat (ctx.data, ">"); in disppc()
177 ctx.datalen = strlen (ctx.data); in disppc()
182 ctx.instr = INSTRUCTION (memaddr); in disppc()
184 if (ctx.flags & F_INSTR) { in disppc()
187 sprintf (&ctx.data[ctx.datalen], in disppc()
189 ((ctx.instr >> 24) & 0xff), in disppc()
190 ((ctx.instr >> 16) & 0xff), ((ctx.instr >> 8) & 0xff), in disppc()
191 (ctx.instr & 0xff)); in disppc()
192 ctx.datalen += 18; in disppc()
194 strcat (ctx.data, " "); in disppc()
195 ctx.datalen += 3; in disppc()
198 if ((ctx.op = find_opcode (ctx.instr)) == 0) { in disppc()
200 sprintf (&ctx.data[ctx.datalen], " .long 0x%08lx", in disppc()
201 ctx.instr); in disppc()
202 ctx.datalen += 24; in disppc()
203 (*pfunc) (ctx.data); in disppc()
207 if (((ctx.flags & F_SIMPLE) == 0) || in disppc()
208 (ctx.op->hfunc == 0) || in disppc()
209 ((*ctx.op->hfunc) (&ctx) == false)) { in disppc()
210 sprintf (&ctx.data[ctx.datalen], "%-7s ", ctx.op->name); in disppc()
211 ctx.datalen += 8; in disppc()
212 print_operands (&ctx); in disppc()
215 (*pfunc) (ctx.data); in disppc()
232 int print_operands (struct ppc_ctx *ctx) in print_operands() argument
246 for (field = 0; ctx->op->fields[field] != 0; ++field) { in print_operands()
247 if (ctx->op->fields[field] > n_operands) { in print_operands()
251 opr = &operands[ctx->op->fields[field] - 1]; in print_operands()
258 strcat (ctx->data, ","); in print_operands()
259 ctx->datalen++; in print_operands()
262 operand = (ctx->instr >> opr->shift) & ((1 << opr->bits) - 1); in print_operands()
269 if (ctx->op->hint & H_RELATIVE) in print_operands()
270 operand = (operand << 2) + (unsigned long) ctx->virtual; in print_operands()
275 sprintf (&ctx->data[ctx->datalen], "0x%lx", operand); in print_operands()
276 ctx->datalen = strlen (ctx->data); in print_operands()
279 if ((ctx->flags & F_SYMBOL) && in print_operands()
282 sprintf (&ctx->data[ctx->datalen], " <%s", symname); in print_operands()
284 strcat (ctx->data, "+"); in print_operands()
285 ctx->datalen = strlen (ctx->data); in print_operands()
286 sprintf (&ctx->data[ctx->datalen], ctx->radix_fmt, in print_operands()
289 strcat (ctx->data, ">"); in print_operands()
296 (opr->field == O_rA) && (ctx->op->hint & H_RA0_IS_0)) { in print_operands()
297 strcat (ctx->data, "0"); in print_operands()
299 sprintf (&ctx->data[ctx->datalen], "r%d", (short) operand); in print_operands()
303 strcat (ctx->data, ")"); in print_operands()
309 strcat (ctx->data, spr_name (operand)); in print_operands()
313 strcat (ctx->data, tbr_name (operand)); in print_operands()
319 strcat (ctx->data, "cr2"); in print_operands()
320 ctx->datalen += 3; in print_operands()
329 sprintf (&ctx->data[ctx->datalen], ctx->radix_fmt, in print_operands()
333 strcat (ctx->data, ")"); in print_operands()
338 strcat (ctx->data, "("); in print_operands()
343 ctx->datalen = strlen (ctx->data); in print_operands()
656 int handle_bc (struct ppc_ctx *ctx) in handle_bc() argument
673 if (get_operand_value(ctx->op, ctx->instr, O_BO, &bo) == false) in handle_bc()
676 if (get_operand_value(ctx->op, ctx->instr, O_BI, &bi) == false) in handle_bc()
680 ctx->op = &blt; in handle_bc()
681 sprintf (&ctx->data[ctx->datalen], "%-7s ", ctx->op->name); in handle_bc()
682 ctx->datalen += 8; in handle_bc()
683 print_operands (ctx); in handle_bc()
686 ctx->op = &bne; in handle_bc()
687 sprintf (&ctx->data[ctx->datalen], "%-7s ", ctx->op->name); in handle_bc()
688 ctx->datalen += 8; in handle_bc()
689 print_operands (ctx); in handle_bc()
692 ctx->op = &bdnz; in handle_bc()
693 sprintf (&ctx->data[ctx->datalen], "%-7s ", ctx->op->name); in handle_bc()
694 ctx->datalen += 8; in handle_bc()
695 print_operands (ctx); in handle_bc()