Enable Mark Kettenis' linux thread support for Linux/PPC.

This commit is contained in:
Kevin Buettner 2000-09-18 01:08:24 +00:00
parent afd64b4e2d
commit fdb28ac401
4 changed files with 75 additions and 20 deletions

View File

@ -1,3 +1,18 @@
2000-09-17 Kevin Buettner <kevinb@redhat.com>
* ppc-linux-nat.c (fill_gregset, fill_fpregset): New functions.
* config/powerpc/linux.mh (NATDEPFILES): Remove linux-thread.o.
Add proc-service.o, thread-db.o, and lin-lwp.o.
(LOADLIBES): Define.
* config/powerpc/nm-linux.h (ATTACH_DETACH, SVR4_SHARED_LIBS):
Remove defines which are already present in ../nm-linux.h.
(solib.h): Don't include this file; it's already included by
../nm-linux.h.
(PREPARE_TO_PROCEED, GET_THREAD_SIGNALS, ATTACH_LWP): Define
to use the following lin-lwp.c functions...
(lin_lwp_prepare_to_proceed, lin_thread_get_thread_signals,
lin_lwp_attach_lwp): Declare.
2000-09-17 Kevin Buettner <kevinb@redhat.com>
* m88k-nat.c (fetch_inferior_registers): Protoize.

View File

@ -5,6 +5,9 @@ XDEPFILES=
XM_CLIBS=
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o ppc-linux-nat.o linux-thread.o
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
GDBSERVER_DEPFILES= low-linux.o

View File

@ -28,9 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define KERNEL_U_SIZE kernel_u_size()
extern int kernel_u_size (void);
/* Tell gdb that we can attach and detach other processes */
#define ATTACH_DETACH
#define U_REGS_OFFSET 0
#define REGISTER_U_ADDR(addr, blockend, regno) \
@ -40,25 +37,20 @@ extern int kernel_u_size (void);
#define NO_SYS_REG_H
#ifdef HAVE_LINK_H
#include "solib.h" /* Support for shared libraries. */
#define SVR4_SHARED_LIBS
#endif
/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h
once we have converted all Linux targets to use the new threads
stuff (without the #undef of course). */
/* Support for Linuxthreads. */
extern int lin_lwp_prepare_to_proceed (void);
#undef PREPARE_TO_PROCEED
#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
#ifdef __STDC__
struct objfile;
#endif
extern void lin_lwp_attach_lwp (int pid, int verbose);
#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose))
extern void linuxthreads_new_objfile (struct objfile *objfile);
#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE)
extern char *linuxthreads_pid_to_str (int pid);
#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID)
extern int linuxthreads_prepare_to_proceed (int step);
#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
#include <signal.h>
extern void lin_thread_get_thread_signals (sigset_t *mask);
#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask)
#endif /* #ifndef NM_LINUX_H */

View File

@ -70,6 +70,28 @@ supply_gregset (gregset_t * gregsetp)
supply_register (regi, (char *) (regp + regmap[regi]));
}
void
fill_gregset (gregset_t *gregsetp, int regno)
{
int regi;
greg_t *regp = (greg_t *) gregsetp;
#define COPY_REG(_idx_,_regi_) \
if ((regno == -1) || regno == _regi_) \
memcpy (regp + _idx_, &registers[REGISTER_BYTE (_regi_)], \
REGISTER_RAW_SIZE (_regi_))
for (regi = 0; regi < 32; regi++)
{
COPY_REG (regmap[regi], regi);
}
for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++)
{
COPY_REG (regmap[regi], regi);
}
}
void
supply_fpregset (fpregset_t * fpregsetp)
{
@ -79,3 +101,26 @@ supply_fpregset (fpregset_t * fpregsetp)
supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
}
}
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), update the register specified by REGNO from gdb's idea
of the current floating point register set. If REGNO is -1, update
them all. */
void
fill_fpregset (fpregset_t *fpregsetp, int regno)
{
int regi;
char *to;
char *from;
for (regi = 0; regi < 32; regi++)
{
if ((regno == -1) || (regno == FP0_REGNUM + regi))
{
from = (char *) &registers[REGISTER_BYTE (FP0_REGNUM + regi)];
to = (char *) (*fpregsetp + regi);
memcpy (to, from, REGISTER_RAW_SIZE (FP0_REGNUM + regi));
}
}
}