]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Sample/Tools/Source/VcCheck/VcCheck.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / VcCheck / VcCheck.c
diff --git a/EdkCompatibilityPkg/Sample/Tools/Source/VcCheck/VcCheck.c b/EdkCompatibilityPkg/Sample/Tools/Source/VcCheck/VcCheck.c
new file mode 100644 (file)
index 0000000..32f1c33
--- /dev/null
@@ -0,0 +1,121 @@
+/*++\r
+\r
+Copyright (c) 2004, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  VcCheck.c\r
+\r
+Abstract:\r
+\r
+  We have found problems with the Visual C++ SP4 and the /O1 flag.\r
+  If this tests ask a question you have the wrong version of Visual C++\r
+  on your system\r
+\r
+  This test assumes the tools are being compiled with the same complier\r
+  as the Tiano code. \r
+\r
+  Please see $(EFI_SOURCE)\EFI2.0 Developer's Manual.doc to get the\r
+  correct version of Visual C++\r
+\r
+--*/\r
+\r
+#include <stdio.h>\r
+\r
+_int16  gGloba16;\r
+\r
+int\r
+CheckLostCode (\r
+  int Value\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  This routine is used to test for compiler isseus with /O1.\r
+  If the /O1 compiler option, and C2.dll is got from Visual C++ SP5\r
+  (version: 6.00.8168.0), the assember codes after default branch will be\r
+  losted. (Execute "cl Visual Ccheck.c /O1 /FAsc" to get detail information)\r
+\r
+Arguments:\r
+  Value - Test case\r
+\r
+Returns: \r
+  Test to see if comiler error is present.\r
+\r
+--*/\r
+{\r
+  switch (Value) {\r
+  case 0:\r
+    break;\r
+\r
+  default:\r
+    _asm\r
+    {\r
+      mov bx, 1\r
+      mov gGloba16, bx\r
+    }\r
+\r
+    return 1;\r
+  }\r
+\r
+  _asm\r
+  {\r
+    mov bx, 0\r
+    mov gGloba16, bx\r
+  }\r
+\r
+  return 0;\r
+}\r
+\r
+int\r
+main (\r
+  void\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  This utility is checking for a known Visual C++ compiler issues. To remove this \r
+  question from the build follow the steps in the developers manual.\r
+\r
+Arguments:\r
+  NONE\r
+\r
+Returns: \r
+  0 - Compiler version is O.K.\r
+  1 - Compiler version is Bad\r
+\r
+--*/\r
+{\r
+  int   result;\r
+  char  select;\r
+\r
+  gGloba16  = 0xFF;\r
+  result    = 0;\r
+\r
+  CheckLostCode (0);\r
+  result += (gGloba16 == 0) ? 0 : 1;\r
+\r
+  CheckLostCode (1);\r
+  result += (gGloba16 == 1) ? 0 : 1;\r
+\r
+  if (result != 0) {\r
+    printf ("Warning: C2.dll is incorrect.\n Please see $(EFI_SOURCE)\\EFI2.0 Developer's Manual.doc for corrective action.\n");\r
+    printf ("Would you want to continue?(Y/N)");\r
+\r
+    scanf ("%c", &select);\r
+    if ((select == 'Y') || (select == 'y')) {\r
+      return 0;\r
+    } else {\r
+      return 1;\r
+    }\r
+  }\r
+\r
+  return 0;\r
+}\r