From 2d8d693ab7f2089f39ae3aa18ac587e3f33e2597 Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Wed, 17 Mar 1993 19:32:42 +0000 Subject: [PATCH] New functions from macros in tm-z8k.h. --- gdb/ChangeLog | 5 +++++ gdb/z8k-tdep.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 89ee8ef3d1..a206ca00ea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Wed Mar 17 11:28:11 1993 Steve Chamberlain (sac@thepub.cygnus.com) + + * z8k-tdep.c (extract_return_value, write_return_value, + store_struct_return): New functions from macros in tm-z8k.h. + Wed Mar 17 11:23:06 1993 Fred Fish (fnf@cygnus.com) * valops.c (value_arg_coerce): Apply temporary patch to diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index 3daf7e41f8..73d4b55121 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -305,9 +305,49 @@ addr_bits_set () int saved_pc_after_call () { - return addr_bits_remove (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE)); + return addr_bits_remove + (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE)); } + +extract_return_value(type, regbuf, valbuf) +struct type *type; +char *regbuf; +char *valbuf; +{ + int b; + int len = TYPE_LENGTH(type); + + for (b = 0; b < len; b += 2) { + int todo = len - b; + if (todo > 2) + todo = 2; + memcpy(valbuf + b, regbuf + b, todo); + } +} + +void +write_return_value(type, valbuf) +struct type *type; +char *valbuf; +{ + int reg; + int len; + for (len = 0; len < TYPE_LENGTH(type); len += 2) + { + write_register_bytes(REGISTER_BYTE(len /2 + 2), valbuf + len, 2); + } +} + +void +store_struct_return(addr, sp) +CORE_ADDR addr; +CORE_ADDR sp; +{ + write_register(2, addr); +} + + void print_register_hook (regno) int regno; @@ -406,7 +446,7 @@ segmented_command (args, from_tty) char *args; int from_tty; { - z8k_set_pointer_size (16); + z8k_set_pointer_size (32); } static void