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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [armbsd-tdep.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Target-dependent code for ARM BSD's.
2
 
3
   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#include "defs.h"
21
#include "osabi.h"
22
#include "regcache.h"
23
#include "regset.h"
24
 
25
#include "gdb_assert.h"
26
#include "gdb_string.h"
27
 
28
#include "arm-tdep.h"
29
 
30
/* Core file support.  */
31
 
32
/* Sizeof `struct reg' in <machine/reg.h>.  */
33
#define ARMBSD_SIZEOF_GREGS     (17 * 4)
34
 
35
/* Sizeof `struct fpreg' in <machine/reg.h.  */
36
#define ARMBSD_SIZEOF_FPREGS    ((1 + (8 * 3)) * 4)
37
 
38
int
39
armbsd_fpreg_offset (int regnum)
40
{
41
  if (regnum == ARM_FPS_REGNUM)
42
    return 0;
43
 
44
  return 4 + (regnum - ARM_F0_REGNUM) * 12;
45
}
46
 
47
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
48
   in the floating-point register set REGSET to register cache
49
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
50
 
51
static void
52
armbsd_supply_fpregset (const struct regset *regset,
53
                        struct regcache *regcache,
54
                        int regnum, const void *fpregs, size_t len)
55
{
56
  const gdb_byte *regs = fpregs;
57
  int i;
58
 
59
  gdb_assert (len >= ARMBSD_SIZEOF_FPREGS);
60
 
61
  for (i = ARM_F0_REGNUM; i <= ARM_FPS_REGNUM; i++)
62
    {
63
      if (regnum == i || regnum == -1)
64
        regcache_raw_supply (regcache, i, regs + armbsd_fpreg_offset (i));
65
    }
66
}
67
 
68
/* Supply register REGNUM from the buffer specified by GREGS and LEN
69
   in the general-purpose register set REGSET to register cache
70
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
71
 
72
static void
73
armbsd_supply_gregset (const struct regset *regset,
74
                       struct regcache *regcache,
75
                       int regnum, const void *gregs, size_t len)
76
{
77
  const gdb_byte *regs = gregs;
78
  int i;
79
 
80
  gdb_assert (len >= ARMBSD_SIZEOF_GREGS);
81
 
82
  for (i = ARM_A1_REGNUM; i <= ARM_PC_REGNUM; i++)
83
    {
84
      if (regnum == i || regnum == -1)
85
        regcache_raw_supply (regcache, i, regs + i * 4);
86
    }
87
 
88
  if (regnum == ARM_PS_REGNUM || regnum == -1)
89
    regcache_raw_supply (regcache, i, regs + 16 * 4);
90
 
91
  if (len >= ARMBSD_SIZEOF_GREGS + ARMBSD_SIZEOF_FPREGS)
92
    {
93
      regs += ARMBSD_SIZEOF_GREGS;
94
      len -= ARMBSD_SIZEOF_GREGS;
95
      armbsd_supply_fpregset (regset, regcache, regnum, regs, len);
96
    }
97
}
98
 
99
/* ARM register sets.  */
100
 
101
static struct regset armbsd_gregset =
102
{
103
  NULL,
104
  armbsd_supply_gregset
105
};
106
 
107
static struct regset armbsd_fpregset =
108
{
109
  NULL,
110
  armbsd_supply_fpregset
111
};
112
 
113
/* Return the appropriate register set for the core section identified
114
   by SECT_NAME and SECT_SIZE.  */
115
 
116
const struct regset *
117
armbsd_regset_from_core_section (struct gdbarch *gdbarch,
118
                                 const char *sect_name, size_t sect_size)
119
{
120
  if (strcmp (sect_name, ".reg") == 0 && sect_size >= ARMBSD_SIZEOF_GREGS)
121
    return &armbsd_gregset;
122
 
123
  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= ARMBSD_SIZEOF_FPREGS)
124
    return &armbsd_fpregset;
125
 
126
  return NULL;
127
}

powered by: WebSVN 2.1.0

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