diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-02-27 16:38:39 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-02-27 16:38:39 +0000 |
commit | 1797a8f623fe9a60ec738f109c6c6327abb5b2a6 (patch) | |
tree | 63f12cd80f6b8a8bd8e14f575944c44e66cbaa28 /gdb/hppa-tdep.c | |
parent | ce11586c0bec91693cdc273f939957d0c72faa43 (diff) | |
download | gdb-1797a8f623fe9a60ec738f109c6c6327abb5b2a6.zip gdb-1797a8f623fe9a60ec738f109c6c6327abb5b2a6.tar.gz gdb-1797a8f623fe9a60ec738f109c6c6327abb5b2a6.tar.bz2 |
2004-02-27 Andrew Cagney <cagney@redhat.com>
* hppa-tdep.c (hppa32_push_dummy_call): Fix code reserving
inferior stack space - the stack needs to grow upwards.
(hppa32_frame_align): New function.
(hppa64_frame_align): Replace hppa_frame_align.
(hppa_gdbarch_init): Update.
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r-- | gdb/hppa-tdep.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 0fc1131..c248803 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2205,8 +2205,8 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, int write_pass; for (write_pass = 0; write_pass < 2; write_pass++) { - CORE_ADDR struct_ptr = struct_end; - CORE_ADDR param_ptr = param_end; + CORE_ADDR struct_ptr = 0; + CORE_ADDR param_ptr = 0; int reg = 27; /* NOTE: Registers go down. */ int i; for (i = 0; i < nargs; i++) @@ -2223,11 +2223,11 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, /* Large parameter, pass by reference. Store the value in "struct" area and then pass its address. */ param_len = 4; - struct_ptr -= align_up (TYPE_LENGTH (type), 8); + struct_ptr += align_up (TYPE_LENGTH (type), 8); if (write_pass) - write_memory (struct_ptr, VALUE_CONTENTS (arg), + write_memory (struct_end - struct_ptr, VALUE_CONTENTS (arg), TYPE_LENGTH (type)); - store_unsigned_integer (param_val, 4, struct_ptr); + store_unsigned_integer (param_val, 4, struct_end - struct_ptr); } else if (TYPE_CODE (type) == TYPE_CODE_INT || TYPE_CODE (type) == TYPE_CODE_ENUM) @@ -2246,11 +2246,11 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, memcpy (param_val + param_len - TYPE_LENGTH (type), VALUE_CONTENTS (arg), TYPE_LENGTH (type)); } - param_ptr -= param_len; + param_ptr += param_len; reg -= param_len / 4; if (write_pass) { - write_memory (param_ptr, param_val, param_len); + write_memory (param_end - param_ptr, param_val, param_len); if (reg >= 23) { regcache_cooked_write (regcache, reg, param_val); @@ -2412,10 +2412,18 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, } +static CORE_ADDR +hppa32_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) +{ + /* HP frames are 64-byte (or cache line) aligned (yes that's _byte_ + and not _bit_)! */ + return align_up (addr, 64); +} + /* Force all frames to 16-byte alignment. Better safe than sorry. */ static CORE_ADDR -hppa_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) +hppa64_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) { /* Just always 16-byte align. */ return align_up (addr, 16); @@ -5838,14 +5846,15 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Inferior function call methods. */ if (0) { - set_gdbarch_frame_align (gdbarch, hppa_frame_align); switch (tdep->bytes_per_address) { case 4: set_gdbarch_push_dummy_call (gdbarch, hppa32_push_dummy_call); + set_gdbarch_frame_align (gdbarch, hppa32_frame_align); break; case 8: set_gdbarch_push_dummy_call (gdbarch, hppa64_push_dummy_call); + set_gdbarch_frame_align (gdbarch, hppa64_frame_align); break; } } |