The SDM selects the MKTME_KEY_PROGRAM leaf function by loading EAX
with 0.  The value 1 is the identifier of its target (TME-MK), not the
leaf number, and PCONFIG raises #GP(0) for any leaf other than 0.

_pconfig_u32 used 1 for __PCONFIG_KEY_PROGRAM, so the real leaf 0 never
took the __pconfig_b path, which declares that only RAX is modified,
while the invalid constant leaf 1 did.  Use 0 and fix pconfig-1.c, which
used the wrong value as well.

gcc/ChangeLog:

* config/i386/pconfigintrin.h (_pconfig_u32):
Change the value of __PCONFIG_KEY_PROGRAM to 0x00.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pconfig-1.c (PCONFIG_KEY_PROGRAM):
Change to 0x00.

Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.

Uros.
diff --git a/gcc/config/i386/pconfigintrin.h b/gcc/config/i386/pconfigintrin.h
index 33ef551660d..37d4c572dfb 100644
--- a/gcc/config/i386/pconfigintrin.h
+++ b/gcc/config/i386/pconfigintrin.h
@@ -52,7 +52,7 @@ _pconfig_u32 (const unsigned int __L, size_t __D[])
 {
   enum __pconfig_type
   {
-    __PCONFIG_KEY_PROGRAM = 0x01,
+    __PCONFIG_KEY_PROGRAM = 0x00,
   };
 
   unsigned int __R = 0;
diff --git a/gcc/testsuite/gcc.target/i386/pconfig-1.c 
b/gcc/testsuite/gcc.target/i386/pconfig-1.c
index 40b4c0c1272..8ba4689da3a 100644
--- a/gcc/testsuite/gcc.target/i386/pconfig-1.c
+++ b/gcc/testsuite/gcc.target/i386/pconfig-1.c
@@ -6,7 +6,7 @@
 
 extern unsigned int leaf;
 
-#define PCONFIG_KEY_PROGRAM 0x01
+#define PCONFIG_KEY_PROGRAM 0x00
 
 int test ()
 {

Reply via email to