Exemplo n.º 1
0
int fault_inject(int spd)
{
	int ret = 0;
	int tid, spdid;

	entry_cnt++;
	printc("\nthread %d in SWIFI %ld (%d) ... TARGET_COMPONENT %d\n",
	       cos_get_thd_id(), cos_spd_id(), entry_cnt, spd);
	
	if (spd == 0) return 0;
	
	struct cos_regs r;
	
	for (tid = 1; tid <= MAX_NUM_THREADS; tid++) {
		spdid = cos_thd_cntl(COS_THD_FIND_SPD_TO_FLIP, tid, spd, 0);
		if (tid == IDLE_THD || spdid == -1) continue;
		counter++;
		printc("<<flip counter %lu>> flip the register in spd %d (thd %d)!!!\n", 
		       counter, spd, tid);
		cos_regs_read(tid, spdid, &r);
		cos_regs_print(&r);
		flip_all_regs(&r);
		/* cos_regs_print(&r); */
	}
	return 0;
}
Exemplo n.º 2
0
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *ip)
{
	if (regs_active) BUG();
	regs_active = 1;
	cos_regs_save(cos_get_thd_id(), spdid, fault_addr, &regs);
	printc("Thread %d faults in spd %d @ %p\n", 
	       cos_get_thd_id(), spdid, fault_addr);
	cos_regs_print(&regs);
	BUG(); 			/* no fault is a good fault currently */
//	sched_block(spdid, 0);
	return 0;
}
Exemplo n.º 3
0
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *orig_ip)
{
    if (regs_active) BUG();
    regs_active = 1;
    cos_regs_save(cos_get_thd_id(), spdid, fault_addr, &regs);
    printc("Thread %d faults in spd %d @ %p\n",
           cos_get_thd_id(), spdid, fault_addr);
    cos_regs_print(&regs);

    walk_stack_all(spdid, &regs);

    /* No fault is a good fault currently.  Thus if we get _any_
     * fault, we bomb out here.  Look into the stack-trace, as
     * that is where the problem is. */
    printc("Bombing out after fault.\n");
    BUG();

    return 0;
}
Exemplo n.º 4
0
int fault_page_fault_handler(spdid_t spdid, void *fault_addr, int flags, void *ip)
{
	unsigned long r_ip; 	/* the ip to return to */
	int tid = cos_get_thd_id();
	int i;

	/* START UNCOMMENT FOR FAULT INFO */
	if (regs_active) BUG();
	regs_active = 1;
	cos_regs_save(tid, spdid, fault_addr, &regs);
	printc("Thread %d faults in spd %d @ %p\n",
	       tid, spdid, fault_addr);
	cos_regs_print(&regs);
	regs_active = 0;

	for (i = 0 ; i < 5 ; i++)
		printc("Frame ip:%lx, sp:%lx\n",
		       cos_thd_cntl(COS_THD_INVFRM_IP, tid, i, 0),
		       cos_thd_cntl(COS_THD_INVFRM_SP, tid, i, 0));
	/* END UNCOMMENT FOR FAULT INFO */

	/* remove from the invocation stack the faulting component! */
	assert(!cos_thd_cntl(COS_THD_INV_FRAME_REM, tid, 1, 0));

	/* Manipulate the return address of the component that called
	 * the faulting component... */
	assert(r_ip = cos_thd_cntl(COS_THD_INVFRM_IP, tid, 1, 0));
	/* ...and set it to its value -8, which is the fault handler
	 * of the stub. */
	assert(!cos_thd_cntl(COS_THD_INVFRM_SET_IP, tid, 1, r_ip-8));

	/* 
	 * Look at the booter: when recover is happening, the sstub is
	 * set to 0x1, thus we should just wait till recovery is done.
	 */
	if ((int)ip == 1) failure_notif_wait(cos_spd_id(), spdid);
	else         failure_notif_fail(cos_spd_id(), spdid);

	return 0;
}