X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FUniversal%2FEbc%2FDxe%2FEbcExecute.c;h=70db1574bf3b64c8491909be654f36f427afb3af;hp=9d375a54615873027c0d54f675f12702fa684c75;hb=c91eaa3d55d88598baaa979097a31cb1001ecc0d;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4 diff --git a/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c b/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c index 9d375a5461..70db1574bf 100644 --- a/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c +++ b/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c @@ -685,9 +685,7 @@ Returns: EFI_STATUS Status; EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *EbcSimpleDebugger; - // - // end DEBUG_CODE - // + mVmPtr = VmPtr; EbcSimpleDebugger = NULL; Status = EFI_SUCCESS; StackCorrupted = 0; @@ -704,7 +702,7 @@ Returns: // // Try to get the debug support for EBC // - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); Status = gBS->LocateProtocol ( &mEbcSimpleDebuggerProtocolGuid, NULL, @@ -713,7 +711,7 @@ Returns: if (EFI_ERROR (Status)) { EbcSimpleDebugger = NULL; } - ); + DEBUG_CODE_END (); // // Save the start IP for debug. For example, if we take an exception we @@ -731,11 +729,11 @@ Returns: // // If we've found a simple debugger protocol, call it // - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); if (EbcSimpleDebugger != NULL) { EbcSimpleDebugger->Debugger (EbcSimpleDebugger, VmPtr); } - ); + DEBUG_CODE_END (); // // Verify the opcode is in range. Otherwise generate an exception. @@ -782,6 +780,7 @@ Returns: } Done: + mVmPtr = NULL; return Status; } @@ -2945,10 +2944,8 @@ Instruction syntax: --*/ { - INT64 ResultHigh; - if (*VmPtr->Ip & DATAMANIP_M_64) { - return MulS64x64 (Op1, Op2, &ResultHigh); + return MultS64x64 ((INT64)Op1, (INT64)Op2); } else { return (UINT64) ((INT64) ((INT32) Op1 * (INT32) Op2)); } @@ -2979,9 +2976,8 @@ Instruction syntax: --*/ { - INT64 ResultHigh; if (*VmPtr->Ip & DATAMANIP_M_64) { - return MulU64x64 (Op1, Op2, (UINT64 *)&ResultHigh); + return MultU64x64 (Op1, Op2); } else { return (UINT64) ((UINT32) Op1 * (UINT32) Op2); } @@ -3014,7 +3010,6 @@ Instruction syntax: --*/ { INT64 Remainder; - UINT32 Error; // // Check for divide-by-0 @@ -3029,7 +3024,7 @@ Instruction syntax: return 0; } else { if (*VmPtr->Ip & DATAMANIP_M_64) { - return (UINT64) (DivS64x64 (Op1, Op2, &Remainder, &Error)); + return (UINT64) (DivS64x64Remainder (Op1, Op2, &Remainder)); } else { return (UINT64) ((INT64) ((INT32) Op1 / (INT32) Op2)); } @@ -3062,7 +3057,6 @@ Instruction syntax: --*/ { UINT64 Remainder; - UINT32 Error; // // Check for divide-by-0 @@ -3079,7 +3073,7 @@ Instruction syntax: // Get the destination register // if (*VmPtr->Ip & DATAMANIP_M_64) { - return (UINT64) (DivU64x64 (Op1, Op2, &Remainder, &Error)); + return (UINT64) (DivU64x64Remainder ((INT64)Op1, (INT64)Op2, &Remainder)); } else { return (UINT64) ((UINT32) Op1 / (UINT32) Op2); } @@ -3112,7 +3106,6 @@ Instruction syntax: --*/ { INT64 Remainder; - UINT32 Error; // // Check for divide-by-0 @@ -3125,7 +3118,7 @@ Instruction syntax: ); return 0; } else { - DivS64x64 ((INT64) Op1, (INT64) Op2, &Remainder, &Error); + DivS64x64Remainder ((INT64)Op1, (INT64)Op2, &Remainder); return Remainder; } } @@ -3156,7 +3149,6 @@ Instruction syntax: --*/ { UINT64 Remainder; - UINT32 Error; // // Check for divide-by-0 @@ -3169,7 +3161,7 @@ Instruction syntax: ); return 0; } else { - DivU64x64 (Op1, Op2, &Remainder, &Error); + DivU64x64Remainder (Op1, Op2, &Remainder); return Remainder; } } @@ -3285,7 +3277,7 @@ Instruction syntax: --*/ { if (*VmPtr->Ip & DATAMANIP_M_64) { - return LeftShiftU64 (Op1, Op2); + return LShiftU64 (Op1, (UINTN)Op2); } else { return (UINT64) ((UINT32) ((UINT32) Op1 << (UINT32) Op2)); } @@ -3317,7 +3309,7 @@ Instruction syntax: --*/ { if (*VmPtr->Ip & DATAMANIP_M_64) { - return RightShiftU64 (Op1, Op2); + return RShiftU64 (Op1, (UINTN)Op2); } else { return (UINT64) ((UINT32) Op1 >> (UINT32) Op2); } @@ -3349,7 +3341,7 @@ Instruction syntax: --*/ { if (*VmPtr->Ip & DATAMANIP_M_64) { - return ARightShift64 (Op1, Op2); + return ARShiftU64 (Op1, (UINTN)Op2); } else { return (UINT64) ((INT64) ((INT32) Op1 >> (UINT32) Op2)); } @@ -3953,7 +3945,6 @@ Returns: --*/ { UINT64 Index; - UINT64 Remainder; INT64 Offset; INT64 C; INT64 N; @@ -3965,17 +3956,17 @@ Returns: // // Get the mask for N. First get the number of bits from the index. // - NBits = RightShiftU64 ((Index & 0x7000000000000000ULL), 60); + NBits = RShiftU64 ((Index & 0x7000000000000000ULL), 60); // // Scale it for 64-bit indexes (multiply by 8 by shifting left 3) // - NBits = LeftShiftU64 (NBits, 3); + NBits = LShiftU64 ((UINT64)NBits, 3); // // Now using the number of bits, create a mask. // - Mask = (LeftShiftU64 ((UINT64)~0, (UINT64) NBits)); + Mask = (LShiftU64 ((UINT64)~0, (UINTN)NBits)); // // Now using the mask, extract N from the lower bits of the index. @@ -3985,15 +3976,15 @@ Returns: // // Now compute C // - C = ARightShift64 (((Index &~0xF000000000000000ULL) & Mask), (UINTN) NBits); + C = ARShiftU64 (((Index &~0xF000000000000000ULL) & Mask), (UINTN)NBits); - Offset = MulU64x64 (N, sizeof (UINTN), &Remainder) + C; + Offset = MultU64x64 (N, sizeof (UINTN)) + C; // // Now set the sign // if (Index & 0x8000000000000000ULL) { - Offset = MulS64x64 (Offset, -1, (INT64 *)&Index); + Offset = MultS64x64 (Offset, -1); } return Offset;