mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
Ring3: Defined CpuGetMemoryAttributes(), DisableSMAP(), EnableSMAP() for AARCH64.
This commit is contained in:
parent
d1fa366ba2
commit
04c34b8135
@ -95,6 +95,12 @@ PageAttributeToGcdAttribute (
|
|||||||
GcdAttributes |= EFI_MEMORY_XP;
|
GcdAttributes |= EFI_MEMORY_XP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (((PageAttributes & TT_AP_MASK) == TT_AP_RW_RW) ||
|
||||||
|
((PageAttributes & TT_AP_MASK) == TT_AP_RO_RO))
|
||||||
|
{
|
||||||
|
GcdAttributes |= EFI_MEMORY_USER;
|
||||||
|
}
|
||||||
|
|
||||||
return GcdAttributes;
|
return GcdAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +218,7 @@ EFI_CPU_ARCH_PROTOCOL mCpu = {
|
|||||||
CpuSetMemoryAttributes,
|
CpuSetMemoryAttributes,
|
||||||
0, // NumberOfTimers
|
0, // NumberOfTimers
|
||||||
2048, // DmaBufferAlignment
|
2048, // DmaBufferAlignment
|
||||||
|
CpuGetMemoryAttributes
|
||||||
};
|
};
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
|
@ -96,6 +96,14 @@ CpuSetMemoryAttributes (
|
|||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
CpuGetMemoryAttributes (
|
||||||
|
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Address,
|
||||||
|
OUT UINT64 *Attributes
|
||||||
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
InitializeExceptions (
|
InitializeExceptions (
|
||||||
IN EFI_CPU_ARCH_PROTOCOL *Cpu
|
IN EFI_CPU_ARCH_PROTOCOL *Cpu
|
||||||
|
@ -222,3 +222,28 @@ CpuSetMemoryAttributes (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
CpuGetMemoryAttributes (
|
||||||
|
IN EFI_CPU_ARCH_PROTOCOL *This,
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Address,
|
||||||
|
OUT UINT64 *Attributes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN RegionBaseAddress;
|
||||||
|
UINTN RegionLength;
|
||||||
|
UINTN RegionArmAttributes;
|
||||||
|
|
||||||
|
RegionBaseAddress = Address;
|
||||||
|
Status = GetMemoryRegion (&RegionBaseAddress, &RegionLength, &RegionArmAttributes);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
*Attributes = RegionAttributeToGcdAttribute (RegionArmAttributes);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
@ -7,26 +7,6 @@
|
|||||||
|
|
||||||
#include <AsmMacroIoLibV8.h>
|
#include <AsmMacroIoLibV8.h>
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// VOID
|
|
||||||
// EFIAPI
|
|
||||||
// DisableSMAP (
|
|
||||||
// VOID
|
|
||||||
// );
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
ASM_FUNC(DisableSMAP)
|
|
||||||
ret
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// VOID
|
|
||||||
// EFIAPI
|
|
||||||
// EnableSMAP (
|
|
||||||
// VOID
|
|
||||||
// );
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
ASM_FUNC(EnableSMAP)
|
|
||||||
ret
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// EFI_STATUS
|
// EFI_STATUS
|
||||||
// EFIAPI
|
// EFIAPI
|
||||||
|
@ -41,3 +41,21 @@ InitializeMsr (
|
|||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
DisableSMAP (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ArmClearPan ();
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
EnableSMAP (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ArmSetPan ();
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user