static int restore_pc_queue PARAMS ((struct frame_saved_regs *fsr));
static int hppa_alignof PARAMS ((struct type *arg));
+CORE_ADDR frame_saved_pc PARAMS ((FRAME frame));
\f
/* Routines to extract various sized constants out of hppa
return low_sign_extend (word & MASK_5, 5);
}
+/* extract the immediate field from a break instruction */
+
+unsigned
+extract_5r_store (word)
+ unsigned word;
+{
+ return (word & MASK_5);
+}
+
+/* extract the immediate field from a {sr}sm instruction */
+
+unsigned
+extract_5R_store (word)
+ unsigned word;
+{
+ return (word >> 16 & MASK_5);
+}
+
/* extract an 11 bit immediate field */
int
return 0;
}
\f
+int
+frameless_function_invocation (frame)
+ FRAME frame;
+{
+
+ if (use_unwind)
+ {
+ struct unwind_table_entry *u;
+
+ u = find_unwind_entry (frame->pc);
+
+ if (u == 0)
+ return 0;
+
+ return (u->Total_frame_size == 0);
+ }
+ else
+ return frameless_look_for_prologue (frame);
+}
+
CORE_ADDR
saved_pc_after_call (frame)
FRAME frame;
{
CORE_ADDR pc = get_frame_pc (frame);
- if (frameless_look_for_prologue (frame))
+ if (frameless_function_invocation (frame))
{
int ret_regnum;
else
frame->frame = read_register (SP_REGNUM) - framesize;
- if (!frameless_look_for_prologue (frame)) /* Frameless? */
+ if (!frameless_function_invocation (frame)) /* Frameless? */
return; /* No, quit now */
/* For frameless functions, we need to look at the caller's frame */
if (!chain)
return 0;
- msym = lookup_minimal_symbol_by_pc (FRAME_SAVED_PC (thisframe));
-
- if (msym
- && (strcmp (SYMBOL_NAME (msym), "_start") == 0))
- return 0;
- else
- return 1;
-}
-
-#if 0
-/* Some helper functions. gcc_p returns 1 if the function beginning at
- pc appears to have been compiled with gcc. hpux_cc_p returns 1 if
- fn was compiled with hpux cc. gcc functions look like :
+ if (use_unwind)
+ {
- stw rp,-0x14(sp) ; optional
- or r4,r0,r1
- or sp,r0,r4
- stwm r1,framesize(sp)
+ struct unwind_table_entry *u;
- hpux cc functions look like:
+ u = find_unwind_entry (thisframe->pc);
- stw rp,-0x14(sp) ; optional.
- stwm r3,framesiz(sp)
- */
+ if (u && (u->Save_SP || u->Total_frame_size))
+ return 1;
+ else
+ return 0;
+ }
+ else
+ {
+ msym = lookup_minimal_symbol_by_pc (FRAME_SAVED_PC (thisframe));
-gcc_p (pc)
- CORE_ADDR pc;
-{
- if (read_memory_integer (pc, 4) == 0x6BC23FD9)
- pc = pc + 4;
-
- if (read_memory_integer (pc, 4) == 0x8040241
- && read_memory_integer (pc + 4, 4) == 0x81E0244)
- return 1;
- return 0;
+ if (msym
+ && (strcmp (SYMBOL_NAME (msym), "_start") == 0))
+ return 0;
+ else
+ return 1;
+ }
}
-#endif
/*
* These functions deal with saving and restoring register state
frame_saved_regs->regs[RP_REGNUM] = fp - 20 & ~0x3;
frame_saved_regs->regs[FP_REGNUM] = fp;
frame_saved_regs->regs[1] = fp + 8;
- frame_saved_regs->regs[3] = fp + 12;
- for (fp += 16, i = 5; i < 32; fp += 4, i++)
- frame_saved_regs->regs[i] = fp;
+ for (fp += 12, i = 3; i < 32; i++)
+ {
+ if (i != FP_REGNUM)
+ {
+ frame_saved_regs->regs[i] = fp;
+ fp += 4;
+ }
+ }
fp += 4;
for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8)
frame_saved_regs->regs[i] = fp;
frame_saved_regs->regs[IPSW_REGNUM] = fp;
- fp += 4;
- frame_saved_regs->regs[SAR_REGNUM] = fp;
- fp += 4;
- frame_saved_regs->regs[PCOQ_HEAD_REGNUM] = fp;
- fp +=4;
- frame_saved_regs->regs[PCSQ_HEAD_REGNUM] = fp;
- fp +=4;
- frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp;
- fp +=4;
- frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp;
+ frame_saved_regs->regs[SAR_REGNUM] = fp + 4;
+ frame_saved_regs->regs[PCOQ_HEAD_REGNUM] = fp + 8;
+ frame_saved_regs->regs[PCSQ_HEAD_REGNUM] = fp + 12;
+ frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp + 16;
+ frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp + 20;
}
int
CORE_ADDR struct_addr;
{
/* array of arguments' offsets */
- int *offset = (int *)alloca(nargs);
+ int *offset = (int *)alloca(nargs * sizeof (int));
int cum = 0;
int i, alignment;
cum = (cum + alignment) & -alignment;
offset[i] = -cum;
}
- sp += min ((cum + 7) & -8, 16);
+ sp += max ((cum + 7) & -8, 16);
for (i = 0; i < nargs; i++)
write_memory (sp + offset[i], VALUE_CONTENTS (args[i]),
}
void
-_initialize_hppah_tdep ()
+_initialize_hppa_tdep ()
{
add_com ("unwind", class_obscure, unwind_command, "Print unwind info\n");
add_show_from_set