Example #1
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{

	*regsz = gdb_cpu_regsz(regnum);

	if (kdb_thread  == curthread) {
		switch (regnum) {
		case 0:	return (&kdb_frame->tf_rax);
		case 2:	return (&kdb_frame->tf_rcx);
		case 3:	return (&kdb_frame->tf_rdx);
		case 4:	return (&kdb_frame->tf_rsi);
		case 5:	return (&kdb_frame->tf_rdi);
		case 8: return (&kdb_frame->tf_r8);
		case 9: return (&kdb_frame->tf_r9);
		case 10: return (&kdb_frame->tf_r10);
		case 11: return (&kdb_frame->tf_r11);
		case 17: return (&kdb_frame->tf_rflags);
		case 18: return (&kdb_frame->tf_cs);
		case 19: return (&kdb_frame->tf_ss);
		}
	}
	switch (regnum) {
	case 1:  return (&kdb_thrctx->pcb_rbx);
	case 6:  return (&kdb_thrctx->pcb_rbp);
	case 7:  return (&kdb_thrctx->pcb_rsp);
	case 12: return (&kdb_thrctx->pcb_r12);
	case 13: return (&kdb_thrctx->pcb_r13);
	case 14: return (&kdb_thrctx->pcb_r14);
	case 15: return (&kdb_thrctx->pcb_r15);
	case 16: return (&kdb_thrctx->pcb_rip);
	}
	return (NULL);
}
Example #2
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{

 	*regsz = gdb_cpu_regsz(regnum);
 	if (kdb_thread  == PCPU_GET(curthread)) {
		switch (regnum) {
		/*
		* XXX: May need to add more registers 
		*/
		case 2: return (&kdb_frame->v0);
		case 3: return (&kdb_frame->v1);
		}
	}
	switch (regnum) {
	case 16: return (&kdb_thrctx->pcb_context[0]);
	case 17: return (&kdb_thrctx->pcb_context[1]);
	case 18: return (&kdb_thrctx->pcb_context[2]);
	case 19: return (&kdb_thrctx->pcb_context[3]);
	case 20: return (&kdb_thrctx->pcb_context[4]);
	case 21: return (&kdb_thrctx->pcb_context[5]);
	case 22: return (&kdb_thrctx->pcb_context[6]);
	case 23: return (&kdb_thrctx->pcb_context[7]);
	case 29: return (&kdb_thrctx->pcb_context[8]);
	case 30: return (&kdb_thrctx->pcb_context[9]);
	case 31: return (&kdb_thrctx->pcb_context[10]);
	}
	return (NULL);
}
Example #3
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{

	*regsz = gdb_cpu_regsz(regnum);

	if (kdb_thread  == curthread) {
		if (regnum < 16)
			return (&kdb_frame->tf_r0 + 4 * regnum);
		if (regnum == 25)
			return (&kdb_frame->tf_spsr);
	}
	switch (regnum) {
	case 8:  return (&kdb_thrctx->un_32.pcb32_r8);
	case 9:  return (&kdb_thrctx->un_32.pcb32_r9);
	case 10:  return (&kdb_thrctx->un_32.pcb32_r10);
	case 11:  return (&kdb_thrctx->un_32.pcb32_r11);
	case 12:  return (&kdb_thrctx->un_32.pcb32_r12);
	case 13:  stacktest = kdb_thrctx->un_32.pcb32_sp + 5 * 4;
		  return (&stacktest);
	case 15: 
		  /* 
		   * On context switch, the PC is not put in the PCB, but
		   * we can retrieve it from the stack.
		   */
		  if (kdb_thrctx->un_32.pcb32_sp > KERNBASE) {
			  kdb_thrctx->un_32.pcb32_pc = *(register_t *)
			      (kdb_thrctx->un_32.pcb32_sp + 4 * 4);
			  return (&kdb_thrctx->un_32.pcb32_pc);
		  }
	}
	return (NULL);
}
Example #4
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{

	*regsz = gdb_cpu_regsz(regnum);
	switch (regnum) {
	case 9:  return (&kdb_thrctx->pcb_context[0]);
	case 10: return (&kdb_thrctx->pcb_context[1]);
	case 11: return (&kdb_thrctx->pcb_context[2]);
	case 12: return (&kdb_thrctx->pcb_context[3]);
	case 13: return (&kdb_thrctx->pcb_context[4]);
	case 14: return (&kdb_thrctx->pcb_context[5]);
	case 15: return (&kdb_thrctx->pcb_context[6]);
	case 30: return (&kdb_thrctx->pcb_hw.apcb_ksp);
	case 64: return (&kdb_thrctx->pcb_context[7]);
	}
	return (NULL);
}
Example #5
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
	static uint64_t synth;

	*regsz = gdb_cpu_regsz(regnum);
	switch (regnum) {
		/* 0-7: g0-g7 */
		/* 8-15: o0-o7 */
	case 14:
		synth = kdb_thrctx->pcb_sp - CCFSZ;
		return (&synth);
		/* 16-23: l0-l7 */
		/* 24-31: i0-i7 */
	case 30: return (&kdb_thrctx->pcb_sp);
		/* 32-63: f0-f31 */
		/* 64-79: f32-f62 (16 double FP) */	
	case 80: return (&kdb_thrctx->pcb_pc);
	}
	return (NULL);
}
Example #6
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
	static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL);
	static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL);

	*regsz = gdb_cpu_regsz(regnum);

	if (kdb_thread  == curthread) {
		switch (regnum) {
		case 0:	return (&kdb_frame->tf_rax);
		case 2:	return (&kdb_frame->tf_rcx);
		case 3:	return (&kdb_frame->tf_rdx);
		case 4:	return (&kdb_frame->tf_rsi);
		case 5:	return (&kdb_frame->tf_rdi);
		case 8: return (&kdb_frame->tf_r8);
		case 9: return (&kdb_frame->tf_r9);
		case 10: return (&kdb_frame->tf_r10);
		case 11: return (&kdb_frame->tf_r11);
		case 17: return (&kdb_frame->tf_rflags);
		case 18: return (&kdb_frame->tf_cs);
		case 19: return (&kdb_frame->tf_ss);
		}
	}
	switch (regnum) {
	case 1:  return (&kdb_thrctx->pcb_rbx);
	case 6:  return (&kdb_thrctx->pcb_rbp);
	case 7:  return (&kdb_thrctx->pcb_rsp);
	case 12: return (&kdb_thrctx->pcb_r12);
	case 13: return (&kdb_thrctx->pcb_r13);
	case 14: return (&kdb_thrctx->pcb_r14);
	case 15: return (&kdb_thrctx->pcb_r15);
	case 16: return (&kdb_thrctx->pcb_rip);
	case 18: return (&_kcodesel);
	case 19: return (&_kdatasel);
	}
	return (NULL);
}
Example #7
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{

	*regsz = gdb_cpu_regsz(regnum);

	if (kdb_thread  == curthread) {
		switch (regnum) {
		case 0:	return (&kdb_frame->tf_eax);
		case 1:	return (&kdb_frame->tf_ecx);
		case 2:	return (&kdb_frame->tf_edx);
		}
	}
	switch (regnum) {
	case 3:  return (&kdb_thrctx->pcb_ebx);
	case 4:  return (&kdb_thrctx->pcb_esp);
	case 5:  return (&kdb_thrctx->pcb_ebp);
	case 6:  return (&kdb_thrctx->pcb_esi);
	case 7:  return (&kdb_thrctx->pcb_edi);
	case 8:  return (&kdb_thrctx->pcb_eip);
	}
	return (NULL);
}
Example #8
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
	static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL);
	static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL);
	static uint32_t _kprivsel = GSEL(GPRIV_SEL, SEL_KPL);

	*regsz = gdb_cpu_regsz(regnum);

	if (kdb_thread == curthread) {
		switch (regnum) {
		case 0:	return (&kdb_frame->tf_eax);
		case 1:	return (&kdb_frame->tf_ecx);
		case 2:	return (&kdb_frame->tf_edx);
		case 9: return (&kdb_frame->tf_eflags);
		case 10: return (&kdb_frame->tf_cs);
		case 12: return (&kdb_frame->tf_ds);
		case 13: return (&kdb_frame->tf_es);
		case 14: return (&kdb_frame->tf_fs);
		}
	}
	switch (regnum) {
	case 3:  return (&kdb_thrctx->pcb_ebx);
	case 4:  return (&kdb_thrctx->pcb_esp);
	case 5:  return (&kdb_thrctx->pcb_ebp);
	case 6:  return (&kdb_thrctx->pcb_esi);
	case 7:  return (&kdb_thrctx->pcb_edi);
	case 8:  return (&kdb_thrctx->pcb_eip);
	case 10: return (&_kcodesel);
	case 11: return (&_kdatasel);
	case 12: return (&_kdatasel);
	case 13: return (&_kdatasel);
	case 14: return (&_kprivsel);
	case 15: return (&kdb_thrctx->pcb_gs);
	}
	return (NULL);
}
Example #9
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{

	*regsz = gdb_cpu_regsz(regnum);

	if (kdb_thread == curthread) {
		if (regnum == 0 || (regnum >= 2 && regnum <= 31))
			return (kdb_frame->fixreg + regnum);
		if (regnum == 64)
			return (&kdb_frame->srr0);
		if (regnum == 67)
			return (&kdb_frame->lr);
	}

	if (regnum == 1)
		return (&kdb_thrctx->pcb_sp);
	if (regnum >= 14 && regnum <= 31)
		return (kdb_thrctx->pcb_context + (regnum - 14));
	if (regnum == 64)
		return (&kdb_thrctx->pcb_lr);

	return (NULL);
}
Example #10
0
void *
gdb_cpu_getreg(int regnum, size_t *regsz)
{
	static uint64_t synth;
	uint64_t cfm;

	*regsz = gdb_cpu_regsz(regnum);
	switch (regnum) {
	/* Registers 0-127: general registers. */
	case 1:  return (&kdb_thrctx->pcb_special.gp);
	case 4:  return (&kdb_thrctx->pcb_preserved.gr4);
	case 5:  return (&kdb_thrctx->pcb_preserved.gr5);
	case 6:  return (&kdb_thrctx->pcb_preserved.gr6);
	case 7:  return (&kdb_thrctx->pcb_preserved.gr7);
	case 12: return (&kdb_thrctx->pcb_special.sp);
	case 13: return (&kdb_thrctx->pcb_special.tp);
	/* Registers 128-255: floating-point registers. */
	case 130: return (&kdb_thrctx->pcb_preserved_fp.fr2);
	case 131: return (&kdb_thrctx->pcb_preserved_fp.fr3);
	case 132: return (&kdb_thrctx->pcb_preserved_fp.fr4);
	case 133: return (&kdb_thrctx->pcb_preserved_fp.fr5);
	case 144: return (&kdb_thrctx->pcb_preserved_fp.fr16);
	case 145: return (&kdb_thrctx->pcb_preserved_fp.fr17);
	case 146: return (&kdb_thrctx->pcb_preserved_fp.fr18);
	case 147: return (&kdb_thrctx->pcb_preserved_fp.fr19);
	case 148: return (&kdb_thrctx->pcb_preserved_fp.fr20);
	case 149: return (&kdb_thrctx->pcb_preserved_fp.fr21);
	case 150: return (&kdb_thrctx->pcb_preserved_fp.fr22);
	case 151: return (&kdb_thrctx->pcb_preserved_fp.fr23);
	case 152: return (&kdb_thrctx->pcb_preserved_fp.fr24);
	case 153: return (&kdb_thrctx->pcb_preserved_fp.fr25);
	case 154: return (&kdb_thrctx->pcb_preserved_fp.fr26);
	case 155: return (&kdb_thrctx->pcb_preserved_fp.fr27);
	case 156: return (&kdb_thrctx->pcb_preserved_fp.fr28);
	case 157: return (&kdb_thrctx->pcb_preserved_fp.fr29);
	case 158: return (&kdb_thrctx->pcb_preserved_fp.fr30);
	case 159: return (&kdb_thrctx->pcb_preserved_fp.fr31);
	/* Registers 320-327: branch registers. */
	case 320:
		if (kdb_thrctx->pcb_special.__spare == ~0UL)
			return (&kdb_thrctx->pcb_special.rp);
		break;
	case 321: return (&kdb_thrctx->pcb_preserved.br1);
	case 322: return (&kdb_thrctx->pcb_preserved.br2);
	case 323: return (&kdb_thrctx->pcb_preserved.br3);
	case 324: return (&kdb_thrctx->pcb_preserved.br4);
	case 325: return (&kdb_thrctx->pcb_preserved.br5);
	/* Registers 328-333: misc. other registers. */
	case 330: return (&kdb_thrctx->pcb_special.pr);
	case 331:
		if (kdb_thrctx->pcb_special.__spare == ~0UL) {
			synth = kdb_thrctx->pcb_special.iip;
			synth += (kdb_thrctx->pcb_special.psr >> 41) & 3;
			return (&synth);
		}
		return (&kdb_thrctx->pcb_special.rp);
	case 333:
		if (kdb_thrctx->pcb_special.__spare == ~0UL)
			return (&kdb_thrctx->pcb_special.cfm);
		return (&kdb_thrctx->pcb_special.pfs);
	/* Registers 334-461: application registers. */
	case 350: return (&kdb_thrctx->pcb_special.rsc);
	case 351: /* bsp */
	case 352: /* bspstore. */
		synth = kdb_thrctx->pcb_special.bspstore;
		if (kdb_thrctx->pcb_special.__spare == ~0UL) {
			synth += kdb_thrctx->pcb_special.ndirty;
		} else {
			cfm = kdb_thrctx->pcb_special.pfs;
			synth = ia64_bsp_adjust(synth,
			    IA64_CFM_SOF(cfm) - IA64_CFM_SOL(cfm));
		}
		return (&synth);
	case 353: return (&kdb_thrctx->pcb_special.rnat);
	case 370: return (&kdb_thrctx->pcb_special.unat);
	case 374: return (&kdb_thrctx->pcb_special.fpsr);
	case 398:
		if (kdb_thrctx->pcb_special.__spare == ~0UL)
			return (&kdb_thrctx->pcb_special.pfs);
		break;
	case 399: return (&kdb_thrctx->pcb_preserved.lc);
	}