> 
>    GenerateSingleRandomMapEntry (MaxAddress, MapEntrys);
>    Status = PageTableParse (*PageTable, PagingMode, NULL, &MapCount);
> 
> +  if (MapCount != 0) {
> +    //
> +    // Allocate memory for Map
> +    // Note the memory is only used in this one Single MapEntry Test
> +    //
> +    UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL);
> +    Map = AllocatePages (EFI_SIZE_TO_PAGES (MapCount * sizeof
> (IA32_MAP_ENTRY)));
> +    ASSERT (Map != NULL);
> +    Status = PageTableParse (*PageTable, PagingMode, Map, &MapCount);
> +  }
> +
>    //
>    // Check if the generated MapEntrys->Maps[MapsIndex] contains not-
> present range.
>    //
>    if (MapEntrys->Maps[MapsIndex].Length > 0) {
>      if (MapCount != 0) {
> -      UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL);
> -      Map = AllocatePages (EFI_SIZE_TO_PAGES (MapCount * sizeof
> (IA32_MAP_ENTRY)));
> -      ASSERT (Map != NULL);
> -      Status = PageTableParse (*PageTable, PagingMode, Map, &MapCount);
> -
>        if (Map[MapCount - 1].LinearAddress + Map[MapCount - 1].Length <
> MapEntrys->Maps[MapsIndex].LinearAddress + MapEntrys-
> >Maps[MapsIndex].Length) {
>          IsNotPresent = TRUE;

1. can you split the Parse() API call into a standalone patch?

> +    if (MapCount2 == 0) {
> +      UT_ASSERT_EQUAL (IsModified, FALSE);
2. no need to treat "MapCount == 0" as special. CompareMem() should be able to 
accept 0-length bytes.

> +    } else if (CompareMem (Map, Map2, MapCount2 * sizeof
> (IA32_MAP_ENTRY)) != 0) {
> +      UT_ASSERT_EQUAL (IsModified, TRUE);
> +    } else {
> +      UT_ASSERT_EQUAL (IsModified, FALSE);
> +    }
>    }


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101199): https://edk2.groups.io/g/devel/message/101199
Mute This Topic: https://groups.io/mt/97469486/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to