* sparc-tdep.h (sparc_fetch_wcookie): New prototype.

* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Handle
StackGhost.
This commit is contained in:
Mark Kettenis 2004-02-07 20:45:40 +00:00
parent 7d34766b6a
commit 1c80067325
3 changed files with 21 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2004-02-07 Mark Kettenis <kettenis@gnu.org>
* sparc-tdep.h (sparc_fetch_wcookie): New prototype.
* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Handle
StackGhost.
* sparc-tdep.c (sparc32_frame_prev_register): Rename local
variable `i6' to `i7'.
(sparc_supply_rwindow, sparc_collect_rwindow): Likewise.

View File

@ -147,6 +147,9 @@ struct sparc_frame_cache
/* Fetch the instruction at PC. */
extern unsigned long sparc_fetch_instruction (CORE_ADDR pc);
/* Fetch StackGhost Per-Process XOR cookie. */
extern ULONGEST sparc_fetch_wcookie (void);
extern CORE_ADDR sparc_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
struct sparc_frame_cache *cache);

View File

@ -141,6 +141,20 @@ sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame)
regnum <= SPARC_I7_REGNUM; regnum++, addr += 4)
saved_regs[regnum].addr = addr;
/* Handle StackGhost. */
{
ULONGEST wcookie = sparc_fetch_wcookie ();
if (wcookie != 0)
{
ULONGEST i7;
addr = saved_regs[SPARC_I7_REGNUM].addr;
i7 = get_frame_memory_unsigned (next_frame, addr, 4);
trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
}
}
/* The floating-point registers are only saved if the EF bit in %prs
has been set. */