* ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words,

ns32k_fix_call_dummy): New.
* config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as
ns32k_call_dummy_words.
(SIZEOF_CALL_DUMMY_WORDS): Define as sizeof_ns32k_call_dummy_words.
(CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_ADDR,
CALL_DUMMY_NARGS): Remove.
(FIX_CALL_DUMMY): Define as ns32k_fix_call_dummy.
This commit is contained in:
Jason Thorpe 2002-05-26 22:27:01 +00:00
parent 78f9d7654a
commit 7bcc927b94
3 changed files with 59 additions and 28 deletions

View File

@ -1,3 +1,14 @@
2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
* ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words,
ns32k_fix_call_dummy): New.
* config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as
ns32k_call_dummy_words.
(SIZEOF_CALL_DUMMY_WORDS): Define as sizeof_ns32k_call_dummy_words.
(CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_ADDR,
CALL_DUMMY_NARGS): Remove.
(FIX_CALL_DUMMY): Define as ns32k_fix_call_dummy.
2002-05-26 Jason Thorpe <thorpej@wasabisystems.com> 2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
* ns32k-tdep.c (ns32k_breakpoint_from_pc, ns32k_frame_chain, * ns32k-tdep.c (ns32k_breakpoint_from_pc, ns32k_frame_chain,

View File

@ -187,37 +187,20 @@ void ns32k_frame_init_saved_regs (struct frame_info *);
extern void ns32k_push_dummy_frame (void); extern void ns32k_push_dummy_frame (void);
#define PUSH_DUMMY_FRAME ns32k_push_dummy_frame () #define PUSH_DUMMY_FRAME ns32k_push_dummy_frame ()
/* Discard from the stack the innermost frame, restoring all registers. */
extern void ns32k_pop_frame (void); extern void ns32k_pop_frame (void);
#define POP_FRAME ns32k_pop_frame () #define POP_FRAME ns32k_pop_frame ()
/* This sequence of words is the instructions extern LONGEST ns32k_call_dummy_words[];
enter 0xff,0 82 ff 00 #define CALL_DUMMY_WORDS ns32k_call_dummy_words
jsr @0x00010203 7f ae c0 01 02 03
adjspd 0x69696969 7f a5 01 02 03 04
bpt f2
Note this is 16 bytes. */
#define CALL_DUMMY { 0x7f00ff82, 0x0201c0ae, 0x01a57f03, 0xf2040302 } extern int sizeof_ns32k_call_dummy_words;
#define SIZEOF_CALL_DUMMY_WORDS sizeof_ns32k_call_dummy_words
#define CALL_DUMMY_START_OFFSET 3 #define CALL_DUMMY_START_OFFSET 3
#define CALL_DUMMY_LENGTH 16
#define CALL_DUMMY_ADDR 5
#define CALL_DUMMY_NARGS 11
/* Insert the specified number of args and function address struct value;
into a call sequence of the above form stored at DUMMYNAME. */ struct type;
extern void ns32k_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
void flip_bytes (void *ptr, int count); struct value **, struct type *, int);
#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) \
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ ns32k_fix_call_dummy ((dummy), (pc), (fun), (nargs), (args), (type), (gcc_p))
{ \
int flipped; \
flipped = fun | 0xc0000000; \
flip_bytes (&flipped, 4); \
*((int *) (((char *) dummyname)+CALL_DUMMY_ADDR)) = flipped; \
flipped = - nargs * 4; \
flip_bytes (&flipped, 4); \
*((int *) (((char *) dummyname)+CALL_DUMMY_NARGS)) = flipped; \
}

View File

@ -26,6 +26,7 @@
static int sign_extend (int value, int bits); static int sign_extend (int value, int bits);
static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR);
static int ns32k_localcount (CORE_ADDR enter_pc); static int ns32k_localcount (CORE_ADDR enter_pc);
static void flip_bytes (void *, int);
char * char *
ns32k_register_name_32082 (int regno) ns32k_register_name_32082 (int regno)
@ -203,7 +204,7 @@ sign_extend (int value, int bits)
: value); : value);
} }
void static void
flip_bytes (void *p, int count) flip_bytes (void *p, int count)
{ {
char tmp; char tmp;
@ -395,7 +396,43 @@ ns32k_pop_frame (void)
write_register (SP_REGNUM, fp + 8); write_register (SP_REGNUM, fp + 8);
flush_cached_frames (); flush_cached_frames ();
} }
/* The NS32000 call dummy sequence:
enter 0xff,0 82 ff 00
jsr @0x00010203 7f ae c0 01 02 03
adjspd 0x69696969 7f a5 01 02 03 04
bpt f2
It is 16 bytes long. */
LONGEST ns32k_call_dummy_words[] =
{
0x7f00ff82,
0x0201c0ae,
0x01a57f03,
0xf2040302
};
int sizeof_ns32k_call_dummy_words = sizeof (ns32k_call_dummy_words);
#define NS32K_CALL_DUMMY_ADDR 5
#define NS32K_CALL_DUMMY_NARGS 11
void
ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
struct value **args, struct type *type, int gcc_p)
{
int flipped;
flipped = fun | 0xc0000000;
flip_bytes (&flipped, 4);
store_unsigned_integer (dummy + NS32K_CALL_DUMMY_ADDR, 4, flipped);
flipped = - nargs * 4;
flip_bytes (&flipped, 4);
store_unsigned_integer (dummy + NS32K_CALL_DUMMY_NARGS, 4, flipped);
}
void void
_initialize_ns32k_tdep (void) _initialize_ns32k_tdep (void)
{ {