Exemplo n.º 1
0
static mem_addr
copy_int_to_stack (int context, int n)
{
  reg_image_t &reg_image = reg_images[context];

  set_mem_word (reg_image.context, reg_image.R[REG_SP], n);
  reg_image.R[REG_SP] -= BYTES_PER_WORD;
  return ((mem_addr) reg_image.R[REG_SP] + BYTES_PER_WORD);
}
Exemplo n.º 2
0
static void
set_value_action (char *location_str, char *value_str)
{
  unsigned long value;
  int reg_no;

  if (strlen (value_str) == 3
      && value_str[0] == '\''
      && value_str[2] == '\'')
    {
      /* Literal of the form: 'c' */
      value = value_str[1];
    }
  else
    {
      value = strtol (value_str, NULL, 0);
    }
  reg_no = register_name_to_number (location_str);

  if (reg_no < 0)
    if (*location_str == '$' || *location_str == 'r' || *location_str == 'R')
      reg_no = register_name_to_number (location_str + 1);

  if (reg_no == 0)
    error ("Cannot modify register 0\n");
  else if (reg_no > 0)
    R[reg_no] = (reg_word)value;
  else if (streq (location_str, "Status") || streq (location_str, "status"))
    CP0_Status = (reg_word)value;
  else if (streq (location_str, "PC") || streq (location_str, "pc"))
    PC = (reg_word)value;
  else if (streq (location_str, "EPC") | streq (location_str, "epc"))
    CP0_EPC = (reg_word)value;
  else
    {
      char *eptr;
      mem_addr addr;

      /* Try to parse string as a number */
      addr = strtol (location_str, &eptr, 0);
      if (eptr == location_str)
	error ("Unknown register selected: %s\n", location_str);
      else
	set_mem_word (addr, value);
    }
  redisplay_data ();
}
Exemplo n.º 3
0
void
initialize_run_stack (int argc, char **argv)
{
  //FIXME: eventually run for both or neither
  int context = 0;
  reg_image_t &reg_image = reg_images[context];

  char **p;
  extern char **environ;
  int i, j = 0, env_j;
  mem_addr addrs[10000];


  reg_image.R[REG_SP] = STACK_TOP - 1; /* Initialize $sp */

  /* Put strings on stack: */
  /* env: */
  for (p = environ; *p != NULL; p++)
    addrs[j++] = copy_str_to_stack (context, *p);
  env_j = j;

  /* argv; */
  for (i = 0; i < argc; i++)
    addrs[j++] = copy_str_to_stack (context, argv[i]);

  /* Align stack pointer for word-size data */
  reg_image.R[REG_SP] = reg_image.R[REG_SP] & ~3;	/* Round down to nearest word */
  reg_image.R[REG_SP] -= BYTES_PER_WORD;	/* First free word on stack */
  reg_image.R[REG_SP] = reg_image.R[REG_SP] & ~7;	/* Double-word align stack-pointer*/

  /* Build vectors on stack: */
  /* env: */
  (void)copy_int_to_stack (context, 0);	/* Null-terminate vector */
  for (i = env_j - 1; i >= 0; i--)
    reg_image.R[REG_A2] = copy_int_to_stack (context, addrs[i]);

  /* argv: */
  (void)copy_int_to_stack (context, 0);	/* Null-terminate vector */
  for (i = j - 1; i >= env_j; i--)
    reg_image.R[REG_A1] = copy_int_to_stack (context, addrs[i]);

  /* argc: */
  reg_image.R[REG_A0] = argc;
  set_mem_word (context, reg_image.R[REG_SP], argc); /* Leave argc on stack */
}
Exemplo n.º 4
0
void dataTextEdit::changeValue()
{
    QTextCursor cursor;
    mem_addr addr = addrFromPos(&cursor);
    if (addr != 0)
    {
        int base = Window->DataDisplayBase();
        QString val = promptForNewValue("New Contents for " + formatAddress(addr), &base);
        bool ok;
        int newMemVal = val.toInt(&ok, base);
        if (ok)
        {
            set_mem_word(addr, newMemVal);
        }

        Window->DisplayDataSegments(true);
    }
}