/* Low level Alpha interface, for GDB when running native.
- Copyright 1993, 1995, 1996, 1998, 1999, 2000, 2001
+ Copyright 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2003
Free Software Foundation, Inc.
This file is part of GDB.
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "gdb_string.h"
#include "inferior.h"
#include "gdbcore.h"
#include "target.h"
static void fetch_osf_core_registers (char *, unsigned, int, CORE_ADDR);
static void fetch_elf_core_registers (char *, unsigned, int, CORE_ADDR);
-/* Size of elements in jmpbuf */
-
-#define JB_ELEMENT_SIZE 8
-
-/* The definition for JB_PC in machine/reg.h is wrong.
- And we can't get at the correct definition in setjmp.h as it is
- not always available (eg. if _POSIX_SOURCE is defined which is the
- default). As the defintion is unlikely to change (see comment
- in <setjmp.h>, define the correct value here. */
-
-#undef JB_PC
-#define JB_PC 2
-
-/* Figure out where the longjmp will land.
- We expect the first arg to be a pointer to the jmp_buf structure from which
- we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
- This routine returns true on success. */
-
-int
-get_longjmp_target (CORE_ADDR *pc)
-{
- CORE_ADDR jb_addr;
- char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
-
- jb_addr = read_register (ALPHA_A0_REGNUM);
-
- if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer,
- sizeof (CORE_ADDR)))
- return 0;
-
- *pc = extract_address (raw_buffer, sizeof (CORE_ADDR));
- return 1;
-}
-
/* Extract the register values out of the core file and store
them where `read_register' will find them.
if (which == 2)
{
/* The FPU Registers. */
- memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 31 * 8);
- memset (®isters[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8);
- memset (®ister_valid[FP0_REGNUM], 1, 32);
+ memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
+ core_reg_sect, 31 * 8);
+ memset (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8);
+ memset (&deprecated_register_valid[FP0_REGNUM], 1, 32);
}
else
{
/* The General Registers. */
- memcpy (®isters[REGISTER_BYTE (ALPHA_V0_REGNUM)], core_reg_sect,
- 31 * 8);
- memcpy (®isters[REGISTER_BYTE (PC_REGNUM)], core_reg_sect + 31 * 8, 8);
- memset (®isters[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8);
- memset (®ister_valid[ALPHA_V0_REGNUM], 1, 32);
- register_valid[PC_REGNUM] = 1;
+ memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_V0_REGNUM)],
+ core_reg_sect, 31 * 8);
+ memcpy (&deprecated_registers[REGISTER_BYTE (PC_REGNUM)],
+ core_reg_sect + 31 * 8, 8);
+ memset (&deprecated_registers[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8);
+ memset (&deprecated_register_valid[ALPHA_V0_REGNUM], 1, 32);
+ deprecated_register_valid[PC_REGNUM] = 1;
+
+ if (core_reg_size >= 33 * 8)
+ {
+ memcpy (&deprecated_registers[REGISTER_BYTE (ALPHA_UNIQUE_REGNUM)],
+ core_reg_sect + 32 * 8, 8);
+ deprecated_register_valid[ALPHA_UNIQUE_REGNUM] = 1;
+ }
}
}
/* Map gdb internal register number to a ptrace ``address''.
- These ``addresses'' are defined in <sys/ptrace.h> */
-
-#define REGISTER_PTRACE_ADDR(regno) \
- (regno < FP0_REGNUM ? GPR_BASE + (regno) \
- : regno == PC_REGNUM ? PC \
- : regno >= FP0_REGNUM ? FPR_BASE + ((regno) - FP0_REGNUM) \
- : 0)
+ These ``addresses'' are defined in <sys/ptrace.h>, with
+ the exception of ALPHA_UNIQUE_PTRACE_ADDR. */
-/* Return the ptrace ``address'' of register REGNO. */
+#ifndef ALPHA_UNIQUE_PTRACE_ADDR
+#define ALPHA_UNIQUE_PTRACE_ADDR 0
+#endif
CORE_ADDR
register_addr (int regno, CORE_ADDR blockend)
{
- return REGISTER_PTRACE_ADDR (regno);
+ if (regno == PC_REGNUM)
+ return PC;
+ if (regno == ALPHA_UNIQUE_REGNUM)
+ return ALPHA_UNIQUE_PTRACE_ADDR;
+ if (regno < FP0_REGNUM)
+ return GPR_BASE + regno;
+ else
+ return FPR_BASE + regno - FP0_REGNUM;
}
int
/* Fill inaccessible registers with zero. */
supply_register (ALPHA_ZERO_REGNUM, zerobuf);
- supply_register (FP_REGNUM, zerobuf);
+ supply_register (DEPRECATED_FP_REGNUM, zerobuf);
}
void
for (regi = 0; regi < 31; regi++)
if ((regno == -1) || (regno == regi))
- *(regp + regi) = *(long *) ®isters[REGISTER_BYTE (regi)];
+ *(regp + regi) = *(long *) &deprecated_registers[REGISTER_BYTE (regi)];
if ((regno == -1) || (regno == PC_REGNUM))
- *(regp + 31) = *(long *) ®isters[REGISTER_BYTE (PC_REGNUM)];
+ *(regp + 31) = *(long *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)];
}
/*
if ((regno == -1) || (regno == regi))
{
*(regp + regi - FP0_REGNUM) =
- *(long *) ®isters[REGISTER_BYTE (regi)];
+ *(long *) &deprecated_registers[REGISTER_BYTE (regi)];
}
}
}