static int process_gdb_command(struct gdb_data *data, char *buf, int len) { #ifdef DEBUG_GDB printc("process_gdb_command: %s\n", buf); #endif switch (buf[0]) { case '?': /* Return target halt reason */ return run_final_status(data); case 'z': case 'Z': return set_breakpoint(data, buf[0] == 'Z', buf + 1); case 'r': /* Restart */ case 'R': return restart_program(data); case 'g': /* Read registers */ return read_registers(data); case 'G': /* Write registers */ return write_registers(data, buf + 1); case 'q': /* Query */ if (!strncmp(buf, "qRcmd,", 6)) return monitor_command(data, buf + 6); if (!strncmp(buf, "qSupported", 10)) return gdb_send_supported(data); break; case 'm': /* Read memory */ return read_memory(data, buf + 1); case 'M': /* Write memory */ return write_memory(data, buf + 1); case 'c': /* Continue */ return run(data, buf + 1); case 's': /* Single step */ return single_step(data, buf + 1); case 'k': /* kill */ return -1; } #ifdef DEBUG_GDB printc("process_gdb_command: unknown command %s\n", buf); #endif /* For unknown/unsupported packets, return an empty reply */ return gdb_send(data, ""); }
int main(void) { int exception = 0; init((CELL *)calloc(1024, 1), 256); assert(single_step() == -259); for (int i = 0; i < 10; i++) { printf("EP = %u\n", EP); single_step(); } printf("EP should now be 44\n"); if (EP != 44) { printf("Error in single_step() tests: EP = %"PRIu32"\n", EP); exit(1); } assert(exception == 0); printf("single_step() tests ran OK\n"); return 0; }
int main(void) { int exception = 0; init((CELL *)calloc(1024, 1), 256); start_ass(EP); ass(O_ZERO); ass(O_ONE); ass(O_MONE); ass(O_CELL); ass(O_MCELL); ass(O_ROT); ass(O_PLUS); ass(O_PLUS); ass(O_MINUS); ass(O_PLUS1); ass(O_MINUS1); ass(O_SWAP); ass(O_PLUSCELL); ass(O_MINUSCELL); ass(O_MONE); ass(O_CELL); ass(O_STAR); ass(O_SWAPMINUS); ass(O_SLASHMOD); ass(O_SLASH); ass(O_MONE); ass(O_MOD); ass(O_PLUS1); ass(O_CELLS); ass(O_SLASH2); ass(O_DROP); ass(O_CELL); ass(O_NEGATE); ass(O_ABS); ass(O_ABS); ass(O_ONE); ass(O_MAX); ass(O_MCELL); ass(O_MIN); ass(O_LITERALI); ilit(3); ass(O_SSLASHREM); ass(O_DROP); ass(O_LITERALI); ilit(-2); ass(O_USLASHMOD); assert(single_step() == -259); // load first instruction word for (size_t i = 0; i < sizeof(correct) / sizeof(correct[0]); i++) { show_data_stack(); printf("Correct stack: %s\n\n", correct[i - i / 5]); if (strcmp(correct[i - i / 5], val_data_stack())) { printf("Error in arithmetic tests: EP = %"PRIu32"\n", EP); exit(1); } single_step(); printf("I = %s\n", disass(I)); } assert(exception == 0); printf("Arithmetic tests ran OK\n"); return 0; }
/** Rewind the videofile to the beginning and take one step. */ void directx_videofile_server::rewind(void) { LONGLONG pos = 0; // Stop the stream so that we get the state to where we can jump // around. pause(); // Clear out the buffered frame. If we don't do this, the code // can hang when all of the buffers fill up in the filter graph. read_one_frame(0, _num_columns, 0, _num_rows, 1); // Seek to the beginning _pMediaSeeking->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); single_step(); }
// Returns 1 if the event matched, 0 if it did not. static int run_until_next_event(struct core *core, uint32_t thread_id) { int count = 0; cosim_mismatch = false; cosim_event_triggered = false; for (count = 0; count < 500 && !cosim_event_triggered; count++) single_step(core, thread_id); if (!cosim_event_triggered) { printf("Simulator program in infinite loop? No event occurred. Was expecting:\n"); print_cosim_expected(); } return cosim_event_triggered && !cosim_mismatch; }
void ldb_break(lua_State *state) { ldb_t *ldb; lua_pushstring(state, lua_tag); lua_gettable(state, LUA_REGISTRYINDEX); ldb = (ldb_t*)lua_touserdata(state, -1); if (ldb == NULL) { return; } ldb->state = state; if (ldb->step == 0) { single_step(ldb, 1); } ldb->step = 1; ldb->first = 1; ldb->call_depth = -1; }
static void step(unsigned start, unsigned end) { if (end > start) for (unsigned i = start; i < end; i++) { single_step(); printf("I = %s\n", disass(I)); if (I != O_NEXT00) { printf("Result: %d; correct result: %d\n\n", LOAD_CELL(SP), correct[i - i / 5]); if (correct[i - i / 5] != LOAD_CELL(SP)) { printf("Error in comparison tests: EP = %"PRIu32"\n", EP); exit(1); } (void)POP; // drop result of comparison } else putchar('\n'); } }
int main(void) { init((CELL *)malloc(1024), 256); start_ass(EP); ass(O_LESS); ass(O_LESS); ass(O_LESS); ass(O_LESS); ass(O_GREATER); ass(O_GREATER); ass(O_GREATER); ass(O_GREATER); ass(O_EQUAL); ass(O_EQUAL); ass(O_NEQUAL); ass(O_NEQUAL); ass(O_LESS0); ass(O_LESS0); ass(O_LESS0); ass(O_GREATER0); ass(O_GREATER0); ass(O_GREATER0); ass(O_EQUAL0); ass(O_EQUAL0); ass(O_ULESS); ass(O_ULESS); ass(O_ULESS); ass(O_ULESS); ass(O_UGREATER); ass(O_UGREATER); ass(O_UGREATER); ass(O_UGREATER); assert(single_step() == -259); // load first instruction word stack1(); // set up the stack with four standard pairs to compare step(0, 5); // do the < tests stack1(); step(5, 10); // do the > tests stack2(); // set up the stack with two standard pairs to compare step(10, 12); // do the = tests stack2(); step(12, 15); // do the <> tests stack3(); // set up the stack with three standard values step(15, 18); // do the 0< tests stack3(); step(18, 22); // do the 0> tests SP = S0; PUSH(237); PUSH(0); // set up the stack with two values step(22, 25); // do the 0= tests stack1(); // set up the stack with four standard pairs to compare step(25, 30); // do the U< tests stack1(); step(30, 35); // do the U> tests assert(exception == 0); printf("Comparison tests ran OK\n"); return 0; }
void test_rastxors(Raster *r) /***************************************************************************** * ****************************************************************************/ { Raster *bmr = &tcb.bytemap_raster; Raster *vbr = &tcb.verification_raster; Rastlib *rlib = r->lib; Coor x; Coor y; Pixel color; Ucoor width; Ucoor height; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * xor_in_card testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,xor_rast[0]) && !tcb.test_via_generics) { log_bypass("xor_in_card(), xor_to_ram(), xor_from_ram()"); goto XRAST_DONE; } /*------------------------------------------------------------------------ * xor_in_card testing.. *----------------------------------------------------------------------*/ if (r == &tcb.display_raster) { log_progress("Testing bypassed for xor_in_card(), current raster is " "primary display raster.\n\n"); goto XRAST_IN_CARD_DONE; } iteration_limit = (tcb.timing_only_run) ? XRAST_TIME_ITCOUNT : 1; log_start("Testing xor_in_card()...\n"); iteration_count = iteration_limit; clear_screen(); while (iteration_count--) { } log_end("...xor_in_card() testing complete.\n\n"); if (!single_step()) return; XRAST_IN_CARD_DONE: /*------------------------------------------------------------------------ * xor_to_ram testing.. *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? XRAST_TIME_ITCOUNT : 1; log_start("Testing xor_to_ram()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(bmr, 0); pj_set_rast(vbr, 0); rlib->wait_vsync(r); while (iteration_count--) { color = iteration_count + 1; for (x = 0; x < width; x += 2*(WPAT/3)) pj_set_rect(bmr, color, x, 0, WPAT/3, height); for (y = 0; y < height; y += 2*(HPAT/3)) pj_set_rect(r, ~color, 0, y, width, HPAT/3); time_it( pj_xor_rast(r, bmr); ); }
void test_segs(Raster *r) /***************************************************************************** * test put_hseg, get_hseg, put_vseg, get_vseg. ****************************************************************************/ { short iteration_count; short iteration_limit; short do_verify; Raster *bmr = &tcb.bytemap_raster; Rastlib *rlib = r->lib; PLANEPTR pixbuf; Coor x; Coor y; Coor seg1; Coor seg2; Coor seg3; Coor step; Ucoor width; Ucoor height; Segfunc_t put_hseg; Segfunc_t get_hseg; Segfunc_t put_vseg; Segfunc_t get_vseg; width = r->width - 1; height = r->height - 1; do_verify = !tcb.timing_only_run; /*----------------------------------------------------------------------- * hseg testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the hseg testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,put_hseg) && !tcb.test_via_generics) { log_bypass("put_hseg() and get_hseg()"); goto HSEG_DONE; } put_hseg = rlib->put_hseg; get_hseg = rlib->get_hseg; /*----------------------------------------------------------------------- * test put_hseg using short segments... *---------------------------------------------------------------------*/ clear_screen(); step = 1 + height / 8; seg1 = 0; seg2 = (width / 2) - (SHRTSEG_WIDTH / 2); seg3 = width - SHRTSEG_WIDTH; pixbuf = bmr->hw.bm.bp[0]; iteration_limit = (tcb.timing_only_run) ? HSSEG_TIME_ITCOUNT : 1; log_start("Testing put_hseg() using short line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { make_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1); time_start(); for (y = 0; y < height; y += step) { put_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); } y = height; put_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); time_end(); } log_end("...put_hseg() short segment testing completed.\n\n"); /*----------------------------------------------------------------------- * test get_hseg using short segments... *---------------------------------------------------------------------*/ log_start("Testing get_hseg() using short line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { time_start(); for (y = 0; y < height; y += step) { memset(pixbuf, 0, SHRTSEG_WIDTH); memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg1; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg2; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg3; goto HSEG_ERROR; } } y = height; memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg1; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg2; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg3; goto HSEG_ERROR; } time_end(); } log_end("...get_hseg() short segment testing completed.\n\n"); if (!single_step()) return; /*----------------------------------------------------------------------- * test put_hseg using full-line segments... *---------------------------------------------------------------------*/ pixbuf = bmr->hw.bm.bp[0]; x = 0; iteration_limit = (tcb.timing_only_run) ? HFSEG_TIME_ITCOUNT : 1; log_start("Testing put_hseg() using full-line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { make_ripple(bmr, width, 1, 0, 0, iteration_count, 1); time_start(); for (y = 0; y < height; y += step) { put_hseg(r, pixbuf, x, y, width); } put_hseg(r, pixbuf, x, height, width); time_end(); } log_end("...put_hseg() full-line segment testing completed.\n\n"); /*----------------------------------------------------------------------- * test get_hseg using full-line segments... *---------------------------------------------------------------------*/ log_start("Testing get_hseg() using full-line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { for (y = 0; y < height; y += step) { memset(pixbuf, 0, width); time_it( get_hseg(r, pixbuf, x, y, width); ); if (do_verify && !verify_ripple(bmr, width, 1, 0, 0, iteration_count, 1)) goto HSEG_ERROR; } memset(pixbuf, 0, width); memset(pixbuf, 0, width); time_it( get_hseg(r, pixbuf, x, height, width); );
/* * ptrace_slave() * Called by slave process when it detects a need to call the master * * Actually, it's called when it *appears* that a need exists; this * routine does locking and handles the case where it really wasn't * needed. * * XXX use "event" (pack into longs?), and allow them to clear it * unless it's the unblockable kill message. */ void ptrace_slave(char *event, uint why) { struct thread *t = curthread; struct proc *p = t->t_proc; struct portref *pr; port_t port; long args[3]; uint x; extern struct portref *find_portref(); retry: p_sema(&p->p_sema, PRIHI); /* * If we've raced with another thread doing the setup, just * continue. This would be a pretty chaotic situation anyway. */ if (p->p_dbg.pd_flags & PD_CONNECTING) { v_sema(&p->p_sema); return; } /* * If it appears we're the first to have seen this ptrace * request, do the initial connect and setup. Then start * over. */ if (p->p_dbg.pd_name && (p->p_dbg.pd_port == -1)) { ptrace_attach(); goto retry; } /* * Try to get our portref to the debug port. If it has * gone away, clear our debug environment and continue. * * After this block of code, we hold a semaphore for clients * on the named portref, and we have released our proc * semaphore. We are thus in a pretty good position to * interact at length with our debugger. */ port = p->p_dbg.pd_port; v_sema(&p->p_sema); pr = find_portref(p, port); if (pr == 0) { p_sema(&p->p_sema, PRIHI); /* * This could actually blow away a usable, new debug * session. C'est la vie. To get here you had to * hunt down your port and msg_disconnect() it yourself, * which is pretty hosed in itself. */ if (p->p_dbg.pd_port == port) { bzero(&p->p_dbg, sizeof(struct pdbg)); } v_sema(&p->p_sema); return; } /* * kernmsg_send() does this for itself. We hold the * semaphore, so we won't race with other I/O clients. * Since we have the lock, take this opportunity to * flag that this connection should never be dup'ed. */ pr->p_flags |= PF_NODUP; v_lock(&pr->p_lock, SPL0); /* * Return value is initially the bits which matched and * caused us to drop into ptrace_slave(). */ args[0] = why; args[1] = 0; for (;;) { /* * Build a message and send it */ if (kernmsg_send(pr, PD_SLAVE, args) < 0) { v_sema(&pr->p_sema); p_sema(&p->p_sema, PRIHI); (void)msg_disconnect(p->p_dbg.pd_port); bzero(&p->p_dbg, sizeof(struct pdbg)); v_sema(&p->p_sema); return; } /* * Act on his answer */ switch (args[2]) { case PD_RUN: /* Continue running */ v_sema(&pr->p_sema); return; case PD_STEP: /* Run for one step */ single_step(args[0]); break; case PD_BREAK: /* Set/clear breakpoint */ args[0] = set_break(args[1], args[0]); break; case PD_RDREG: /* Read register */ args[0] = getreg(args[0]); break; case PD_WRREG: /* Write register */ args[0] = setreg(args[0], args[1]); break; case PD_MASK: /* Set debug event mask */ p->p_dbg.pd_flags = args[0]; break; case PD_RDMEM: /* Read memory */ { ulong l; if (copyin((void *)args[0], &l, sizeof(l)) < 0) { args[1] = 1; } else { args[0] = l; args[1] = 0; } } break; case PD_WRMEM: /* Write memory */ if (copyout((void *)args[0], &args[1], sizeof(args[1]))) { args[1] = 1; } else { args[1] = 0; } args[0] = 0; break; case PD_MEVENT: /* Read/write event string */ x = args[0] & 0xFF; if (x > ERRLEN) { args[0] = -1; break; } if (args[0] & 0xFF00) { if (event) { event[x] = args[1]; } } else { if (event) { args[1] = event[x]; } else { args[1] = 0; } } break; case PD_PID: /* Tell him our PID/TID */ args[0] = p->p_pid; args[1] = t->t_pid; break; default: /* Bogus--drop him */ v_sema(&pr->p_sema); (void)msg_disconnect(port); p_sema(&p->p_sema, PRIHI); if (p->p_dbg.pd_port == port) { bzero(&p->p_dbg, sizeof(struct pdbg)); } v_sema(&p->p_sema); return; } } }
void test_rastblits(Raster *r) /***************************************************************************** * ****************************************************************************/ { Raster *bmr = &tcb.bytemap_raster; Raster *vbr = &tcb.verification_raster; Rastlib *rlib = r->lib; Coor x; Ucoor width; Ucoor height; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * blit_in_card testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,blitrect[0]) && !tcb.test_via_generics) { log_bypass("blit_in_card(), blit_to_ram(), blit_from_ram()"); goto RBLIT_DONE; } /*------------------------------------------------------------------------ * blit_in_card testing.. * clear the screen, then lay in a striped background before testing *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RBLIT_TIME_ITCOUNT : 1; log_start("Testing blit_in_card()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(vbr,0); for (x = 0; x+WPAT/3 <= width; x += 2*(WPAT/3)) { pj_set_rect(r, 1, x, 0, WPAT/3, height); pj_set_rect(vbr, 1, x, 0, WPAT/3, height); } rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(r, iteration_count, 0); time_start(); do_blits(r, r); time_end(); } draw_blitpattern(vbr, 0, 0); do_blits(vbr, vbr); verify_raster(r, vbr, TRUE); log_end("...blit_in_card() testing complete.\n\n"); if (!single_step()) goto RBLIT_DONE; /*------------------------------------------------------------------------ * blit_to_ram testing.. * clear the screen, lay in a striped background, blit background to ram *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RBLIT_TIME_ITCOUNT : 1; log_start("Testing blit_to_ram()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(bmr, 0); pj_set_rast(vbr, 0); for (x = 0; x+WPAT/3 <= width; x += 2*(WPAT/3)) { pj_set_rect(bmr, 1, x, 0, WPAT/3, height); pj_set_rect(vbr, 1, x, 0, WPAT/3, height); } rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(r, iteration_count, 0); time_start(); do_blits(r, bmr); time_end(); } draw_blitpattern(vbr, 0, 0); do_blits(vbr, vbr); verify_raster(bmr, vbr, TRUE); log_end("...blit_to_ram() testing complete.\n\n"); if (!single_step()) goto RBLIT_DONE; /*------------------------------------------------------------------------ * blit_from_ram testing.. * clear the screen, lay in a striped background *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RBLIT_TIME_ITCOUNT : 1; log_start("Testing blit_from_ram()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(bmr, 0); pj_set_rast(vbr, 0); for (x = 0; x+WPAT/3 <= width; x += 2*(WPAT/3)) { pj_set_rect(r, 1, x, 0, WPAT/3, height); pj_set_rect(vbr, 1, x, 0, WPAT/3, height); } rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(bmr, iteration_count, 0); time_start(); do_blits(bmr, r); time_end(); } draw_blitpattern(vbr, 0, 0); do_blits(vbr, vbr); verify_raster(r, vbr, TRUE); log_end("...blit_from_ram() testing complete.\n\n"); single_step(); RBLIT_DONE: return; }
/* * This function does all command processing for interfacing to gdb. It * returns 1 if you should skip the instruction at the trap address, 0 * otherwise. */ void gdb_stub_handle_exception(gdb_pt_regs *regs,int sigval) { int trap; /* Trap type */ int addr; int length; char *ptr; unsigned long *stack; /* * reply to host that an exception has occurred */ send_signal(sigval); /* * Wait for input from remote GDB */ while (1) { output_buffer[0] = 0; getpacket(input_buffer); switch (input_buffer[0]) { case '?': send_signal(sigval); continue; case 'd': /* toggle debug flag */ break; /* * Return the value of the CPU registers */ case 'g': gdb_stub_get_non_pt_regs(regs); ptr = output_buffer; ptr= mem2hex((char *)regs,ptr,sizeof(s390_regs_common),FALSE); ptr= mem2hex((char *)®s->crs[0],ptr,NUM_CRS*CR_SIZE,FALSE); ptr = mem2hex((char *)®s->fp_regs, ptr,sizeof(s390_fp_regs)); break; /* * set the value of the CPU registers - return OK * FIXME: Needs to be written */ case 'G': ptr=input_buffer; hex2mem (ptr, (char *)regs,sizeof(s390_regs_common), FALSE); ptr+=sizeof(s390_regs_common)*2; hex2mem (ptr, (char *)regs->crs[0],NUM_CRS*CR_SIZE, FALSE); ptr+=NUM_CRS*CR_SIZE*2; hex2mem (ptr, (char *)regs->fp_regs,sizeof(s390_fp_regs), FALSE); gdb_stub_set_non_pt_regs(regs); strcpy(output_buffer,"OK"); break; /* * mAA..AA,LLLL Read LLLL bytes at address AA..AA */ case 'm': ptr = &input_buffer[1]; if (hexToInt(&ptr, &addr) && *ptr++ == ',' && hexToInt(&ptr, &length)) { if (mem2hex((char *)addr, output_buffer, length, 1)) break; strcpy (output_buffer, "E03"); } else strcpy(output_buffer,"E01"); break; /* * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ case 'M': ptr = &input_buffer[1]; if (hexToInt(&ptr, &addr) && *ptr++ == ',' && hexToInt(&ptr, &length) && *ptr++ == ':') { if (hex2mem(ptr, (char *)addr, length, 1)) strcpy(output_buffer, "OK"); else strcpy(output_buffer, "E03"); } else strcpy(output_buffer, "E02"); break; /* * cAA..AA Continue at address AA..AA(optional) */ case 'c': /* try to read optional parameter, pc unchanged if no parm */ ptr = &input_buffer[1]; if (hexToInt(&ptr, &addr)) regs->cp0_epc = addr; /* * Need to flush the instruction cache here, as we may * have deposited a breakpoint, and the icache probably * has no way of knowing that a data ref to some location * may have changed something that is in the instruction * cache. * NB: We flush both caches, just to be sure... */ flush_cache_all(); return; /* NOTREACHED */ break; /* * kill the program */ case 'k' : break; /* do nothing */ /* * Reset the whole machine (FIXME: system dependent) */ case 'r': break; /* * Step to next instruction */ case 's': /* * There is no single step insn in the MIPS ISA, so we * use breakpoints and continue, instead. */ single_step(regs); flush_cache_all(); return; /* NOTREACHED */ } break; } /* switch */ /* * reply to the request */ putpacket(output_buffer); } /* while */
void test_mask1blit(Raster *r) /***************************************************************************** * ****************************************************************************/ { Rastlib *rlib = r->lib; Raster *vbr = &tcb.verification_raster; Coor x; Coor y; Coor xstart; Coor width; Coor height; Pixel color; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * mask1blit testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,mask1blit) && !tcb.test_via_generics) { log_bypass("mask1blit()"); goto M1BLIT_DONE; } /*----------------------------------------------------------------------- * test mask1blit... *---------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? MASK1_TIME_ITCOUNT : 1; log_start("Testing mask1blit()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(vbr,0); for (x = 0; x+MBPW/3 <= width; x += 2*(MBPW/3)) { pj_set_rect(r, 1, x, 0, MBPW/3, height); pj_set_rect(vbr, 1, x, 0, MBPW/3, height); } rlib->wait_vsync(r); time_start(); while (iteration_count--) { color = iteration_count * 3; for (y = -MBPH+3, xstart = -MBPW; y < height+MBPH; y += MBPH, xstart +=1) { for (x=xstart; x < width+MBPW; x+=MBPW) { ++color; pj_mask1blit(markBitmap, MBPR, 0, 0, r, x, y, MBPW, MBPH, color); } } } time_end(); /* build the verification raster... */ color = 0; for (y = -MBPH+3, xstart = -MBPW; y < height+MBPH; y += MBPH, xstart +=1) { for (x=xstart; x < width+MBPW; x+=MBPW) { ++color; pj_mask1blit(markBitmap, MBPR, 0, 0, vbr, x, y, MBPW, MBPH, color); } } verify_raster(r, vbr, TRUE); M1BLIT_EXIT: log_end("...testing of mask1blit() complete.\n\n"); single_step(); M1BLIT_DONE: return; }