如下只是实例,最好自行封装成malloc和free
EFI_STATUS EFIAPI GetMemory(EFI_SYSTEM_TABLE* gST)
{
EFI_STATUS status;
CHAR16 *keys=NULL;
status=gST->BootServices->AllocatePool(EfiBootServicesData,100,&keys);
if(EFI_SUCCESS==status)
{
Print(L"success to allocate memory\n");
}
else
{
Print(L"failed to allocate memory\n");
}
keys[0]=65;
keys[1]=66;
keys[2]=67;
keys[3]=0;
Print(L"==allocate<>%s==\n",keys);
gST->BootServices->FreePool(keys);
Print(L"==allocate<>%s==\n",keys);
return EFI_SUCCESS;
}