From 25de138b06f6cea850bfe352a6b3e00fbf60fd87 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 11 Feb 1997 19:31:29 +0000 Subject: [PATCH] * mn10200-tdep.c (mn10200_push_arguments): Stack only needs to be two byte aligned. Round argument sizes up to two byte boundary. Write out args in two byte hunks. (mn10200_push_return_address): Implement. * config/mn10200/tm-mn10200.h (EXTRACT_RETURN_VALUE): Abort for structures > 8 bytes (temporary). (STORE_RETURN_VALUE): Likewise. (CALL_DUMMY): No longer undefine. (USE_STRUCT_CONVENTION): Use for args > 8 bytes. (REG_STRUCT_HAS_ADDR): Define. Inferior function calls for the mn10200. --- gdb/ChangeLog | 13 +++++++++++++ gdb/config/mn10200/tm-mn10200.h | 10 ++++++---- gdb/mn10200-tdep.c | 19 +++++++++++-------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a11a0e6cb8d..1fe29441297 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +Tue Feb 11 12:28:09 1997 Jeffrey A Law (law@cygnus.com) + + * mn10200-tdep.c (mn10200_push_arguments): Stack only needs to + be two byte aligned. Round argument sizes up to two byte boundary. + Write out args in two byte hunks. + (mn10200_push_return_address): Implement. + * config/mn10200/tm-mn10200.h (EXTRACT_RETURN_VALUE): Abort for + structures > 8 bytes (temporary). + (STORE_RETURN_VALUE): Likewise. + (CALL_DUMMY): No longer undefine. + (USE_STRUCT_CONVENTION): Use for args > 8 bytes. + (REG_STRUCT_HAS_ADDR): Define. + start-sanitize-r5900 Fri Feb 07 09:04:37 1997 Gavin Koch diff --git a/gdb/config/mn10200/tm-mn10200.h b/gdb/config/mn10200/tm-mn10200.h index 18910754bf3..a509c8e898b 100644 --- a/gdb/config/mn10200/tm-mn10200.h +++ b/gdb/config/mn10200/tm-mn10200.h @@ -122,7 +122,7 @@ extern CORE_ADDR mn10200_frame_saved_pc PARAMS ((struct frame_info *)); #define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ { \ - if (TYPE_LENGTH (TYPE) > 4) \ + if (TYPE_LENGTH (TYPE) > 8) \ abort (); \ else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \ { \ @@ -141,7 +141,7 @@ extern CORE_ADDR mn10200_frame_saved_pc PARAMS ((struct frame_info *)); #define STORE_RETURN_VALUE(TYPE, VALBUF) \ { \ - if (TYPE_LENGTH (TYPE) > 4) \ + if (TYPE_LENGTH (TYPE) > 8) \ abort (); \ else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \ { \ @@ -171,7 +171,6 @@ extern void mn10200_pop_frame PARAMS ((struct frame_info *)); #define USE_GENERIC_DUMMY_FRAMES #define CALL_DUMMY {0} -#undef CALL_DUMMY /* for now, no function calls */ #define CALL_DUMMY_START_OFFSET (0) #define CALL_DUMMY_BREAKPOINT_OFFSET (0) #define CALL_DUMMY_LOCATION AT_ENTRY_POINT @@ -191,8 +190,11 @@ mn10200_push_arguments PARAMS ((int, struct value **, CORE_ADDR, #define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP) +#define REG_STRUCT_HAS_ADDR(gcc_p,type) \ + (TYPE_LENGTH (type) > 8) + #define USE_STRUCT_CONVENTION(GCC_P, TYPE) \ - (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4) + (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 8) /* Override the default get_saved_register function with one that takes account of generic CALL_DUMMY frames. */ diff --git a/gdb/mn10200-tdep.c b/gdb/mn10200-tdep.c index 11c03e9a089..8c3812d816a 100644 --- a/gdb/mn10200-tdep.c +++ b/gdb/mn10200-tdep.c @@ -530,15 +530,15 @@ mn10200_push_arguments (nargs, args, sp, struct_return, struct_addr) int stack_offset = 0; /* This should be a nop, but align the stack just in case something - went wrong. */ - sp &= ~3; + went wrong. Stacks are two byte aligned on the mn10200. */ + sp &= ~1; /* Now make space on the stack for the args. XXX This doesn't appear to handle pass-by-invisible reference arguments. */ for (argnum = 0; argnum < nargs; argnum++) - len += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3); + len += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 1) & ~1); /* Allocate stack space. */ sp -= len; @@ -567,11 +567,11 @@ mn10200_push_arguments (nargs, args, sp, struct_return, struct_addr) while (len > 0) { /* XXX This looks wrong; we can have one and two byte args. */ - write_memory (sp + stack_offset, val, 4); + write_memory (sp + stack_offset, val, 2); - len -= 4; - val += 4; - stack_offset += 4; + len -= 2; + val += 2; + stack_offset += 2; } args++; } @@ -588,8 +588,11 @@ mn10200_push_return_address (pc, sp) CORE_ADDR pc; CORE_ADDR sp; { + unsigned char buf[4]; - return sp; + store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ()); + write_memory (sp - 4, buf, 4); + return sp - 4; } /* Function: frame_saved_pc -- 2.30.2