Convert ADDR_BITS_REMOVE to a function.
This commit is contained in:
Andrew Cagney 1998-11-29 07:41:36 +00:00
parent 3a0c96a996
commit 8743fc885f
9 changed files with 49 additions and 11 deletions

View file

@ -1,3 +1,14 @@
Sun Nov 29 11:18:37 1998 Andrew Cagney <cagney@b1.cygnus.com>
* z8k-tdep.c (z8k_addr_bits_remove), w65-tdep.c
(w65_addr_bits_remove), h8500-tdep.c (h8500_addr_bits_remove),
m88k-tdep.c (m88k_addr_bits_remove): Function to clean up an
address.
* config/z8k/tm-z8k.h, config/w65/tm-w65.h, config/m88k/tm-m88k.h,
config/h8500/tm-h8500.h: Define ADDR_BITS_REMOVE to call targets
corresponding function.
* z8k-tdep.c (saved_pc_after_call): Update.
Sat Nov 28 12:24:31 1998 Andrew Cagney <cagney@b1.cygnus.com> Sat Nov 28 12:24:31 1998 Andrew Cagney <cagney@b1.cygnus.com>
* config/z8k/tm-z8k.h, config/w65/tm-w65.h, config/vax/tm-vax.h, * config/z8k/tm-z8k.h, config/w65/tm-w65.h, config/vax/tm-vax.h,

View file

@ -251,7 +251,8 @@ extern void h8500_pop_frame PARAMS ((void));
typedef unsigned short INSN_WORD; typedef unsigned short INSN_WORD;
#define ADDR_BITS_REMOVE(addr) ((addr) & 0xffffff) extern CORE_ADDR h8500_addr_bits_remove PARAMS ((CORE_ADDR));
#define ADDR_BITS_REMOVE(addr) h8500_addr_bits_remove (addr)
#define read_memory_short(x) (read_memory_integer(x,2) & 0xffff) #define read_memory_short(x) (read_memory_integer(x,2) & 0xffff)

View file

@ -63,7 +63,8 @@ extern CORE_ADDR skip_prologue ();
to realize that those two bits are not really a part of the address to realize that those two bits are not really a part of the address
of an instruction. Shrug. */ of an instruction. Shrug. */
#define ADDR_BITS_REMOVE(addr) ((addr) & ~3) extern CORE_ADDR m88k_addr_bits_remove PARAMS ((CORE_ADDR));
#define ADDR_BITS_REMOVE(addr) m88k_addr_bits_remove (addr)
/* Immediately after a function call, return the saved pc. /* Immediately after a function call, return the saved pc.
Can't always go through the frames for this because on some machines Can't always go through the frames for this because on some machines

View file

@ -191,7 +191,8 @@ extern CORE_ADDR w65_skip_prologue ();
typedef unsigned short INSN_WORD; typedef unsigned short INSN_WORD;
#define ADDR_BITS_REMOVE(addr) ((addr) & 0xffffff) extern CORE_ADDR w65_addr_bits_remove PARAMS ((CORE_ADDR));
#define ADDR_BITS_REMOVE(addr) w65_addr_bits_remove (addr)
#define CALL_DUMMY_LENGTH 10 #define CALL_DUMMY_LENGTH 10

View file

@ -263,7 +263,8 @@ extern void z8k_pop_frame PARAMS ((void));
#define SP_ARG0 (1 * 4) #define SP_ARG0 (1 * 4)
#define ADDR_BITS_REMOVE(x) addr_bits_remove(x) extern CORE_ADDR z8k_addr_bits_remove PARAMS ((CORE_ADDR));
#define ADDR_BITS_REMOVE(addr) z8k_addr_bits_remove (addr)
int sim_z8001_mode; int sim_z8001_mode;
#define BIG (sim_z8001_mode) #define BIG (sim_z8001_mode)

View file

@ -98,6 +98,13 @@ h8500_skip_prologue (start_pc)
return start_pc; return start_pc;
} }
CORE_ADDR
h8500_addr_bits_remove (addr)
CORE_ADDR addr;
{
return ((addr) & 0xffffff);
}
/* Given a GDB frame, determine the address of the calling function's frame. /* Given a GDB frame, determine the address of the calling function's frame.
This will be used to create a new GDB frame struct, and then This will be used to create a new GDB frame struct, and then
INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.

View file

@ -36,6 +36,21 @@ void frame_find_saved_regs ();
int target_is_m88110 = 0; int target_is_m88110 = 0;
/* The m88k kernel aligns all instructions on 4-byte boundaries. The
kernel also uses the least significant two bits for its own hocus
pocus. When gdb receives an address from the kernel, it needs to
preserve those right-most two bits, but gdb also needs to be careful
to realize that those two bits are not really a part of the address
of an instruction. Shrug. */
CORE_ADDR
m88k_addr_bits_remove (addr)
CORE_ADDR addr;
{
return ((addr) & ~3);
}
/* Given a GDB frame, determine the address of the calling function's frame. /* Given a GDB frame, determine the address of the calling function's frame.
This will be used to create a new GDB frame struct, and then This will be used to create a new GDB frame struct, and then
INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.

View file

@ -42,10 +42,10 @@ w65_frame_saved_pc (frame)
} }
CORE_ADDR CORE_ADDR
addr_bits_remove (x) w65_addr_bits_remove (addr)
CORE_ADDR x; CORE_ADDR addr;
{ {
return x; return ((addr) & 0xffffff);
} }
read_memory_pointer (x) read_memory_pointer (x)

View file

@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "dis-asm.h" #include "dis-asm.h"
#include "gdbcore.h" #include "gdbcore.h"
/* Return the saved PC from this frame. /* Return the saved PC from this frame.
If the frame has a memory copy of SRP_REGNUM, use that. If not, If the frame has a memory copy of SRP_REGNUM, use that. If not,
@ -143,10 +144,10 @@ z8k_skip_prologue (start_pc)
} }
CORE_ADDR CORE_ADDR
addr_bits_remove (x) z8k_addr_bits_remove (addr)
CORE_ADDR x; CORE_ADDR addr;
{ {
return x & PTR_MASK; return (addr & PTR_MASK);
} }
int int
@ -293,7 +294,7 @@ frame_find_saved_regs (fip, fsrp)
int int
saved_pc_after_call () saved_pc_after_call ()
{ {
return addr_bits_remove return ADDR_BITS_REMOVE
(read_memory_integer (read_register (SP_REGNUM), PTR_SIZE)); (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE));
} }