#import "gdb.h"
#import "SegmentManagerThreads.h"
extern RegionManager *regionManager;
extern int current_core_thread;
extern void copy_registers_in (struct sparc_thread_state_regs *);

void core_get_registers(regnum)
{
  ThreadInfo tInfo;
  SegmentManager *coreManager = (SegmentManager *)regionManager;
  int i;

  [coreManager threadInfo: &tInfo forThreadNum: current_core_thread];
  copy_registers_in(tInfo.intRegs);
  registers_fetched();

  /* let's not forget the fp regs */
  copy_fp_registers_in(tInfo.fpRegs);

  /* Now get the i & l regs from the stack */
  target_xfer_memory (*(CORE_ADDR*)&registers[REGISTER_BYTE (SP_REGNUM)],
		      &registers[REGISTER_BYTE (L0_REGNUM)],
		      16*REGISTER_RAW_SIZE (L0_REGNUM), 0);
  for (i = L0_REGNUM; i <= I7_REGNUM; i++)
    register_valid[i] = 1;
}

