Skip to content

Commit

Permalink
Fix exception on ARM32 with VS2022 when Print() is invoked
Browse files Browse the repository at this point in the history
On ARM32 only, it appears that whenever Visual Studio inlines the FloatToString()
call (which it does for Release builds), the resulting executable produces an
"Undefined OpCode Exception" on Print() invocation, regardless of whether there
is an actual float to string conversion occurring there.

To work around this, add an explicit clause to prevent inlining, and do so on all
platform just in case.

Signed-off-by: Pete Batard <[email protected]>
  • Loading branch information
pbatard committed May 14, 2024
1 parent 5e7414e commit b9b55b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,11 @@ ValueToString (
*p2 = 0;
}

// Having this call inlined by VS2022 on Release builds produces an
// "Undefined OpCode Exception" on ARM32 whenever Print() is invoked,
// even when no part of the code below is actually being executed...
// For safety, add an explicit clause to prevent inlining on all platforms.
EFI_NOINLINE
VOID
FloatToString (
IN CHAR16 *Buffer,
Expand Down

0 comments on commit b9b55b3

Please sign in to comment.