#include "inferior.h"
#include "regcache.h"
#include "arch-utils.h"
+
+#include "m68k-tdep.h"
\f
#define P_LINKL_FP 0x480e
#define P_TRAP 0x4e40
-/* Register numbers of various important registers.
- Note that some of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and some are "phony" register numbers which are too large
- to be actual register numbers as far as the user is concerned
- but do serve to get the desired values when passed to read_register. */
-
-/* Note: Since they are used in files other than this (monitor files),
- D0_REGNUM and A0_REGNUM are currently defined in tm-m68k.h. */
-
-enum
-{
- E_A1_REGNUM = 9,
- E_FP_REGNUM = 14, /* Contains address of executing stack frame */
- E_SP_REGNUM = 15, /* Contains address of top of stack */
- E_PS_REGNUM = 16, /* Contains processor status */
- E_PC_REGNUM = 17, /* Contains program counter */
- E_FP0_REGNUM = 18, /* Floating point register 0 */
- E_FPC_REGNUM = 26, /* 68881 control register */
- E_FPS_REGNUM = 27, /* 68881 status register */
- E_FPI_REGNUM = 28
-};
-
#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4)
#define REGISTER_BYTES_NOFP (16*4 + 8)
static int
-m68k_register_bytes_ok (numbytes)
+m68k_register_bytes_ok (long numbytes)
{
return ((numbytes == REGISTER_BYTES_FP)
|| (numbytes == REGISTER_BYTES_NOFP));
return (((unsigned) (regnum) - FP0_REGNUM) < 8 ? 12 : 4);
}
-/* Return the GDB type object for the "standard" data type of data
- in register N. This should be int for D0-D7, long double for FP0-FP7,
- and void pointer for all others (A0-A7, PC, SR, FPCONTROL etc).
- Note, for registers which contain addresses return pointer to void,
- not pointer to char, because we don't want to attempt to print
- the string after printing the address. */
+/* Return the GDB type object for the "standard" data type of data in
+ register N. This should be int for D0-D7, SR, FPCONTROL and
+ FPSTATUS, long double for FP0-FP7, and void pointer for all others
+ (A0-A7, PC, FPIADDR). Note, for registers which contain
+ addresses return pointer to void, not pointer to char, because we
+ don't want to attempt to print the string after printing the
+ address. */
static struct type *
m68k_register_virtual_type (int regnum)
{
- if ((unsigned) regnum >= E_FPC_REGNUM)
- return lookup_pointer_type (builtin_type_void);
- else if ((unsigned) regnum >= FP0_REGNUM)
- return builtin_type_long_double;
- else if ((unsigned) regnum >= A0_REGNUM)
- return lookup_pointer_type (builtin_type_void);
- else
- return builtin_type_int;
+ if (regnum >= FP0_REGNUM && regnum <= FP0_REGNUM + 7)
+ return builtin_type_m68881_ext;
+
+ if (regnum == M68K_FPI_REGNUM || regnum == PC_REGNUM)
+ return builtin_type_void_func_ptr;
+
+ if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM
+ || regnum == PS_REGNUM)
+ return builtin_type_int32;
+
+ if (regnum >= M68K_A0_REGNUM && regnum <= M68K_A0_REGNUM + 7)
+ return builtin_type_void_data_ptr;
+
+ return builtin_type_int32;
}
/* Function: m68k_register_name
static int
m68k_register_byte (int regnum)
{
- if (regnum >= E_FPC_REGNUM)
- return (((regnum - E_FPC_REGNUM) * 4) + 168);
+ if (regnum >= M68K_FPC_REGNUM)
+ return (((regnum - M68K_FPC_REGNUM) * 4) + 168);
else if (regnum >= FP0_REGNUM)
return (((regnum - FP0_REGNUM) * 12) + 72);
else
static void
m68k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
{
- write_register (E_A1_REGNUM, addr);
+ write_register (M68K_A1_REGNUM, addr);
}
/* Extract from an array regbuf containing the (raw) register state
static void
m68k_store_return_value (struct type *type, char *valbuf)
{
- write_register_bytes (0, valbuf, TYPE_LENGTH (type));
+ deprecated_write_register_bytes (0, valbuf, TYPE_LENGTH (type));
}
/* Describe the pointer in each stack frame to the previous stack frame
static CORE_ADDR
m68k_frame_chain (struct frame_info *thisframe)
{
- if (thisframe->signal_handler_caller)
+ if (get_frame_type (thisframe) == SIGTRAMP_FRAME)
return thisframe->frame;
- else if (!inside_entry_file ((thisframe)->pc))
- return read_memory_integer ((thisframe)->frame, 4);
+ else if (!inside_entry_file (thisframe->pc))
+ return read_memory_integer (thisframe->frame, 4);
else
return 0;
}
static int
m68k_frameless_function_invocation (struct frame_info *fi)
{
- if (fi->signal_handler_caller)
+ if (get_frame_type (fi) == SIGTRAMP_FRAME)
return 0;
else
return frameless_look_for_prologue (fi);
static CORE_ADDR
m68k_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if (get_frame_type (frame) == SIGTRAMP_FRAME)
{
if (frame->next)
return read_memory_integer (frame->next->frame + SIG_PC_FP_OFFSET, 4);
{
/* we assume here that the only frameless functions are the system calls
or other functions who do not put anything on the stack. */
- if (frame_info->signal_handler_caller)
+ if (get_frame_type (frame_info) == SIGTRAMP_FRAME)
return frame_info->frame + 12;
else if (frameless_look_for_prologue (frame_info))
{
/* Check for an interrupted system call */
- if (frame_info->next && frame_info->next->signal_handler_caller)
+ if (frame_info->next && (get_frame_type (frame_info->next) == SIGTRAMP_FRAME))
return frame_info->next->frame + 16;
else
return frame_info->frame + 4;
this target or not. */
for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--)
{
- read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12);
+ deprecated_read_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12);
sp = push_bytes (sp, raw_buffer, 12);
}
if (frame->saved_regs[regnum])
{
read_memory (frame->saved_regs[regnum], raw_buffer, 12);
- write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 12);
+ deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer,
+ 12);
}
}
for (regnum = FP_REGNUM - 1; regnum >= 0; regnum--)
frame_info->saved_regs[PC_REGNUM] = (frame_info)->frame + 4;
#ifdef SIG_SP_FP_OFFSET
/* Adjust saved SP_REGNUM for fake _sigtramp frames. */
- if (frame_info->signal_handler_caller && frame_info->next)
+ if ((get_frame_type (frame_info) == SIGTRAMP_FRAME) && frame_info->next)
frame_info->saved_regs[SP_REGNUM] =
frame_info->next->frame + SIG_SP_FP_OFFSET;
#endif
{
if ((regno == -1) || (regno == regi))
{
- *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)];
+ *(regp + regi) = *(int *) &deprecated_registers[REGISTER_BYTE (regi)];
}
}
if ((regno == -1) || (regno == PS_REGNUM))
{
- *(regp + R_PS) = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)];
+ *(regp + R_PS) = *(int *) &deprecated_registers[REGISTER_BYTE (PS_REGNUM)];
}
if ((regno == -1) || (regno == PC_REGNUM))
{
- *(regp + R_PC) = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)];
+ *(regp + R_PC) = *(int *) &deprecated_registers[REGISTER_BYTE (PC_REGNUM)];
}
}
register int regi;
char *from;
- for (regi = FP0_REGNUM; regi < E_FPC_REGNUM; regi++)
+ for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
{
from = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
supply_register (regi, from);
}
- supply_register (E_FPC_REGNUM, (char *) &(fpregsetp->f_pcr));
- supply_register (E_FPS_REGNUM, (char *) &(fpregsetp->f_psr));
- supply_register (E_FPI_REGNUM, (char *) &(fpregsetp->f_fpiaddr));
+ supply_register (M68K_FPC_REGNUM, (char *) &(fpregsetp->f_pcr));
+ supply_register (M68K_FPS_REGNUM, (char *) &(fpregsetp->f_psr));
+ supply_register (M68K_FPI_REGNUM, (char *) &(fpregsetp->f_fpiaddr));
}
/* Given a pointer to a floating point register set in /proc format
char *to;
char *from;
- for (regi = FP0_REGNUM; regi < E_FPC_REGNUM; regi++)
+ for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
{
if ((regno == -1) || (regno == regi))
{
- from = (char *) ®isters[REGISTER_BYTE (regi)];
+ from = (char *) &deprecated_registers[REGISTER_BYTE (regi)];
to = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
memcpy (to, from, REGISTER_RAW_SIZE (regi));
}
}
- if ((regno == -1) || (regno == E_FPC_REGNUM))
+ if ((regno == -1) || (regno == M68K_FPC_REGNUM))
{
- fpregsetp->f_pcr = *(int *) ®isters[REGISTER_BYTE (E_FPC_REGNUM)];
+ fpregsetp->f_pcr = *(int *) &deprecated_registers[REGISTER_BYTE (M68K_FPC_REGNUM)];
}
- if ((regno == -1) || (regno == E_FPS_REGNUM))
+ if ((regno == -1) || (regno == M68K_FPS_REGNUM))
{
- fpregsetp->f_psr = *(int *) ®isters[REGISTER_BYTE (E_FPS_REGNUM)];
+ fpregsetp->f_psr = *(int *) &deprecated_registers[REGISTER_BYTE (M68K_FPS_REGNUM)];
}
- if ((regno == -1) || (regno == E_FPI_REGNUM))
+ if ((regno == -1) || (regno == M68K_FPI_REGNUM))
{
- fpregsetp->f_fpiaddr = *(int *) ®isters[REGISTER_BYTE (E_FPI_REGNUM)];
+ fpregsetp->f_fpiaddr = *(int *) &deprecated_registers[REGISTER_BYTE (M68K_FPI_REGNUM)];
}
}
set_gdbarch_store_struct_return (gdbarch, m68k_store_struct_return);
set_gdbarch_deprecated_extract_return_value (gdbarch,
m68k_deprecated_extract_return_value);
- set_gdbarch_store_return_value (gdbarch, m68k_store_return_value);
+ set_gdbarch_deprecated_store_return_value (gdbarch, m68k_store_return_value);
set_gdbarch_frame_chain (gdbarch, m68k_frame_chain);
set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
/* OK to default this value to 'unknown'. */
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_frame_args_address (gdbarch, default_frame_address);
- set_gdbarch_frame_locals_address (gdbarch, default_frame_address);
set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size);
set_gdbarch_num_regs (gdbarch, 29);
set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
set_gdbarch_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4));
- set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
- set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM);
- set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
- set_gdbarch_ps_regnum (gdbarch, E_PS_REGNUM);
- set_gdbarch_fp0_regnum (gdbarch, E_FP0_REGNUM);
+ set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
+ set_gdbarch_fp_regnum (gdbarch, M68K_FP_REGNUM);
+ set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
+ set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);
+ set_gdbarch_fp0_regnum (gdbarch, M68K_FP0_REGNUM);
set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);