Exemplo n.º 1
0
static void
sim_memory_uninstall (SIM_DESC sd)
{
    sim_memopt **entry = &STATE_MEMOPT (sd);
    sim_memopt *alias;

    while ((*entry) != NULL)
    {
        /* delete any buffer */
        if ((*entry)->buffer != NULL)
            zfree ((*entry)->buffer);

        /* delete it and its aliases */
        alias = *entry;

        /* next victim */
        *entry = (*entry)->next;

        while (alias != NULL)
        {
            sim_memopt *dead = alias;
            alias = alias->alias;
            sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
            zfree (dead);
        }
    }
}
Exemplo n.º 2
0
static void
sim_memory_uninstall (SIM_DESC sd)
{
  sim_memopt **entry = &STATE_MEMOPT (sd);
  sim_memopt *alias;

  while ((*entry) != NULL)
    {
      /* delete any buffer */
      if ((*entry)->buffer != NULL)
	{
#ifdef HAVE_MUNMAP
	  if ((*entry)->munmap_length > 0)
	    munmap ((*entry)->buffer, (*entry)->munmap_length);
	  else
#endif
	    free ((*entry)->buffer);
	}

      /* delete it and its aliases */
      alias = *entry;

      /* next victim */
      *entry = (*entry)->next;

      while (alias != NULL)
	{
	  sim_memopt *dead = alias;
	  alias = alias->alias;
	  sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
	  free (dead);
	}
    }
}
Exemplo n.º 3
0
static SIM_RC
do_memopt_delete (SIM_DESC sd,
                  int level,
                  int space,
                  address_word addr)
{
    sim_memopt **entry = &STATE_MEMOPT (sd);
    sim_memopt *alias;
    while ((*entry) != NULL
            && ((*entry)->level != level
                || (*entry)->space != space
                || (*entry)->addr != addr))
        entry = &(*entry)->next;
    if ((*entry) == NULL)
    {
        sim_io_eprintf (sd, "Memory at 0x%lx not found, not deleted\n",
                        (long) addr);
        return SIM_RC_FAIL;
    }
    /* delete any buffer */
    if ((*entry)->buffer != NULL)
        zfree ((*entry)->buffer);
    /* delete it and its aliases */
    alias = *entry;
    *entry = (*entry)->next;
    while (alias != NULL)
    {
        sim_memopt *dead = alias;
        alias = alias->alias;
        sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
        zfree (dead);
    }
    return SIM_RC_OK;
}