/** @file\r
* File managing the MMU for ARMv8 architecture\r
*\r
-* Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
BlockEntry = NULL;\r
\r
// Ensure the parameters are valid\r
- ASSERT (TableLevel && BlockEntrySize && LastBlockEntry);\r
+ if (!(TableLevel && BlockEntrySize && LastBlockEntry)) {\r
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);\r
+ return NULL;\r
+ }\r
\r
// Ensure the Region is aligned on 4KB boundary\r
- ASSERT ((RegionStart & (SIZE_4KB - 1)) == 0);\r
+ if ((RegionStart & (SIZE_4KB - 1)) != 0) {\r
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);\r
+ return NULL;\r
+ }\r
\r
// Ensure the required size is aligned on 4KB boundary\r
- ASSERT ((*BlockEntrySize & (SIZE_4KB - 1)) == 0);\r
+ if ((*BlockEntrySize & (SIZE_4KB - 1)) != 0) {\r
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);\r
+ return NULL;\r
+ }\r
\r
//\r
// Calculate LastBlockEntry from T0SZ - this is the last block entry of the root Translation table\r
UINTN TableLevel;\r
\r
// Ensure the Length is aligned on 4KB boundary\r
- ASSERT ((MemoryRegion->Length > 0) && ((MemoryRegion->Length & (SIZE_4KB - 1)) == 0));\r
+ if ((MemoryRegion->Length == 0) || ((MemoryRegion->Length & (SIZE_4KB - 1)) != 0)) {\r
+ ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);\r
+ return RETURN_INVALID_PARAMETER;\r
+ }\r
\r
// Variable initialization\r
Attributes = ArmMemoryAttributeToPageAttribute (MemoryRegion->Attributes) | TT_AF;\r
UINT64 TCR;\r
RETURN_STATUS Status;\r
\r
- ASSERT (MemoryTable != NULL);\r
+ if(MemoryTable == NULL)\r
+ {\r
+ ASSERT (MemoryTable != NULL);\r
+ return RETURN_INVALID_PARAMETER;\r
+ }\r
\r
// Identify the highest address of the memory table\r
MaxAddress = MemoryTable->PhysicalBase + MemoryTable->Length - 1;\r