Date: Sat, 17 Apr 2004 12:41:52 -0700 (PDT) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 51257 for review Message-ID: <200404171941.i3HJfqUo093864@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=51257 Change 51257 by marcel@marcel_nfs on 2004/04/17 12:41:42 Import implementation of fill_fpregset() and fill_gregset(). Affected files ... .. //depot/projects/gdb/contrib/gdb6/gdb/ia64-fbsd-nat.c#2 edit .. //depot/projects/gdb/contrib/gdb6/gdb/ia64-fbsd-tdep.c#2 edit Differences ... ==== //depot/projects/gdb/contrib/gdb6/gdb/ia64-fbsd-nat.c#2 (text+ko) ==== @@ -51,21 +51,9 @@ /* XXX need to go away. */ void ia64_fbsd_supply_fpregs (void *, int); -void ia64_fbsd_supply_regs (void *, int); - -void -fill_fpregset(fpregset_t *fpr, int regno) -{ - printf_filtered("XXX: %s(%p,%d)\n", __func__, fpr, regno); -} +void ia64_fbsd_supply_gregs (void *, int); void -fill_gregset (gregset_t *r, int regno) -{ - printf_filtered("XXX: %s(%p,%d)\n", __func__, r, regno); -} - -void fetch_inferior_registers (int regno) { union { @@ -78,7 +66,7 @@ if (ptrace (PT_GETREGS, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)®s.r, 0) == -1) perror_with_name ("Couldn't get registers"); - ia64_fbsd_supply_regs (®s.r, regno); + ia64_fbsd_supply_gregs (®s.r, regno); if (regno != -1) return; } ==== //depot/projects/gdb/contrib/gdb6/gdb/ia64-fbsd-tdep.c#2 (text+ko) ==== @@ -98,8 +98,22 @@ }; static void +ia64_fbsd_regcache_collect (struct regcache *regcache, int regno, + void *regs) +{ + int ofs; + + if (regno < 0 || regno >= NUM_REGS) + return; + + ofs = reg_offset[regno]; + if (ofs >= 0) + regcache_raw_collect (regcache, regno, (char*)regs + ofs); +} + +static void ia64_fbsd_regcache_supply (struct regcache *regcache, int regno, - const char *regs) + const void *regs) { int ofs; @@ -114,8 +128,8 @@ IA64_BSP_REGNUM in the reg_offset array above is that of the ndirty field in struct reg. */ uint64_t bsp; - bsp = *((uint64_t*)(regs + ofs)); /* ndirty */ - bsp += *((uint64_t*)(regs + reg_offset[IA64_BSPSTORE_REGNUM])); + bsp = *((uint64_t*)((char *)regs + ofs)); /* ndirty */ + bsp += *((uint64_t*)((char *)regs + reg_offset[IA64_BSPSTORE_REGNUM])); regcache_raw_supply (regcache, regno, &bsp); } else @@ -123,7 +137,43 @@ if (ofs < 0) regcache_raw_supply (regcache, regno, NULL); else - regcache_raw_supply (regcache, regno, regs + ofs); + regcache_raw_supply (regcache, regno, (char *)regs + ofs); + } +} + +void +fill_fpregset (void *fpregs, int regno) +{ + if (regno == -1) + { + for (regno = 0; regno < NUM_REGS; regno++) + { + if (FPREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (current_regcache, regno, fpregs); + } + } + else + { + if (FPREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (current_regcache, regno, fpregs); + } +} + +void +fill_gregset (void *gregs, int regno) +{ + if (regno == -1) + { + for (regno = 0; regno < NUM_REGS; regno++) + { + if (GREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (current_regcache, regno, gregs); + } + } + else + { + if (GREG_SUPPLIES(regno)) + ia64_fbsd_regcache_collect (current_regcache, regno, gregs); } } @@ -146,7 +196,7 @@ } void -ia64_fbsd_supply_regs(const void *gregs, int regno) +ia64_fbsd_supply_gregs (const void *gregs, int regno) { if (regno == -1) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404171941.i3HJfqUo093864>