1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

UserspaceEmulator: Result is initialized after OR with all-1 immediate

When compiling with "-Os", GCC produces the following pattern for
atomic decrement (which is used by our RefCounted template):

    or eax, -1
    lock xadd [destination], eax

Since or-ing with -1 will always produce the same output (-1), we can
mark the result of these operations as initialized. This stops us from
complaining about false positives when running the shell in UE. :^)
This commit is contained in:
Andreas Kling 2020-08-07 15:41:53 +02:00
parent 3b3d158649
commit 5ba2022b8e
2 changed files with 53 additions and 37 deletions

View file

@ -1048,29 +1048,29 @@ private:
virtual void wrap_0xD3_16(const X86::Instruction&) override;
virtual void wrap_0xD3_32(const X86::Instruction&) override;
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_AL_imm8(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_AX_imm16(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_EAX_imm32(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_RM16_imm16(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_RM16_imm8(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
void generic_RM16_unsigned_imm8(Op, const X86::Instruction&);
template<bool update_dest, bool is_zero_idiom_if_both_operands_same, typename Op>
void generic_RM16_reg16(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_RM32_imm32(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_RM32_imm8(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
void generic_RM32_unsigned_imm8(Op, const X86::Instruction&);
template<bool update_dest, bool is_zero_idiom_if_both_operands_same, typename Op>
void generic_RM32_reg32(Op, const X86::Instruction&);
template<bool update_dest, typename Op>
template<bool update_dest, bool is_or, typename Op>
void generic_RM8_imm8(Op, const X86::Instruction&);
template<bool update_dest, bool is_zero_idiom_if_both_operands_same, typename Op>
void generic_RM8_reg8(Op, const X86::Instruction&);