memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0, reg_size); memcpy ((char *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)] + adj, VALUE_CONTENTS (arg), len);
char word[MAX_REGISTER_SIZE];  memset (word, 0, reg_size); memcpy (word, VALUE_CONTENTS (arg), len); regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
rs6000_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,			struct regcache *regcache, CORE_ADDR bp_addr,			int nargs, struct value **args, CORE_ADDR sp,			int struct_return, CORE_ADDR struct_addr){  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);  int ii;  int len = 0;  int argno;			/* current argument number */  int argbytes;			/* current argument byte */  char tmp_buffer[50];  int f_argno = 0;		/* current floating point argno */  int wordsize = gdbarch_tdep (current_gdbarch)->wordsize;  struct value *arg = 0;  struct type *type;  CORE_ADDR saved_sp;  /* The first eight words of ther arguments are passed in registers.     Copy them appropriately.  */  ii = 0;  /* If the function is returning a `struct', then the first word     (which will be passed in r3) is used for struct return address.     In that case we should advance one word and start from r4     register to copy parameters.  */  if (struct_return)    {      regcache_raw_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,				   struct_addr);      ii++;    }/*    effectively indirect call... gcc does...   return_val example( float, int);   eabi:    float in fp0, int in r3   offset of stack on overflow 8/16   for varargs, must go by type.   power open:   float in r3&r4, int in r5   offset of stack on overflow different    both:    return in r3 or f0.  If no float, must study how gcc emulates floats;   pay attention to arg promotion.     User may have to cast\args to handle promotion correctly    since gdb won't know if prototype supplied or not. */  for (argno = 0, argbytes = 0; argno < nargs && ii < 8; ++ii)    {      int reg_size = DEPRECATED_REGISTER_RAW_SIZE (ii + 3);      arg = args[argno];      type = check_typedef (VALUE_TYPE (arg));      len = TYPE_LENGTH (type);      if (TYPE_CODE (type) == TYPE_CODE_FLT)	{	  /* Floating point arguments are passed in fpr's, as well as gpr's.	     There are 13 fpr's reserved for passing parameters. At this point	     there is no way we would run out of them.  */	  if (len > 8)	    printf_unfiltered (				"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);	  memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)],		  VALUE_CONTENTS (arg),		  len);	  ++f_argno;	}      if (len > reg_size)	{	  /* Argument takes more than one register.  */	  while (argbytes < len)	    {	      memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0,		      reg_size);	      memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)],		      ((char *) VALUE_CONTENTS (arg)) + argbytes,		      (len - argbytes) > reg_size		        ? reg_size : len - argbytes);	      ++ii, argbytes += reg_size;	      if (ii >= 8)		goto ran_out_of_registers_for_arguments;	    }	  argbytes = 0;	  --ii;	}      else	{	  /* Argument can fit in one register.  No problem.  */	  int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0;	  memset (&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)], 0, reg_size);	  memcpy ((char *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + 3)] + adj, 	          VALUE_CONTENTS (arg), len);	}      ++argno;    }ran_out_of_registers_for_arguments:  saved_sp = read_sp ();  /* Location for 8 parameters are always reserved.  */  sp -= wordsize * 8;  /* Another six words for back chain, TOC register, link register, etc.  */  sp -= wordsize * 6;  /* Stack pointer must be quadword aligned.  */  sp &= -16;  /* If there are more arguments, allocate space for them in      the stack, then push them starting from the ninth one.  */  if ((argno < nargs) || argbytes)    {      int space = 0, jj;      if (argbytes)	{	  space += ((len - argbytes + 3) & -4);	  jj = argno + 1;	}      else	jj = argno;      for (; jj < nargs; ++jj)	{	  struct value *val = args[jj];	  space += ((TYPE_LENGTH (VALUE_TYPE (val))) + 3) & -4;	}      /* Add location required for the rest of the parameters.  */      space = (space + 15) & -16;      sp -= space;      /* This is another instance we need to be concerned about         securing our stack space. If we write anything underneath %sp         (r1), we might conflict with the kernel who thinks he is free         to use this area.  So, update %sp first before doing anything         else.  */      regcache_raw_write_signed (regcache, SP_REGNUM, sp);      /* If the last argument copied into the registers didn't fit there          completely, push the rest of it into stack.  */      if (argbytes)	{	  write_memory (sp + 24 + (ii * 4),			((char *) VALUE_CONTENTS (arg)) + argbytes,			len - argbytes);	  ++argno;	  ii += ((len - argbytes + 3) & -4) / 4;	}      /* Push the rest of the arguments into stack.  */      for (; argno < nargs; ++argno)	{	  arg = args[argno];	  type = check_typedef (VALUE_TYPE (arg));	  len = TYPE_LENGTH (type);	  /* Float types should be passed in fpr's, as well as in the             stack.  */	  if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)	    {	      if (len > 8)		printf_unfiltered (				    "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);	      memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (FP0_REGNUM + 1 + f_argno)],		      VALUE_CONTENTS (arg),		      len);	      ++f_argno;	    }	  write_memory (sp + 24 + (ii * 4), (char *) VALUE_CONTENTS (arg), len);	  ii += ((len + 3) & -4) / 4;	}    }  /* Set the stack pointer.  According to the ABI, the SP is meant to     be set _before_ the corresponding stack space is used.  On AIX,     this even applies when the target has been completely stopped!     Not doing this can lead to conflicts with the kernel which thinks     that it still has control over this not-yet-allocated stack     region.  */  regcache_raw_write_signed (regcache, SP_REGNUM, sp);  /* Set back chain properly.  */  store_unsigned_integer (tmp_buffer, 4, saved_sp);  write_memory (sp, tmp_buffer, 4);  /* Point the inferior function call's return address at the dummy's     breakpoint.  */  regcache_raw_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);  /* Set the TOC register, get the value from the objfile reader     which, in turn, gets it from the VMAP table.  */  if (rs6000_find_toc_address_hook != NULL)    {      CORE_ADDR tocvalue = (*rs6000_find_toc_address_hook) (func_addr);      regcache_raw_write_signed (regcache, tdep->ppc_toc_regnum, tocvalue);    }  target_store_registers (-1);  return sp;}