1 |
104 |
markom |
/* PPC linux native support.
|
2 |
|
|
Copyright (C) 1988, 1989, 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GDB.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
19 |
|
|
|
20 |
|
|
#include "defs.h"
|
21 |
|
|
#include "frame.h"
|
22 |
|
|
#include "inferior.h"
|
23 |
|
|
#include "gdbcore.h"
|
24 |
|
|
|
25 |
|
|
#include <sys/types.h>
|
26 |
|
|
#include <sys/param.h>
|
27 |
|
|
#include <signal.h>
|
28 |
|
|
#include <sys/user.h>
|
29 |
|
|
#include <sys/ioctl.h>
|
30 |
|
|
#include <sys/wait.h>
|
31 |
|
|
#include <fcntl.h>
|
32 |
|
|
#include <sys/procfs.h>
|
33 |
|
|
|
34 |
|
|
int
|
35 |
|
|
kernel_u_size ()
|
36 |
|
|
{
|
37 |
|
|
return (sizeof (struct user));
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
static int regmap[] =
|
41 |
|
|
{PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7,
|
42 |
|
|
PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_R13, PT_R14, PT_R15,
|
43 |
|
|
PT_R16, PT_R17, PT_R18, PT_R19, PT_R20, PT_R21, PT_R22, PT_R23,
|
44 |
|
|
PT_R24, PT_R25, PT_R26, PT_R27, PT_R28, PT_R29, PT_R30, PT_R31,
|
45 |
|
|
PT_FPR0, PT_FPR0 + 2, PT_FPR0 + 4, PT_FPR0 + 6, PT_FPR0 + 8, PT_FPR0 + 10, PT_FPR0 + 12, PT_FPR0 + 14,
|
46 |
|
|
PT_FPR0 + 16, PT_FPR0 + 18, PT_FPR0 + 20, PT_FPR0 + 22, PT_FPR0 + 24, PT_FPR0 + 26, PT_FPR0 + 28, PT_FPR0 + 30,
|
47 |
|
|
PT_FPR0 + 32, PT_FPR0 + 34, PT_FPR0 + 36, PT_FPR0 + 38, PT_FPR0 + 40, PT_FPR0 + 42, PT_FPR0 + 44, PT_FPR0 + 46,
|
48 |
|
|
PT_FPR0 + 48, PT_FPR0 + 50, PT_FPR0 + 52, PT_FPR0 + 54, PT_FPR0 + 56, PT_FPR0 + 58, PT_FPR0 + 60, PT_FPR0 + 62,
|
49 |
|
|
PT_NIP, PT_MSR, PT_CCR, PT_LNK, PT_CTR, PT_XER, PT_MQ};
|
50 |
|
|
|
51 |
|
|
int
|
52 |
|
|
ppc_register_u_addr (int ustart, int regnum)
|
53 |
|
|
{
|
54 |
|
|
return (ustart + 4 * regmap[regnum]);
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
void
|
58 |
|
|
supply_gregset (gregset_t * gregsetp)
|
59 |
|
|
{
|
60 |
|
|
int regi;
|
61 |
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
62 |
|
|
|
63 |
|
|
for (regi = 0; regi < 32; regi++)
|
64 |
|
|
supply_register (regi, (char *) (regp + regi));
|
65 |
|
|
|
66 |
|
|
for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++)
|
67 |
|
|
supply_register (regi, (char *) (regp + regmap[regi]));
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
void
|
71 |
|
|
supply_fpregset (fpregset_t * fpregsetp)
|
72 |
|
|
{
|
73 |
|
|
int regi;
|
74 |
|
|
for (regi = 0; regi < 32; regi++)
|
75 |
|
|
{
|
76 |
|
|
supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
|
77 |
|
|
}
|
78 |
|
|
}
|