/* The function will check if page table entry should be splitted to smaller granularity. */
BOOLEAN ToSplitPageTable(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN Size, IN EFI_PHYSICAL_ADDRESS StackBase, IN UINTN StackSize)
/* The function will check if page table entry should be splitted to smaller granularity. */
BOOLEAN ToSplitPageTable(IN EFI_PHYSICAL_ADDRESS Address, IN UINTN Size, IN EFI_PHYSICAL_ADDRESS StackBase, IN UINTN StackSize)
{
  if (IsNullDetectionEnabled () && (Address == 0)) {
    return TRUE;
  }
  if (FixedPcdGetBool (PcdCpuStackGuard)) {
    if ((StackBase >= Address) && (StackBase < (Address + Size))) {
      return TRUE;
    }
  }
  if (IsSetNxForStack ()) {
    if ((Address < StackBase + StackSize) && ((Address + Size) > StackBase)) {
      return TRUE;
    }
  }
  return FALSE;
}