ArmPkg: ArmExceptionLib: Fixing exception vector and type casting
The current VectorBase is taking value from a 64bit PCD into a UINTN value, which could have truncated value for 32bit system. In addition, the comparison between UINTN and INTN could lead to undesired comparison outcome or compiler complaints. This change updates all of them to be UINT64 based operation. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
This commit is contained in:
parent
b689c387e2
commit
e8b7d7a238
|
@ -91,7 +91,7 @@ InitializeCpuExceptionHandlers (
|
|||
)
|
||||
{
|
||||
RETURN_STATUS Status;
|
||||
UINTN VectorBase;
|
||||
UINT64 VectorBase;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
|
@ -113,7 +113,7 @@ InitializeCpuExceptionHandlers (
|
|||
|
||||
// We do not copy the Exception Table at PcdGet64(PcdCpuVectorBaseAddress). We just set Vector
|
||||
// Base Address to point into CpuDxe code.
|
||||
VectorBase = (UINTN)ExceptionHandlersStart;
|
||||
VectorBase = (UINT64)(UINTN)ExceptionHandlersStart;
|
||||
|
||||
Status = RETURN_SUCCESS;
|
||||
}
|
||||
|
@ -121,9 +121,9 @@ InitializeCpuExceptionHandlers (
|
|||
if (!RETURN_ERROR (Status)) {
|
||||
// call the architecture-specific routine to prepare for the new vector
|
||||
// configuration to take effect
|
||||
ArchVectorConfig (VectorBase);
|
||||
ArchVectorConfig ((UINTN)VectorBase);
|
||||
|
||||
ArmWriteVBar (VectorBase);
|
||||
ArmWriteVBar ((UINTN)VectorBase);
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
|
@ -172,7 +172,7 @@ CopyExceptionHandlers (
|
|||
}
|
||||
|
||||
// Copy our assembly code into the page that contains the exception vectors.
|
||||
CopyMem ((VOID *)VectorBase, (VOID *)ExceptionHandlersStart, Length);
|
||||
CopyMem ((VOID *)VectorBase, (VOID *)(UINTN)ExceptionHandlersStart, Length);
|
||||
|
||||
//
|
||||
// Initialize the C entry points for interrupts
|
||||
|
@ -226,7 +226,7 @@ RegisterCpuInterruptHandler (
|
|||
IN EFI_CPU_INTERRUPT_HANDLER ExceptionHandler
|
||||
)
|
||||
{
|
||||
if (ExceptionType > gMaxExceptionNumber) {
|
||||
if ((UINTN)ExceptionType > gMaxExceptionNumber) {
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ CommonCExceptionHandler (
|
|||
IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
||||
)
|
||||
{
|
||||
if (ExceptionType <= gMaxExceptionNumber) {
|
||||
if ((UINTN)ExceptionType <= gMaxExceptionNumber) {
|
||||
if (gExceptionHandlers[ExceptionType]) {
|
||||
gExceptionHandlers[ExceptionType](ExceptionType, SystemContext);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue