* win32-i386-low.c: Add 64-bit support.
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-sparc-low.c
index bda274e794374b32a867b3402b180ae9d18c9f14..e0bfe81d2011c48e2c326a0f79d50f6ed3de935e 100644 (file)
@@ -1,6 +1,6 @@
 /* Low level interface to ptrace, for the remote server for GDB.
    Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
 static int sparc_regmap[] = {
   /* These offsets correspond to GET/SETREGSET.  */
-         -1,  0*8,  1*8,  2*8,  3*8,  4*8,  5*8,  6*8,            /* g0 .. g7 */
-        7*8,  8*8,  9*8, 10*8, 11*8, 12*8, 13*8, 14*8,    /* o0 .. o5, sp, o7 */
-         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,     /* l0 .. l7 */
-         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,     /* i0 .. i5, fp, i7 */
+       -1,  0*8,  1*8,  2*8,  3*8,  4*8,  5*8,  6*8,      /* g0 .. g7 */
+       7*8,  8*8,  9*8, 10*8, 11*8, 12*8, 13*8, 14*8,     /* o0 .. o5, sp, o7 */
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,      /* l0 .. l7 */
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,      /* i0 .. i5, fp, i7 */
 
   /* Floating point registers offsets correspond to GET/SETFPREGSET.  */
     0*4,  1*4,  2*4,  3*4,  4*4,  5*4,  6*4,  7*4,        /*  f0 ..  f7 */
@@ -61,8 +61,8 @@ static int sparc_regmap[] = {
    24*4, 25*4, 26*4, 27*4, 28*4, 29*4, 30*4, 31*4,        /* f24 .. f31 */
 
   /* F32 offset starts next to f31: 31*4+4 = 16 * 8.  */
-   16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,        /* f32 .. f46 */
-   24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8,        /* f48 .. f62 */
+   16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,        /* f32 .. f46 */
+   24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8,        /* f48 .. f62 */
 
    17 *8, /*    pc */
    18 *8, /*   npc */
@@ -113,7 +113,7 @@ sparc_cannot_fetch_register (int regno)
 }
 
 static void
-sparc_fill_gregset_to_stack (const void *buf)
+sparc_fill_gregset_to_stack (struct regcache *regcache, const void *buf)
 {
   int i;
   CORE_ADDR addr = 0;
@@ -125,43 +125,43 @@ sparc_fill_gregset_to_stack (const void *buf)
   memcpy(&addr, ((char *) buf) + sparc_regmap[find_regno("sp")], sizeof(addr));
 
   addr += BIAS;
-  
+
   for (i = l0_regno; i <= i7_regno; i++)
     {
-      collect_register (i, tmp_reg_buf);
+      collect_register (regcache, i, tmp_reg_buf);
       (*the_target->write_memory) (addr, tmp_reg_buf, sizeof(tmp_reg_buf));
       addr += sizeof(tmp_reg_buf);
     }
 }
 
 static void
-sparc_fill_gregset (void *buf)
+sparc_fill_gregset (struct regcache *regcache, void *buf)
 {
   int i;
   int range;
-  
+
   for (range = 0; range < N_GREGS_RANGES; range++)
     for (i = gregs_ranges[range].regno_start; i <= gregs_ranges[range].regno_end; i++)
       if (sparc_regmap[i] != -1)
-        collect_register (i, ((char *) buf) + sparc_regmap[i]);
-      
-  sparc_fill_gregset_to_stack (buf);
+       collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
+
+  sparc_fill_gregset_to_stack (regcache, buf);
 }
 
 static void
-sparc_fill_fpregset (void *buf)
+sparc_fill_fpregset (struct regcache *regcache, void *buf)
 {
   int i;
   int range;
-  
+
   for (range = 0; range < N_FPREGS_RANGES; range++)
     for (i = fpregs_ranges[range].regno_start; i <= fpregs_ranges[range].regno_end; i++)
-      collect_register (i, ((char *) buf) + sparc_regmap[i]);
-      
+      collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
+
 }
 
 static void
