1 /* Motorola m68k native support for Linux
2 Copyright (C) 1996,1998 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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,
19 Boston, MA 02111-1307, USA. */
28 #include <sys/types.h>
31 #include <sys/param.h>
35 #include <sys/ioctl.h>
37 #include <sys/procfs.h>
42 #include "floatformat.h"
47 /* This table must line up with REGISTER_NAMES in tm-m68k.h */
48 static const int regmap
[] =
50 PT_D0
, PT_D1
, PT_D2
, PT_D3
, PT_D4
, PT_D5
, PT_D6
, PT_D7
,
51 PT_A0
, PT_A1
, PT_A2
, PT_A3
, PT_A4
, PT_A5
, PT_A6
, PT_USP
,
53 /* PT_FP0, ..., PT_FP7 */
54 21, 24, 27, 30, 33, 36, 39, 42,
55 /* PT_FPCR, PT_FPSR, PT_FPIAR */
59 /* BLOCKEND is the value of u.u_ar0, and points to the place where GS
63 m68k_linux_register_u_addr (blockend
, regnum
)
67 return (blockend
+ 4 * regmap
[regnum
]);
70 /* Given a pointer to a general register set in /proc format (gregset_t *),
71 unpack the register contents and supply them as gdb's idea of the current
75 /* Note both m68k-tdep.c and m68klinux-nat.c contain definitions
76 for supply_gregset and supply_fpregset. The definitions
77 in m68k-tdep.c are valid if USE_PROC_FS is defined. Otherwise,
78 the definitions in m68klinux-nat.c will be used. This is a
79 bit of a hack. The supply_* routines do not belong in
80 *_tdep.c files. But, there are several lynx ports that currently
81 depend on these definitions. */
85 /* Prototypes for supply_gregset etc. */
89 supply_gregset (gregsetp
)
94 for (regi
= D0_REGNUM
; regi
<= SP_REGNUM
; regi
++)
95 supply_register (regi
, (char *) (*gregsetp
+ regmap
[regi
]));
96 supply_register (PS_REGNUM
, (char *) (*gregsetp
+ PT_SR
));
97 supply_register (PC_REGNUM
, (char *) (*gregsetp
+ PT_PC
));
100 /* Given a pointer to a floating point register set in /proc format
101 (fpregset_t *), unpack the register contents and supply them as gdb's
102 idea of the current floating point register values. */
105 supply_fpregset (fpregsetp
)
106 fpregset_t
*fpregsetp
;
110 for (regi
= FP0_REGNUM
; regi
< FPC_REGNUM
; regi
++)
111 supply_register (regi
, (char *) &fpregsetp
->fpregs
[(regi
- FP0_REGNUM
) * 3]);
112 supply_register (FPC_REGNUM
, (char *) &fpregsetp
->fpcntl
[0]);
113 supply_register (FPS_REGNUM
, (char *) &fpregsetp
->fpcntl
[1]);
114 supply_register (FPI_REGNUM
, (char *) &fpregsetp
->fpcntl
[2]);
123 return (sizeof (struct user
));
126 /* Return non-zero if PC points into the signal trampoline. */
133 char buf
[TARGET_SHORT_BIT
/ TARGET_CHAR_BIT
];
136 sp
= read_register (SP_REGNUM
);
140 if (read_memory_nobpt (pc
, buf
, sizeof (buf
)))
142 insn
= extract_unsigned_integer (buf
, sizeof (buf
));
143 if (insn
== 0xdefc /* addaw #,sp */
144 || insn
== 0x7077 /* moveq #119,d0 */
145 || insn
== 0x4e40 /* trap #0 */
146 || insn
== 0x203c /* movel #,d0 */ )
149 if (read_memory_nobpt (pc
- 2, buf
, sizeof (buf
)))
151 insn
= extract_unsigned_integer (buf
, sizeof (buf
));
152 if (insn
== 0xdefc /* addaw #,sp */
153 || insn
== 0x7077 /* moveq #119,d0 */
154 || insn
== 0x4e40 /* trap #0 */
155 || insn
== 0x203c /* movel #,d0 */ )
This page took 0.032149 seconds and 4 git commands to generate.