* i386-tdep.c (i386_register_virtual_type,
[binutils-gdb.git] / gdb / i386-tdep.c
index 8684fce684d6f4e1753980f94c9226b816bd8c97..5b344175208637aac38cdda590a0865d59dde4b9 100644 (file)
@@ -973,20 +973,21 @@ i386_extract_return_value (struct type *type, struct regcache *regcache,
    in VALBUF of type TYPE, given in virtual format.  */
 
 static void
-i386_store_return_value (struct type *type, char *valbuf)
+i386_store_return_value (struct type *type, struct regcache *regcache,
+                        const void *valbuf)
 {
   int len = TYPE_LENGTH (type);
 
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT
       && TYPE_NFIELDS (type) == 1)
     {
-      i386_store_return_value (TYPE_FIELD_TYPE (type, 0), valbuf);
+      i386_store_return_value (TYPE_FIELD_TYPE (type, 0), regcache, valbuf);
       return;
     }
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
-      unsigned int fstat;
+      ULONGEST fstat;
       char buf[FPU_REG_RAW_SIZE];
 
       if (FP0_REGNUM == 0)
@@ -1004,20 +1005,20 @@ i386_store_return_value (struct type *type, char *valbuf)
         not exactly how it would happen on the target itself, but
         it is the best we can do.  */
       convert_typed_floating (valbuf, type, buf, builtin_type_i387_ext);
-      write_register_gen (FP0_REGNUM, buf);
+      regcache_raw_write (regcache, FP0_REGNUM, buf);
 
       /* Set the top of the floating-point register stack to 7.  The
          actual value doesn't really matter, but 7 is what a normal
          function return would end up with if the program started out
          with a freshly initialized FPU.  */
-      fstat = read_register (FSTAT_REGNUM);
+      regcache_raw_read_unsigned (regcache, FSTAT_REGNUM, &fstat);
       fstat |= (7 << 11);
-      write_register (FSTAT_REGNUM, fstat);
+      regcache_raw_write_unsigned (regcache, FSTAT_REGNUM, fstat);
 
       /* Mark %st(1) through %st(7) as empty.  Since we set the top of
          the floating-point register stack to 7, the appropriate value
          for the tag word is 0x3fff.  */
-      write_register (FTAG_REGNUM, 0x3fff);
+      regcache_raw_write_unsigned (regcache, FTAG_REGNUM, 0x3fff);
     }
   else
     {
@@ -1025,13 +1026,12 @@ i386_store_return_value (struct type *type, char *valbuf)
       int high_size = REGISTER_RAW_SIZE (HIGH_RETURN_REGNUM);
 
       if (len <= low_size)
-       write_register_bytes (REGISTER_BYTE (LOW_RETURN_REGNUM), valbuf, len);
+       regcache_raw_write_part (regcache, LOW_RETURN_REGNUM, 0, len, valbuf);
       else if (len <= (low_size + high_size))
        {
-         write_register_bytes (REGISTER_BYTE (LOW_RETURN_REGNUM),
-                               valbuf, low_size);
-         write_register_bytes (REGISTER_BYTE (HIGH_RETURN_REGNUM),
-                               valbuf + low_size, len - low_size);
+         regcache_raw_write (regcache, LOW_RETURN_REGNUM, valbuf);
+         regcache_raw_write_part (regcache, HIGH_RETURN_REGNUM, 0,
+                                  len - low_size, (char *) valbuf + low_size);
        }
       else
        internal_error (__FILE__, __LINE__,
@@ -1102,10 +1102,10 @@ i386_register_virtual_type (int regnum)
   if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM)
     return lookup_pointer_type (builtin_type_void);
 
-  if (IS_FP_REGNUM (regnum))
+  if (FP_REGNUM_P (regnum))
     return builtin_type_i387_ext;
 
-  if (IS_SSE_REGNUM (regnum))
+  if (SSE_REGNUM_P (regnum))
     return builtin_type_vec128i;
 
   if (mmx_regnum_p (regnum))
@@ -1175,7 +1175,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 static int
 i386_register_convertible (int regnum)
 {
-  return IS_FP_REGNUM (regnum);
+  return FP_REGNUM_P (regnum);
 }
 
 /* Convert data from raw format for register REGNUM in buffer FROM to
@@ -1185,7 +1185,7 @@ static void
 i386_register_convert_to_virtual (int regnum, struct type *type,
                                  char *from, char *to)
 {
-  gdb_assert (IS_FP_REGNUM (regnum));
+  gdb_assert (FP_REGNUM_P (regnum));
 
   /* We only support floating-point values.  */
   if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -1208,7 +1208,7 @@ static void
 i386_register_convert_to_raw (struct type *type, int regnum,
                              char *from, char *to)
 {
-  gdb_assert (IS_FP_REGNUM (regnum));
+  gdb_assert (FP_REGNUM_P (regnum));
 
   /* We only support floating-point values.  */
   if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -1460,7 +1460,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      on having a `long double' that's not `long' at all.  */
   set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
 
-  /* Although the i386 extended floating-point has only 80 significant
+  /* Although the i387 extended floating-point has only 80 significant
      bits, a `long double' actually takes up 96, probably to enforce
      alignment.  */
   set_gdbarch_long_double_bit (gdbarch, 96);
@@ -1469,11 +1469,11 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      tm-symmetry.h currently override this.  Sigh.  */
   set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS);
 
-  set_gdbarch_sp_regnum (gdbarch, 4);
-  set_gdbarch_fp_regnum (gdbarch, 5);
-  set_gdbarch_pc_regnum (gdbarch, 8);
-  set_gdbarch_ps_regnum (gdbarch, 9);
-  set_gdbarch_fp0_regnum (gdbarch, 16);
+  set_gdbarch_sp_regnum (gdbarch, 4); /* %esp */
+  set_gdbarch_fp_regnum (gdbarch, 5); /* %ebp */
+  set_gdbarch_pc_regnum (gdbarch, 8); /* %eip */
+  set_gdbarch_ps_regnum (gdbarch, 9); /* %eflags */
+  set_gdbarch_fp0_regnum (gdbarch, 16);        /* %st(0) */
 
   /* Use the "default" register numbering scheme for stabs and COFF.  */
   set_gdbarch_stab_reg_to_regnum (gdbarch, i386_stab_reg_to_regnum);
@@ -1518,7 +1518,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_convert_to_raw (gdbarch, i386_register_convert_to_raw);
 
   set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
-  set_gdbarch_push_arguments (gdbarch, i386_push_arguments);
 
   set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_at_entry_point);
 
@@ -1533,7 +1532,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_push_return_address (gdbarch, i386_push_return_address);
   set_gdbarch_pop_frame (gdbarch, i386_pop_frame);
   set_gdbarch_store_struct_return (gdbarch, i386_store_struct_return);
-  set_gdbarch_deprecated_store_return_value (gdbarch, i386_store_return_value);
+  set_gdbarch_store_return_value (gdbarch, i386_store_return_value);
   set_gdbarch_extract_struct_value_address (gdbarch,
                                            i386_extract_struct_value_address);
   set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention);