void post_mountroot(char *bootfile, char *redirect) { int (*go2)(); int fd; /* Save the bootfile, just in case we need it again */ (void) strcpy(filename2, bootfile); for (;;) { if (boothowto & RB_ASKNAME) { char tmpname[MAXPATHLEN]; printf("Enter filename [%s]: ", bootfile); (void) cons_gets(tmpname, sizeof (tmpname)); if (tmpname[0] != '\0') (void) strcpy(bootfile, tmpname); } if (boothowto & RB_HALT) { printf("Boot halted.\n"); prom_enter_mon(); } if ((fd = openfile(bootfile)) == FAILURE) { /* * There are many reasons why this might've * happened .. but one of them is that we're * on the installation CD, and we need to * revector ourselves off to a different partition * of the CD. Check for the redirection file. */ if (redirect != NULL && read_redirect(redirect)) { /* restore bootfile */ (void) strcpy(bootfile, filename2); return; /*NOTREACHED*/ } printf("%s: cannot open %s\n", my_own_name, bootfile); boothowto |= RB_ASKNAME; /* restore bootfile */ (void) strcpy(bootfile, filename2); continue; } if ((go2 = readfile(fd, boothowto & RB_VERBOSE)) != (int(*)()) -1) { (void) close(fd); } else { printf("boot failed\n"); boothowto |= RB_ASKNAME; continue; } if (boothowto & RB_HALT) { printf("Boot halted before exit to 0x%p.\n", (void *)go2); prom_enter_mon(); } my_own_name = bootfile; dprintf("Calling exitto64(%p, %p)\n", (void *)go2, (void *)elfbootvecELF64); exitto64(go2, (void *)elfbootvecELF64); } }
void x86emu_single_step (void) { char s[1024]; int ps[10]; int ntok; int cmd; int done; int segment; int offset; static int breakpoint; static int noDecode = 1; char *p; if (DEBUG_BREAK()) { if (M.x86.saved_ip != breakpoint) { return; } else { M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; M.x86.debug |= DEBUG_TRACE_F; M.x86.debug &= ~DEBUG_BREAK_F; print_decoded_instruction (); X86EMU_trace_regs(); } } done=0; offset = M.x86.saved_ip; while (!done) { printk("-"); /*p = fgets(s, 1023, stdin); */ cons_gets(s); cmd = parse_line(s, ps, &ntok); switch(cmd) { case 'u': disassemble_forward(M.x86.saved_cs,(u16)offset,10); break; case 'd': if (ntok == 2) { segment = M.x86.saved_cs; offset = ps[1]; X86EMU_dump_memory(segment,(u16)offset,16); offset += 16; } else if (ntok == 3) { segment = ps[1]; offset = ps[2]; X86EMU_dump_memory(segment,(u16)offset,16); offset += 16; } else { segment = M.x86.saved_cs; X86EMU_dump_memory(segment,(u16)offset,16); offset += 16; } break; case 'c': M.x86.debug ^= DEBUG_TRACECALL_F; break; case 's': M.x86.debug ^= DEBUG_SVC_F | DEBUG_SYS_F | DEBUG_SYSINT_F; break; case 'r': X86EMU_trace_regs(); break; case 'x': X86EMU_trace_xregs(); break; case 'g': if (ntok == 2) { breakpoint = ps[1]; printk("breakpoint set to 0x%X\n", breakpoint); if (noDecode) { M.x86.debug |= DEBUG_DECODE_NOPRINT_F; } else { M.x86.debug &= ~DEBUG_DECODE_NOPRINT_F; } M.x86.debug &= ~DEBUG_TRACE_F; M.x86.debug |= DEBUG_BREAK_F; done = 1; } break; case 'q': M.x86.debug |= DEBUG_EXIT; return; case 'P': noDecode = (noDecode)?0:1; printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE"); break; case 't': case 0: done = 1; break; } } }