Pad instruction stream with 8 nops;
authorZou Nan hai <nanhai.zou@intel.com>
Wed, 5 Jun 2013 01:09:57 +0000 (09:09 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Thu, 6 Jun 2013 02:55:34 +0000 (10:55 +0800)
   According to Bspec, EU may access 8 instrunctions beyond the
   kernel program because of prefetch.
   Pad the instruction stream with 8 nop to avoid access into an
   invalide page.

Signed-off-by: Zou Nanhai <nanhai.zou@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/backend/gen_context.cpp

index 18f6c11..055c8fc 100644 (file)
@@ -72,6 +72,10 @@ namespace gbe
       }
       p->pop();
     }
+    /* per spec, pad the instruction stream with 8 nop to avoid
+       instruction prefetcher prefetch into an invalide page */
+    for(int i = 0; i < 8; i++)
+       p->NOP();
   }
 
   void GenContext::patchBranches(void) {