示例#1
0
int
sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
{
  size_t size;
  SI val;

  check_desc (sd);

  if (!check_regno (regno))
    return -1;

  size = reg_size (regno);

  if (length != size)
    return -1;

  val = get_le (buf, length);

  if (regno == sim_rl78_pc_regnum)
    {
      pc = val;

      /* The rl78 program counter is 20 bits wide.  Ensure that GDB
         hasn't picked up any stray bits.  This has occurred when performing
	 a GDB "return" command in which the return address is obtained
	 from a 32-bit container on the stack.  */
      assert ((pc & ~0x0fffff) == 0);
    }
  else
    memory[reg_addr (regno)] = val;
  return size;
}
示例#2
0
int
sim_fetch_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
{
  size_t size;
  SI val;

  check_desc (sd);

  if (!check_regno (regno))
    return 0;

  size = reg_size (regno);

  if (length != size)
    return 0;

  if (regno == sim_rl78_pc_regnum)
    val = pc;
  else
    val = memory[reg_addr (regno)];

  put_le (buf, length, val);

  return size;
}
示例#3
0
文件: args_addr.c 项目: k6s/tek1
void			*get_arg_addr(args_type_t type, args_type_t types,
				      t_proc *s_proc, t_vm *vm, t_lst **vars)
{
  if (type == AG_REG && (types & T_REG))
    return (reg_addr(vm, vars, s_proc));
  if (type == AG_DIR && (types & T_DIR))
    return (dir_addr(vm, vars, s_proc));
  if (type == AG_IND && (types & T_IND))
    return (ind_addr(vm, vars, s_proc));
  return (NULL);
}
示例#4
0
 inline oop* reg_addr(ucontext_t* scp, Location reg) {
   fint off = loc_map[reg];
   if (off >= 0) {
     return (oop*)&scp->uc_mcontext.gregs[off];
   } else {
     // register is in bottommost window
     if (scp->uc_mcontext.gwins) {
       return (oop*)&scp->uc_mcontext.gwins->wbuf[0] + (reg - L0);
     } else {
       // was saved on stack (normal case)
       oop* sp = reg_addr(scp, SP);
       return sp + (reg - L0);
     }
   }
 }
示例#5
0
int
sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length)
{
  size_t size;
  SI val;

  check_desc (sd);

  if (!check_regno (regno))
    return -1;

  size = reg_size (regno);

  if (length != size)
    return -1;

  val = get_le (buf, length);

  if (regno == sim_rl78_pc_regnum)
    pc = val;
  else
    memory[reg_addr (regno)] = val;
  return size;
}
示例#6
0
 void* InterruptedContext::get_reg(Location reg) {
   return *reg_addr((ucontext_t*) scp, reg);
 }
示例#7
0
 void  InterruptedContext::set_reg(Location reg, void* newVal) {
   *reg_addr((ucontext_t*) scp, reg) = (oop) newVal;
 }