-sparc_store_gregset_from_stack (const void *buf)
+sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf)
 {
   int i;
   CORE_ADDR addr = 0;
@@ -173,52 +173,54 @@ sparc_store_gregset_from_stack (const void *buf)
   memcpy(&addr, ((char *) buf) + sparc_regmap[find_regno("sp")], sizeof(addr));
 
   addr += BIAS;
-  
+
   for (i = l0_regno; i <= i7_regno; i++)
     {
       (*the_target->read_memory) (addr, tmp_reg_buf, sizeof(tmp_reg_buf));
-      supply_register (i, tmp_reg_buf);
+      supply_register (regcache, i, tmp_reg_buf);
       addr += sizeof(tmp_reg_buf);
     }
 }
 
 static void
-sparc_store_gregset (const void *buf)
+sparc_store_gregset (struct regcache *regcache, const void *buf)
 {
   int i;
   char zerobuf[8];
   int range;
 
   memset (zerobuf, 0, sizeof(zerobuf));
-  
+
   for (range = 0; range < N_GREGS_RANGES; range++)
     for (i = gregs_ranges[range].regno_start; i <= gregs_ranges[range].regno_end; i++)
       if (sparc_regmap[i] != -1)
-        supply_register (i, ((char *) buf) + sparc_regmap[i]);
+       supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
       else
-        supply_register (i, zerobuf);
-      
-  sparc_store_gregset_from_stack (buf);
+       supply_register (regcache, i, zerobuf);
+
+  sparc_store_gregset_from_stack (regcache, buf);
 }
 
 static void
-sparc_store_fpregset (const void *buf)
+sparc_store_fpregset (struct regcache *regcache, const void *buf)
 {
   int i;
   int range;
-  
+
   for (range = 0; range < N_FPREGS_RANGES; range++)
-    for (i = fpregs_ranges[range].regno_start; i <= fpregs_ranges[range].regno_end; i++)
-      supply_register (i, ((char *) buf) + sparc_regmap[i]);
+    for (i = fpregs_ranges[range].regno_start;
+        i <= fpregs_ranges[range].regno_end;
+        i++)
+      supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
 }
 
 extern int debug_threads;
 
 static CORE_ADDR
-sparc_get_pc ()
+sparc_get_pc (struct regcache *regcache)
 {
-  CORE_ADDR pc;
-  collect_register_by_name ("pc", &pc);
+  unsigned long pc;
+  collect_register_by_name (regcache, "pc", &pc);
   if (debug_threads)
     fprintf (stderr, "stop pc is %08lx\n", pc);
   return pc;
@@ -234,7 +236,7 @@ sparc_breakpoint_at (CORE_ADDR where)
   unsigned char insn[INSN_SIZE];
 
   (*the_target->read_memory) (where, (unsigned char *) insn, sizeof(insn));
-  
+
   if (memcmp(sparc_breakpoint, insn, sizeof(insn)) == 0)
     return 1;
 
@@ -247,23 +249,24 @@ sparc_breakpoint_at (CORE_ADDR where)
    is outside of the function.  So rather than importing software single-step,
    we can just run until exit.  */
 static CORE_ADDR
-sparc_reinsert_addr ()
+sparc_reinsert_addr (void)
 {
+  struct regcache *regcache = get_thread_regcache (current_inferior, 1);
   CORE_ADDR lr;
   /* O7 is the equivalent to the 'lr' of other archs.  */
-  collect_register_by_name ("o7", &lr);
+  collect_register_by_name (regcache, "o7", &lr);
   return lr;
 }
 
 
 struct regset_info target_regsets[] = {
-  { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
+  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
     GENERAL_REGS,
     sparc_fill_gregset, sparc_store_gregset },
-  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (fpregset_t),
+  { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (fpregset_t),
     FP_REGS,
     sparc_fill_fpregset, sparc_store_fpregset },
-  { 0, 0, -1, -1, NULL, NULL }
+  { 0, 0, 0, -1, -1, NULL, NULL }
 };
 
 struct linux_target_ops the_low_target = {
@@ -284,4 +287,3 @@ struct linux_target_ops the_low_target = {
   NULL, NULL, NULL, NULL,
   NULL, NULL
 };
-
This page took 0.026637 seconds and 4 git commands to generate.