- case UNW_IA64_AR_BSPSTORE:
- write_register (IA64_BSP_REGNUM, *val);
- break;
-
- case UNW_IA64_AR_BSP:
- case UNW_IA64_BSP:
- /* Account for the fact that ptrace() expects bsp to point
- after the current register frame. */
- cfm = read_register (IA64_CFM_REGNUM);
- sof = (cfm & 0x7f);
- bsp = ia64_rse_skip_regs (*val, sof);
- write_register (IA64_BSP_REGNUM, bsp);
- break;
-
- case UNW_IA64_CFM:
- /* If we change CFM, we need to adjust ptrace's notion of
- bsp accordingly, so that the real bsp remains
- unchanged. */
- bsp = read_register (IA64_BSP_REGNUM);
- cfm = read_register (IA64_CFM_REGNUM);
- old_sof = (cfm & 0x7f);
- new_sof = (*val & 0x7f);
- if (old_sof != new_sof)
- {
- bsp = ia64_rse_skip_regs (bsp, -old_sof + new_sof);
- write_register (IA64_BSP_REGNUM, bsp);
- }
- write_register (IA64_CFM_REGNUM, *val);
- break;
-
- default:
- write_register (regnum, *val);
- break;
- }
- if (gdbarch_debug >= 1)
- fprintf_unfiltered (gdb_stdlog,
- " access_reg: to cache: %4s=0x%s\n",
- (((unsigned) regnum <= IA64_NAT127_REGNUM)
- ? ia64_register_names[regnum] : "r??"),
- paddr_nz (*val));
- }
- else
- {
- switch (uw_regnum)
- {
- case UNW_REG_IP:
- /* Libunwind expects to see the pc value which means the slot number
- from the psr must be merged with the ip word address. */
- frame_unwind_register (next_frame, IA64_IP_REGNUM, buf);
- ip = extract_unsigned_integer (buf, 8);
- frame_unwind_register (next_frame, IA64_PSR_REGNUM, buf);
- psr = extract_unsigned_integer (buf, 8);
- *val = ip | ((psr >> 41) & 0x3);
- break;
-
- case UNW_IA64_AR_BSP:
- /* Libunwind expects to see the beginning of the current register
- frame so we must account for the fact that ptrace() will return a value
- for bsp that points *after* the current register frame. */
- frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf);
- bsp = extract_unsigned_integer (buf, 8);
- frame_unwind_register (next_frame, IA64_CFM_REGNUM, buf);
- cfm = extract_unsigned_integer (buf, 8);
- sof = (cfm & 0x7f);
- *val = ia64_rse_skip_regs (bsp, -sof);
- break;
-
- case UNW_IA64_AR_BSPSTORE:
- /* Libunwind wants bspstore to be after the current register frame.
- This is what ptrace() and gdb treats as the regular bsp value. */
- frame_unwind_register (next_frame, IA64_BSP_REGNUM, buf);
- *val = extract_unsigned_integer (buf, 8);
- break;