示例#1
0
static
int
Jdb_bp::set_debug_address_register(int num, Mword addr, Mword len,
				   Breakpoint::Mode mode, Task *task)
{
  if (!task)
    {
      putstr(" => kernel task not allowed for breakpoints");
      return 0;
    }
  if (num >= 0 && num <= 3)
    {
      Mword local_dr7;
      Task *old_task = Kobject::dcast<Task*>(Kobject::from_dbg(Kobject_dbg::id_to_obj(bps[num].restricted_task())));

      if (old_task)
	{
	  // clear old breakpoint of other process
	  local_dr7 = get_debug_control_register(old_task);
	  clr_dr7(num, local_dr7);
	  set_debug_control_register(local_dr7, old_task);
	}
      bps[num].restrict_task(0, task->dbg_info()->dbg_id());
      write_debug_register(num, addr, task);
      local_dr7 = get_debug_control_register(task);
      clr_dr7(num, local_dr7);
      set_dr7(num, len, mode, local_dr7);
      set_debug_control_register(local_dr7, task);
      return 1;
    }

  return 0;
}
示例#2
0
static
void
Jdb_bp::clr_debug_address_register(int num)
{
  Task *task = Kobject::dcast<Task*>(Kobject::from_dbg(Kobject_dbg::id_to_obj(bps[num].restricted_task())));
  Mword local_dr7 = get_debug_control_register(task);
  clr_dr7(num, local_dr7);
  set_debug_control_register(local_dr7, task);
}
static 
int
Jdb_bp::set_debug_address_register(int num, Mword addr, Mword len,
				   Breakpoint::Mode mode, Space *)
{
  clr_dr7(num, dr7);
  set_dr7(num, len, mode, dr7);
  switch (num)
    {
    case 0: write_debug_register(0, addr); break;
    case 1: write_debug_register(1, addr); break;
    case 2: write_debug_register(2, addr); break;
    case 3: write_debug_register(3, addr); break;
    default:;
    }
  return 1;
}
static
void
Jdb_bp::clr_debug_address_register(int num)
{
  clr_dr7(num, dr7);
}