[Beignet] [PATCH] Pad instruction stream with 8 nops;

Zou Nan hai nanhai.zou at intel.com
Tue Jun 4 18:09:57 PDT 2013


   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 at intel.com>
---
 backend/src/backend/gen_context.cpp |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index 18f6c11..b9c0392 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -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) {
-- 
1.7.9.5



More information about the Beignet mailing list