len = DEPRECATED_REGISTER_RAW_SIZE (regno);
len = register_size (current_gdbarch, regno);
store_inferior_registers (int regno){  unsigned int regaddr;  char buf[80];  int i;  unsigned int offset = U_REGS_OFFSET;  int scratch;  if (regno >= 0)    {      unsigned int addr, len, offset;      if (CANNOT_STORE_REGISTER (regno))	return;      offset = 0;      len = DEPRECATED_REGISTER_RAW_SIZE (regno);      /* Requests for register zero actually want the save_state's	 ss_flags member.  As RM says: "Oh, what a hack!"  */      if (regno == 0)	{	  save_state_t ss;	  addr = HPPAH_OFFSETOF (save_state_t, ss_flags);	  len = sizeof (ss.ss_flags);	  /* Note that ss_flags is always an int, no matter what	     DEPRECATED_REGISTER_RAW_SIZE(0) says.  Assuming all HP-UX	     PA machines are big-endian, put it at the least	     significant end of the value, and zap the rest of the	     buffer.  */	  offset = DEPRECATED_REGISTER_RAW_SIZE (0) - len;	}      /* Floating-point registers come from the ss_fpblock area.  */      else if (regno >= FP0_REGNUM)	addr = (HPPAH_OFFSETOF (save_state_t, ss_fpblock) 		+ (DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (FP0_REGNUM)));      /* Wide registers come from the ss_wide area.	 I think it's more PC to test (ss_flags & SS_WIDEREGS) to select	 between ss_wide and ss_narrow than to use the raw register size.	 But checking ss_flags would require an extra ptrace call for	 every register reference.  Bleah.  */      else if (len == 8)	addr = (HPPAH_OFFSETOF (save_state_t, ss_wide) 		+ DEPRECATED_REGISTER_BYTE (regno));      /* Narrow registers come from the ss_narrow area.  Note that	 ss_narrow starts with gr1, not gr0.  */      else if (len == 4)	addr = (HPPAH_OFFSETOF (save_state_t, ss_narrow)		+ (DEPRECATED_REGISTER_BYTE (regno) - DEPRECATED_REGISTER_BYTE (1)));      else	internal_error (__FILE__, __LINE__,			"hppah-nat.c (write_register): unexpected register size");#ifdef GDB_TARGET_IS_HPPA_20W      /* Unbelieveable.  The PC head and tail must be written in 64bit hunks	 or we will get an error.  Worse yet, the oddball ptrace/ttrace	 layering will not allow us to perform a 64bit register store.	 What a crock.  */      if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM && len == 8)	{	  CORE_ADDR temp;	  temp = *(CORE_ADDR *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)];	  /* Set the priv level (stored in the low two bits of the PC.  */	  temp |= 0x3;	  ttrace_write_reg_64 (PIDGET (inferior_ptid), (CORE_ADDR)addr,	                       (CORE_ADDR)&temp);	  /* If we fail to write the PC, give a true error instead of	     just a warning.  */	  if (errno != 0)	    {	      char *err = safe_strerror (errno);	      char *msg = alloca (strlen (err) + 128);	      sprintf (msg, "writing `%s' register: %s",		        REGISTER_NAME (regno), err);	      perror_with_name (msg);	    }	  return;	}      /* Another crock.  HPUX complains if you write a nonzero value to	 the high part of IPSW.  What will it take for HP to catch a	 clue about building sensible interfaces?  */     if (regno == IPSW_REGNUM && len == 8)	*(int *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)] = 0;#endif      for (i = 0; i < len; i += sizeof (int))	{	  errno = 0;	  call_ptrace (PT_WUREGS, PIDGET (inferior_ptid),	               (PTRACE_ARG3_TYPE) addr + i,		       *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno) + i]);	  if (errno != 0)	    {	      /* Warning, not error, in case we are attached; sometimes		 the kernel doesn't let us at the registers. */	      char *err = safe_strerror (errno);	      char *msg = alloca (strlen (err) + 128);	      sprintf (msg, "writing `%s' register: %s",		        REGISTER_NAME (regno), err);	      /* If we fail to write the PC, give a true error instead of		 just a warning.  */	      if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)		perror_with_name (msg);	      else		warning (msg);	      return;	    }	}    }  else    for (regno = 0; regno < NUM_REGS; regno++)      store_inferior_registers (regno);}