public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx()
@ 2018-10-13 15:42 Eric Jin
  2018-10-15  1:33 ` Supreeth Venkatesh
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Jin @ 2018-10-13 15:42 UTC (permalink / raw)
  To: edk2-devel; +Cc: Supreeth Venkatesh, Jiaxin Wu

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
 ...rTaskPriorityServicesBBTestCreateEventEx.c | 26 +++++++++++--------
 .../BlackBoxTest/Support.c                    | 19 +++++++++++++-
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index e2e173ab..25d1ed97 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -192,6 +192,10 @@ BBTestCreateEventEx_Func (
   BBTestCreateEventEx_Func_Sub2 (StandardLib);
 #endif
 
+  //
+  // The test for the EFI_EVENT_GROUP_MEMORY_MAP_CHANGE 
+  // This event group is notified by the system when the memory map has changed.
+  //
   BBTestCreateEventEx_Func_Sub3 (StandardLib);
 
   //
@@ -599,12 +603,12 @@ BBTestCreateEventEx_Func_Sub1 (
   UINTN               Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
 
   //
-  // Initialize Buffer
+  // Initialize Buffer and the 0xAA is only for the Sub3 test
   //
   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
     Buffer[Index] = Index;
-    Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
-    Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+    Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
+    Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
   }
 
   //
@@ -755,12 +759,12 @@ BBTestCreateEventEx_Func_Sub2 (
   UINTN               Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
 
   //
-  // Initialize Buffer
+  // Initialize Buffer and the 0xAA is only for the Sub3 test
   //
   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
     Buffer[Index] = Index;
-    Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
-    Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+    Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
+    Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
   }
 
   //
@@ -914,12 +918,12 @@ BBTestCreateEventEx_Func_Sub3 (
   UINTN               Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
 
   //
-  // Initialize Buffer
+  // Initialize Buffer and the trick to initial it as 0xAA
   //
   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
     Buffer[Index] = Index;
-    Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(-1);
-    Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(-1);
+    Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(0xAA);
+    Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(0xAA);
   }
 
   //
@@ -974,7 +978,7 @@ BBTestCreateEventEx_Func_Sub3 (
   }
   
   //
-  // Install a configuration table at TPL_NOTIFY
+  // Call AllocatePage to change the memorymap
   //
   OldTpl = gtBS->RaiseTPL (TPL_NOTIFY);
   
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index aa02383e..823e16ab 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2010 Unified EFI, Inc.<BR>
-  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -64,6 +64,23 @@ NotifyFunctionTplEx(
 
     EventIndex = Buffer[0];
 
+    //
+    // The special code for the sub3
+    // To block possible enter triggered by CreateEventEx  
+    // 
+    if (EventIndex != 2 && Buffer[4] == (UINTN)(0xAA))
+      return;
+
+    //
+    // The special code for the sub3
+    // To initial the Buffer and block the possible enter caused by the CloseEvent
+    //
+    if (EventIndex == 2 && Buffer[1] == (UINTN)(0xAA)) {
+      for (Index=1; Index<7; Index++) {
+        Buffer[Index] = (UINTN)(-1);
+      }  
+    }
+
     Index = 3-EventIndex;
 
     while (1) {     
-- 
2.18.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-16  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-13 15:42 [PATCH] uefi-sct/SctPkg:Fix the flaw in BBTestCreateEventEx_Func_Sub3 on certain situation. Besides AllocatePages(), CreateEventEx may cause the memorymap change itself. Enhance the test to filter the side effect from CreateEventEx() Eric Jin
2018-10-15  1:33 ` Supreeth Venkatesh
2018-10-15 12:49   ` Supreeth Venkatesh
2018-10-15 12:50   ` Supreeth Venkatesh
2018-10-15 13:10   ` Supreeth Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox