Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: d3b32dca06b987d7214637f3952c2ce1ce69f308
      
https://github.com/tianocore/edk2/commit/d3b32dca06b987d7214637f3952c2ce1ce69f308
  Author: Ray Ni <[email protected]>
  Date:   2024-06-12 (Wed, 12 Jun 2024)

  Changed paths:
    M MdePkg/Library/BaseLib/CpuDeadLoop.c

  Log Message:
  -----------
  MdePkg/BaseLib: Let CpuDeadLoop() be breakable in debugger

Starting from certain version of Visual Studio  C compiler (I don’t
have the exact version. I am using VS2019), CpuDeadLoop is optimized
quite well by compiler.
The compiler does not generate instructions that jump out of the loop
when the "Index" is non-zero.
It becomes harder/impossible for developers to break out of the dead-loop
in debugger.

The new version of CpuDeadLoop() compares a volatile global to a volatile
local. This forces 2 reads and a comparison on every loop iteration.
The local variable can be set to 1 to exit the loop without modifying the
global variable.
Using VS2019 with max opt enabled, The dead-loop can be exit by setting
Index to 1 in a debugger.

Signed-off-by: Michael D Kinney <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to