Bring across target kvm support for mips from gdb6.

This commit is contained in:
skrll 2012-11-03 14:59:44 +00:00
parent d609b84f9d
commit 2334c5671b
3 changed files with 56 additions and 1 deletions

View File

@ -1,3 +1,4 @@
# Host: NetBSD/mips
NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o mipsnbsd-nat.o \
nbsd-thread.o
nbsd-thread.o bsd-kvm.o
LOADLIBS= -lkvm

View File

@ -118,8 +118,19 @@ enum
MIPS_AT_REGNUM = 1,
MIPS_V0_REGNUM = 2, /* Function integer return value. */
MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call. */
MIPS_S0_REGNUM = 16,
MIPS_S1_REGNUM = 17,
MIPS_S2_REGNUM = 18,
MIPS_S3_REGNUM = 19,
MIPS_S4_REGNUM = 20,
MIPS_S5_REGNUM = 21,
MIPS_S6_REGNUM = 22,
MIPS_S7_REGNUM = 23,
MIPS_T8_REGNUM = 24,
MIPS_T9_REGNUM = 25, /* Contains address of callee in PIC. */
MIPS_GP_REGNUM = 28,
MIPS_SP_REGNUM = 29,
MIPS_S8_REGNUM = 30,
MIPS_RA_REGNUM = 31,
MIPS_PS_REGNUM = 32, /* Contains processor status. */
MIPS_EMBED_LO_REGNUM = 33,

View File

@ -40,6 +40,9 @@ typedef struct fpreg fpregset_t;
#include "mips-tdep.h"
#include "mipsnbsd-tdep.h"
#include "inf-ptrace.h"
#include "bsd-kvm.h"
#include "machine/pcb.h"
/* Determine if PT_GETREGS fetches this register. */
static int
@ -119,6 +122,43 @@ mipsnbsd_store_inferior_registers (struct target_ops *ops,
perror_with_name (_("Couldn't write floating point status"));
}
}
static int mipsnbsd_supply_pcb (struct regcache *, struct pcb *);
static int
mipsnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{
struct label_t sf;
sf = pcb->pcb_context;
/* really should test for n{32,64} abi for this register
unless this is purely the "n" ABI */
regcache_raw_supply (regcache, MIPS_S0_REGNUM, &sf.val[_L_S0]);
regcache_raw_supply (regcache, MIPS_S1_REGNUM, &sf.val[_L_S1]);
regcache_raw_supply (regcache, MIPS_S2_REGNUM, &sf.val[_L_S2]);
regcache_raw_supply (regcache, MIPS_S3_REGNUM, &sf.val[_L_S3]);
regcache_raw_supply (regcache, MIPS_S4_REGNUM, &sf.val[_L_S4]);
regcache_raw_supply (regcache, MIPS_S5_REGNUM, &sf.val[_L_S5]);
regcache_raw_supply (regcache, MIPS_S6_REGNUM, &sf.val[_L_S6]);
regcache_raw_supply (regcache, MIPS_S7_REGNUM, &sf.val[_L_S7]);
regcache_raw_supply (regcache, MIPS_S8_REGNUM, &sf.val[_L_S8]);
regcache_raw_supply (regcache, MIPS_T8_REGNUM, &sf.val[_L_T8]);
regcache_raw_supply (regcache, MIPS_GP_REGNUM, &sf.val[_L_GP]);
regcache_raw_supply (regcache, MIPS_SP_REGNUM, &sf.val[_L_SP]);
regcache_raw_supply (regcache, MIPS_RA_REGNUM, &sf.val[_L_RA]);
regcache_raw_supply (regcache, MIPS_PS_REGNUM, &sf.val[_L_SR]);
/* provide the return address of the savectx as the current pc */
regcache_raw_supply (regcache, MIPS_EMBED_PC_REGNUM, &sf.val[_L_RA]);
return 0;
}
/* Wrapper functions. These are only used by nbsd-thread. */
void
@ -159,4 +199,7 @@ _initialize_mipsnbsd_nat (void)
t->to_fetch_registers = mipsnbsd_fetch_inferior_registers;
t->to_store_registers = mipsnbsd_store_inferior_registers;
add_target (t);
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (mipsnbsd_supply_pcb);
}