* hppa-hpux-tdep.c: Update copyright notice and year.
[deliverable/binutils-gdb.git] / gdb / i386-linux-nat.c
index 061f645c8cf09fd6d67a02dcb5896fea685b12f2..d61c9993086c7852a4097a89b9ea765623e1512d 100644 (file)
 /* Prototypes for supply_gregset etc.  */
 #include "gregset.h"
 
-/* Prototypes for i387_supply_fsave etc.  */
 #include "i387-tdep.h"
-
-/* Defines for XMM0_REGNUM etc. */
 #include "i386-tdep.h"
-
-/* Defines I386_LINUX_ORIG_EAX_REGNUM.  */
 #include "i386-linux-tdep.h"
 
 /* Defines ps_err_e, struct ps_prochandle.  */
 #include "gdb_proc_service.h"
-
-/* Prototypes for local functions.  */
-static void dummy_sse_values (void);
 \f
 
 /* The register sets used in GNU/Linux ELF core-dumps are identical to
@@ -114,11 +106,8 @@ static int regmap[] =
 #define GETREGS_SUPPLIES(regno) \
   ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
 
-#define GETFPREGS_SUPPLIES(regno) \
-  (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM)
-
 #define GETFPXREGS_SUPPLIES(regno) \
-  (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM)
+  (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)
 
 /* Does the current host support the GETREGS request?  */
 int have_ptrace_getregs =
@@ -179,7 +168,7 @@ fetch_register (int regno)
   gdb_assert (!have_ptrace_getregs);
   if (cannot_fetch_register (regno))
     {
-      supply_register (regno, NULL);
+      regcache_raw_supply (current_regcache, regno, NULL);
       return;
     }
 
@@ -194,7 +183,7 @@ fetch_register (int regno)
     error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno),
           regno, safe_strerror (errno));
 
-  supply_register (regno, &val);
+  regcache_raw_supply (current_regcache, regno, &val);
 }
 
 /* Store one register. */
@@ -215,7 +204,7 @@ store_register (int regno)
     tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
 
   errno = 0;
-  regcache_collect (regno, &val);
+  regcache_raw_collect (current_regcache, regno, &val);
   ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val);
   if (errno != 0)
     error ("Couldn't write register %s (#%d): %s.", REGISTER_NAME (regno),
@@ -236,10 +225,11 @@ supply_gregset (elf_gregset_t *gregsetp)
   int i;
 
   for (i = 0; i < I386_NUM_GREGS; i++)
-    supply_register (i, regp + regmap[i]);
+    regcache_raw_supply (current_regcache, i, regp + regmap[i]);
 
   if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
-    supply_register (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX);
+    regcache_raw_supply (current_regcache, I386_LINUX_ORIG_EAX_REGNUM,
+                        regp + ORIG_EAX);
 }
 
 /* Fill register REGNO (if it is a general-purpose register) in
@@ -254,11 +244,12 @@ fill_gregset (elf_gregset_t *gregsetp, int regno)
 
   for (i = 0; i < I386_NUM_GREGS; i++)
     if (regno == -1 || regno == i)
-      regcache_collect (i, regp + regmap[i]);
+      regcache_raw_collect (current_regcache, i, regp + regmap[i]);
 
   if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
       && I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
-    regcache_collect (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX);
+    regcache_raw_collect (current_regcache, I386_LINUX_ORIG_EAX_REGNUM,
+                         regp + ORIG_EAX);
 }
 
 #ifdef HAVE_PTRACE_GETREGS
@@ -321,7 +312,6 @@ void
 supply_fpregset (elf_fpregset_t *fpregsetp)
 {
   i387_supply_fsave (current_regcache, -1, fpregsetp);
-  dummy_sse_values ();
 }
 
 /* Fill register REGNO (if it is a floating-point register) in
@@ -456,32 +446,10 @@ store_fpxregs (int tid, int regno)
   return 1;
 }
 
-/* Fill the XMM registers in the register array with dummy values.  For
-   cases where we don't have access to the XMM registers.  I think
-   this is cleaner than printing a warning.  For a cleaner solution,
-   we should gdbarchify the i386 family.  */
-
-static void
-dummy_sse_values (void)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
-  /* C doesn't have a syntax for NaN's, so write it out as an array of
-     longs.  */
-  static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
-  static long mxcsr = 0x1f80;
-  int reg;
-
-  for (reg = 0; reg < tdep->num_xmm_regs; reg++)
-    supply_register (XMM0_REGNUM + reg, (char *) dummy);
-  if (tdep->num_xmm_regs > 0)
-    supply_register (MXCSR_REGNUM, (char *) &mxcsr);
-}
-
 #else
 
 static int fetch_fpxregs (int tid) { return 0; }
 static int store_fpxregs (int tid, int regno) { return 0; }
-static void dummy_sse_values (void) {}
 
 #endif /* HAVE_PTRACE_GETFPXREGS */
 \f
@@ -657,7 +625,7 @@ i386_linux_dr_get (int regnum)
   /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
      ptrace call fails breaks debugging remote targets.  The correct
      way to fix this is to add the hardware breakpoint and watchpoint
-     stuff to the target vectore.  For now, just return zero if the
+     stuff to the target vector.  For now, just return zero if the
      ptrace call fails.  */
   errno = 0;
   value = ptrace (PTRACE_PEEKUSER, tid,
@@ -767,7 +735,7 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
 #define LINUX_SYSCALL_LEN (sizeof linux_syscall)
 
 /* The system call number is stored in the %eax register.  */
-#define LINUX_SYSCALL_REGNUM 0 /* %eax */
+#define LINUX_SYSCALL_REGNUM I386_EAX_REGNUM
 
 /* We are specifically interested in the sigreturn and rt_sigreturn
    system calls.  */
@@ -815,7 +783,7 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
          that's about to be restored, and set the trace flag there.  */
 
       /* First check if PC is at a system call.  */
-      if (read_memory_nobpt (pc, (char *) buf, LINUX_SYSCALL_LEN) == 0
+      if (deprecated_read_memory_nobpt (pc, (char *) buf, LINUX_SYSCALL_LEN) == 0
          && memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0)
        {
          int syscall = read_register_pid (LINUX_SYSCALL_REGNUM,
This page took 0.02575 seconds and 4 git commands to generate.