This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Introduce amd64_collect_fxsave
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 28 Feb 2004 21:50:59 +0100 (CET)
- Subject: [PATCH] Introduce amd64_collect_fxsave
This should get amd64-tdep.c out of the ARI. The new function will
replace amd64_fill_fxsave in the end.
Committed,
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* amd64-tdep.h: (amd64_collect_fxsave): New prototype.
* amd64-tdep.c (amd64_collect_fxsave): New function.
(amd64_fill_fxsave): Simply call amd64_collect_fxsave.
Index: amd64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 amd64-tdep.c
--- amd64-tdep.c 28 Feb 2004 18:07:58 -0000 1.2
+++ amd64-tdep.c 28 Feb 2004 20:47:48 -0000
@@ -1169,6 +1169,25 @@ amd64_supply_fxsave (struct regcache *re
}
/* Fill register REGNUM (if it is a floating-point or SSE register) in
+ *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for
+ all registers. This function doesn't touch any of the reserved
+ bits in *FXSAVE. */
+
+void
+amd64_collect_fxsave (const struct regcache *regcache, int regnum,
+ void *fxsave)
+{
+ char *regs = fxsave;
+
+ i387_collect_fxsave (regcache, regnum, fxsave);
+
+ if (regnum == -1 || regnum == I387_FISEG_REGNUM)
+ regcache_raw_collect (regcache, I387_FISEG_REGNUM, regs + 12);
+ if (regnum == -1 || regnum == I387_FOSEG_REGNUM)
+ regcache_raw_collect (regcache, I387_FOSEG_REGNUM, regs + 20);
+}
+
+/* Fill register REGNUM (if it is a floating-point or SSE register) in
*FXSAVE with the value in GDB's register cache. If REGNUM is -1, do
this for all registers. This function doesn't touch any of the
reserved bits in *FXSAVE. */
@@ -1176,10 +1195,5 @@ amd64_supply_fxsave (struct regcache *re
void
amd64_fill_fxsave (char *fxsave, int regnum)
{
- i387_fill_fxsave (fxsave, regnum);
-
- if (regnum == -1 || regnum == I387_FISEG_REGNUM)
- regcache_collect (I387_FISEG_REGNUM, fxsave + 12);
- if (regnum == -1 || regnum == I387_FOSEG_REGNUM)
- regcache_collect (I387_FOSEG_REGNUM, fxsave + 20);
+ amd64_collect_fxsave (current_regcache, regnum, fxsave);
}
Index: amd64-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/amd64-tdep.h,v
retrieving revision 1.1
diff -u -p -r1.1 amd64-tdep.h
--- amd64-tdep.h 25 Feb 2004 20:45:30 -0000 1.1
+++ amd64-tdep.h 28 Feb 2004 20:47:48 -0000
@@ -64,6 +64,14 @@ extern void amd64_supply_fxsave (struct
const void *fxsave);
/* Fill register REGNUM (if it is a floating-point or SSE register) in
+ *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for
+ all registers. This function doesn't touch any of the reserved
+ bits in *FXSAVE. */
+
+extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
+ void *fxsave);
+
+/* Fill register REGNUM (if it is a floating-point or SSE register) in
*FXSAVE with the value in GDB's register cache. If REGNUM is -1, do
this for all registers. This function doesn't touch any of the
reserved bits in *FXSAVE. */