Lines Matching +full:patch +full:- +full:address

19  * 3. Neither the names of the above-listed copyright holders nor the names
66 typedef struct patch { struct
67 STAILQ_ENTRY(patch) links;
74 STAILQ_HEAD(patch_list, patch) patches; argument
81 static void emit_patch(scope_t *scope, int patch);
134 sentinal->type = SCOPE_ROOT; in main()
146 while ((ch = getopt(argc, argv, "d:i:l:n:o:p:r:I:")) != -1) { in main()
157 fprintf(stderr, "%s: -d Requires either an " in main()
162 stop("-d: Assembler not built with debugging " in main()
178 /* Don't complain about the -nostdinc directrive */ in main()
180 fprintf(stderr, "%s: Unknown option -%c%s\n", in main()
212 if (strcmp(optarg, "-") == 0) { in main()
214 fprintf(stderr, "%s: Warning - '-I-' " in main()
224 * All entries before a '-I-' only in main()
228 include_dir->quoted_includes_only = 1; in main()
236 include_dir->directory = strdup(optarg); in main()
237 if (include_dir->directory == NULL) { in main()
241 include_dir->quoted_includes_only = 0; in main()
253 argc -= optind; in main()
265 "%s: The -p option requires the -r and -i options.\n", in main()
276 || SLIST_FIRST(&scope_stack)->type != SCOPE_ROOT) { in main()
291 /* Patch up forward jump addresses */ in main()
312 "usage: %-16s [-nostdinc] [-I-] [-I directory] [-o output_file]\n" in usage()
313 " [-r register_output_file [-p register_diag_file -i includefile]]\n" in usage()
314 " [-l program_list_file]\n" in usage()
327 if (cur_instr->patch_label != NULL) { in back_patch()
329 u_int address; in back_patch() local
331 if (cur_instr->patch_label->type != LABEL) { in back_patch()
336 cur_instr->patch_label->name); in back_patch()
340 f3_instr = &cur_instr->format.format3; in back_patch()
341 address = f3_instr->address; in back_patch()
342 address += cur_instr->patch_label->info.linfo->address; in back_patch()
343 f3_instr->address = address; in back_patch()
360 " * DO NOT EDIT - This file is automatically generated\n" in output_code()
373 cur_instr->format.bytes[0], in output_code()
374 cur_instr->format.bytes[1], in output_code()
375 cur_instr->format.bytes[2], in output_code()
376 cur_instr->format.bytes[3]); in output_code()
378 cur_instr->format.bytes[3], in output_code()
379 cur_instr->format.bytes[2], in output_code()
380 cur_instr->format.bytes[1], in output_code()
381 cur_instr->format.bytes[0]); in output_code()
388 stop("Patch argument list not defined", in output_code()
392 * Output patch information. Patch functions first. in output_code()
410 cur_node->symbol->info.condinfo->func_num, in output_code()
412 cur_node->symbol->info.condinfo->func_num, in output_code()
414 cur_node->symbol->name); in output_code()
418 "static const struct patch {\n" in output_code()
431 cur_patch->patch_func, cur_patch->begin, in output_code()
432 cur_patch->skip_instr, cur_patch->skip_patch); in output_code()
448 cs->begin_addr, cs->end_addr); in output_code()
465 * Emit the first patch for this scope in dump_scope()
472 cur_scope = TAILQ_FIRST(&scope->inner_scope); in dump_scope()
482 * Emit the second, closing, patch for this scope in dump_scope()
488 emit_patch(scope_t *scope, int patch) in emit_patch() argument
493 pinfo = &scope->patches[patch]; in emit_patch()
495 if (pinfo->skip_instr == 0) in emit_patch()
496 /* No-Op patch */ in emit_patch()
502 stop("Could not malloc patch structure", EX_OSERR); in emit_patch()
506 if (patch == 0) { in emit_patch()
507 new_patch->patch_func = scope->func_num; in emit_patch()
508 new_patch->begin = scope->begin_addr; in emit_patch()
510 new_patch->patch_func = 0; in emit_patch()
511 new_patch->begin = scope->end_addr; in emit_patch()
513 new_patch->skip_instr = pinfo->skip_instr; in emit_patch()
514 new_patch->skip_patch = pinfo->skip_patch; in emit_patch()
558 func_count--; in output_listing()
568 cur_func = SLIST_NEXT(cur_func, links), func_count--) { in output_listing()
571 fprintf(stdout, "\n(%s)\n", cur_func->symbol->name); in output_listing()
603 /* Don't count this instruction as it is in a patch in output_listing()
609 while (line < cur_instr->srcline) { in output_listing()
616 cur_instr->format.bytes[0], in output_listing()
617 cur_instr->format.bytes[1], in output_listing()
618 cur_instr->format.bytes[2], in output_listing()
619 cur_instr->format.bytes[3]); in output_listing()
621 cur_instr->format.bytes[3], in output_listing()
622 cur_instr->format.bytes[2], in output_listing()
623 cur_instr->format.bytes[1], in output_listing()
624 cur_instr->format.bytes[0]); in output_listing()
631 if (line == cur_instr->srcline) { in output_listing()
655 while (cur_patch != NULL && start_instr == cur_patch->begin) { in check_patch()
656 if (func_vals[cur_patch->patch_func] == 0) { in check_patch()
660 *skip_addr = start_instr + cur_patch->skip_instr; in check_patch()
661 for (skip = cur_patch->skip_patch; in check_patch()
663 skip--) in check_patch()
666 /* Accepted this patch. Advance to the next in check_patch()
692 fprintf(stderr, "Stopped at file %s, line %d - ", in stop()
741 new_instr->srcline = yylineno; in seq_alloc()
768 TAILQ_INIT(&new_scope->inner_scope); in scope_alloc()
771 TAILQ_INSERT_TAIL(&SLIST_FIRST(&scope_stack)->inner_scope, in scope_alloc()
774 /* This patch is now the current scope */ in scope_alloc()
791 cur_scope = TAILQ_LAST(&scope->inner_scope, scope_tailq); in process_scope()
798 switch (cur_scope->type) { in process_scope()
802 /* Create a tail patch */ in process_scope()
804 cur_scope->patches[1].skip_patch = in process_scope()
806 cur_scope->patches[1].skip_instr = in process_scope()
810 /* Count Head patch */ in process_scope()
814 patch0_patch_skip += cur_scope->inner_scope_patches; in process_scope()
816 cur_scope->patches[0].skip_patch = patch0_patch_skip; in process_scope()
817 cur_scope->patches[0].skip_instr = in process_scope()
818 cur_scope->end_addr - cur_scope->begin_addr; in process_scope()
820 skip_instr_count += cur_scope->patches[0].skip_instr; in process_scope()
823 if (cur_scope->type == SCOPE_IF) { in process_scope()
824 scope->inner_scope_patches += skip_patch_count; in process_scope()
831 skip_patch_count += cur_scope->inner_scope_patches; in process_scope()
833 skip_instr_count += cur_scope->end_addr in process_scope()
834 - cur_scope->begin_addr; in process_scope()