OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [armbsd-tdep.c] - Diff between revs 834 and 842

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 834 Rev 842
/* Target-dependent code for ARM BSD's.
/* Target-dependent code for ARM BSD's.
 
 
   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
#include "defs.h"
#include "defs.h"
#include "osabi.h"
#include "osabi.h"
#include "regcache.h"
#include "regcache.h"
#include "regset.h"
#include "regset.h"
 
 
#include "gdb_assert.h"
#include "gdb_assert.h"
#include "gdb_string.h"
#include "gdb_string.h"
 
 
#include "arm-tdep.h"
#include "arm-tdep.h"
 
 
/* Core file support.  */
/* Core file support.  */
 
 
/* Sizeof `struct reg' in <machine/reg.h>.  */
/* Sizeof `struct reg' in <machine/reg.h>.  */
#define ARMBSD_SIZEOF_GREGS     (17 * 4)
#define ARMBSD_SIZEOF_GREGS     (17 * 4)
 
 
/* Sizeof `struct fpreg' in <machine/reg.h.  */
/* Sizeof `struct fpreg' in <machine/reg.h.  */
#define ARMBSD_SIZEOF_FPREGS    ((1 + (8 * 3)) * 4)
#define ARMBSD_SIZEOF_FPREGS    ((1 + (8 * 3)) * 4)
 
 
static int
static int
armbsd_fpreg_offset (int regnum)
armbsd_fpreg_offset (int regnum)
{
{
  if (regnum == ARM_FPS_REGNUM)
  if (regnum == ARM_FPS_REGNUM)
    return 0;
    return 0;
 
 
  return 4 + (regnum - ARM_F0_REGNUM) * 12;
  return 4 + (regnum - ARM_F0_REGNUM) * 12;
}
}
 
 
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
   in the floating-point register set REGSET to register cache
   in the floating-point register set REGSET to register cache
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
 
 
static void
static void
armbsd_supply_fpregset (const struct regset *regset,
armbsd_supply_fpregset (const struct regset *regset,
                        struct regcache *regcache,
                        struct regcache *regcache,
                        int regnum, const void *fpregs, size_t len)
                        int regnum, const void *fpregs, size_t len)
{
{
  const gdb_byte *regs = fpregs;
  const gdb_byte *regs = fpregs;
  int i;
  int i;
 
 
  gdb_assert (len >= ARMBSD_SIZEOF_FPREGS);
  gdb_assert (len >= ARMBSD_SIZEOF_FPREGS);
 
 
  for (i = ARM_F0_REGNUM; i <= ARM_FPS_REGNUM; i++)
  for (i = ARM_F0_REGNUM; i <= ARM_FPS_REGNUM; i++)
    {
    {
      if (regnum == i || regnum == -1)
      if (regnum == i || regnum == -1)
        regcache_raw_supply (regcache, i, regs + armbsd_fpreg_offset (i));
        regcache_raw_supply (regcache, i, regs + armbsd_fpreg_offset (i));
    }
    }
}
}
 
 
/* Supply register REGNUM from the buffer specified by GREGS and LEN
/* Supply register REGNUM from the buffer specified by GREGS and LEN
   in the general-purpose register set REGSET to register cache
   in the general-purpose register set REGSET to register cache
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
 
 
static void
static void
armbsd_supply_gregset (const struct regset *regset,
armbsd_supply_gregset (const struct regset *regset,
                       struct regcache *regcache,
                       struct regcache *regcache,
                       int regnum, const void *gregs, size_t len)
                       int regnum, const void *gregs, size_t len)
{
{
  const gdb_byte *regs = gregs;
  const gdb_byte *regs = gregs;
  int i;
  int i;
 
 
  gdb_assert (len >= ARMBSD_SIZEOF_GREGS);
  gdb_assert (len >= ARMBSD_SIZEOF_GREGS);
 
 
  for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
  for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
    {
    {
      if (regnum == i || regnum == -1)
      if (regnum == i || regnum == -1)
        regcache_raw_supply (regcache, i, regs + i * 4);
        regcache_raw_supply (regcache, i, regs + i * 4);
    }
    }
 
 
  if (regnum == ARM_PS_REGNUM || regnum == -1)
  if (regnum == ARM_PS_REGNUM || regnum == -1)
    regcache_raw_supply (regcache, i, regs + 16 * 4);
    regcache_raw_supply (regcache, i, regs + 16 * 4);
 
 
  if (len >= ARMBSD_SIZEOF_GREGS + ARMBSD_SIZEOF_FPREGS)
  if (len >= ARMBSD_SIZEOF_GREGS + ARMBSD_SIZEOF_FPREGS)
    {
    {
      regs += ARMBSD_SIZEOF_GREGS;
      regs += ARMBSD_SIZEOF_GREGS;
      len -= ARMBSD_SIZEOF_GREGS;
      len -= ARMBSD_SIZEOF_GREGS;
      armbsd_supply_fpregset (regset, regcache, regnum, regs, len);
      armbsd_supply_fpregset (regset, regcache, regnum, regs, len);
    }
    }
}
}
 
 
/* ARM register sets.  */
/* ARM register sets.  */
 
 
static struct regset armbsd_gregset =
static struct regset armbsd_gregset =
{
{
  NULL,
  NULL,
  armbsd_supply_gregset
  armbsd_supply_gregset
};
};
 
 
static struct regset armbsd_fpregset =
static struct regset armbsd_fpregset =
{
{
  NULL,
  NULL,
  armbsd_supply_fpregset
  armbsd_supply_fpregset
};
};
 
 
/* Return the appropriate register set for the core section identified
/* Return the appropriate register set for the core section identified
   by SECT_NAME and SECT_SIZE.  */
   by SECT_NAME and SECT_SIZE.  */
 
 
const struct regset *
const struct regset *
armbsd_regset_from_core_section (struct gdbarch *gdbarch,
armbsd_regset_from_core_section (struct gdbarch *gdbarch,
                                 const char *sect_name, size_t sect_size)
                                 const char *sect_name, size_t sect_size)
{
{
  if (strcmp (sect_name, ".reg") == 0 && sect_size >= ARMBSD_SIZEOF_GREGS)
  if (strcmp (sect_name, ".reg") == 0 && sect_size >= ARMBSD_SIZEOF_GREGS)
    return &armbsd_gregset;
    return &armbsd_gregset;
 
 
  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= ARMBSD_SIZEOF_FPREGS)
  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= ARMBSD_SIZEOF_FPREGS)
    return &armbsd_fpregset;
    return &armbsd_fpregset;
 
 
  return NULL;
  return NULL;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.