[PATCH] x86: AMD's rdtscp

Jan Beulich JBeulich@novell.com
Tue Mar 15 08:34:00 GMT 2005


Built and tested on i686-pc-linux-gnu.

Jan

include/opcode/
2005-03-15  Jan Beulich  <jbeulich@novell.com>

	* i386.h (i386_optab): Add rdtscp.

opcodes/
2005-03-15  Jan Beulich  <jbeulich@novell.com>

	* i386-dis.c (INVLPG_Fixup): Decode rdtscp; change code to allow
for
	easier future additions.

---
/home/jbeulich/src/binutils/mainline/2005-03-14/include/opcode/i386.h	2005-03-04
15:52:17.000000000 +0100
+++ 2005-03-14/include/opcode/i386.h	2005-03-15 09:10:42.089520712
+0100
@@ -1369,6 +1369,7 @@ static const template i386_optab[] =
 {"syscall",  0, 0x0f05,    X, CpuK6,	NoSuf,			{ 0, 0,
0} },
 {"sysret",   0, 0x0f07,    X, CpuK6,	lq_Suf|DefaultSize,	{ 0, 0,
0} },
 {"swapgs",   0, 0x0f01, 0xf8, Cpu64,	NoSuf|ImmExt,		{ 0, 0,
0} },
+{"rdtscp",   0, 0x0f01, 0xf9, CpuSledgehammer,NoSuf|ImmExt,	{ 0, 0,
0} },
 
 /* VIA PadLock extensions.  */
 {"xstorerng", 0, 0x000fa7c0, X, Cpu686|CpuPadLock, NoSuf|IsString, {
0, 0, 0} },
---
/home/jbeulich/src/binutils/mainline/2005-03-14/opcodes/i386-dis.c	2005-03-04
15:53:09.000000000 +0100
+++ 2005-03-14/opcodes/i386-dis.c	2005-03-15 09:06:58.155563848
+0100
@@ -4392,16 +4392,23 @@ PNI_Fixup (int extrachar ATTRIBUTE_UNUSE
 static void
 INVLPG_Fixup (int bytemode, int sizeflag)
 {
-  if (*codep == 0xf8)
-    {
-      char *p = obuf + strlen (obuf);
+  const char *alt;
 
-      /* Override "invlpg".  */
-      strcpy (p - 6, "swapgs");
-      codep++;
+  switch (*codep)
+    {
+    case 0xf8:
+      alt = "swapgs";
+      break;
+    case 0xf9:
+      alt = "rdtscp";
+      break;
+    default:
+      OP_E (bytemode, sizeflag);
+      return;
     }
-  else
-    OP_E (bytemode, sizeflag);
+  /* Override "invlpg".  */
+  strcpy (obuf + strlen (obuf) - 6, alt);
+  codep++;
 }
 
 static void

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-mainline-x86-rdtscp.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050315/2a0addf6/attachment.ksh>


More information about the Binutils mailing list