diff --git a/VTIL-Architecture/arch/instruction_set.hpp b/VTIL-Architecture/arch/instruction_set.hpp index a7f2963..7ec10bd 100644 --- a/VTIL-Architecture/arch/instruction_set.hpp +++ b/VTIL-Architecture/arch/instruction_set.hpp @@ -164,10 +164,10 @@ namespace vtil // // NOP | Placeholder // VEMIT Imm | Emits the opcode as is to the final instruction stream. - // VPINR Reg | Pins the register for read // UD? can be used as a wildcard for all physical registers. - // VPINW Reg | Pins the register for write // UD? can be used as a wildcard for all physical registers. - // VPINRM Reg, Imm | Pins the qword @ memory location for read // UD? can be used as a wildcard for all public memory effectively rendering it an SFENCE. - // VPINWM Reg, Imm | Pins the qword @ memory location for write // UD? can be used as a wildcard for all public memory effectively rendering it an LFENCE. + // VPINR Reg | Pins the register for read + // VPINW Reg | Pins the register for write + // VPINRM Reg, Imm | Pins the qword @ memory location for read [ UD? can be used as a wildcard for all public memory effectively rendering it an SFENCE. ] + // VPINWM Reg, Imm | Pins the qword @ memory location for write [ UD? can be used as a wildcard for all public memory effectively rendering it an LFENCE. ] // /*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* [Name] [Operands...] [ASizeOp] [Volatile] [Operator] [BranchOps] [MemOps] */ diff --git a/VTIL-Architecture/routine/basic_block.hpp b/VTIL-Architecture/routine/basic_block.hpp index 4d6a529..b91f9f1 100644 --- a/VTIL-Architecture/routine/basic_block.hpp +++ b/VTIL-Architecture/routine/basic_block.hpp @@ -339,6 +339,12 @@ namespace vtil WRAP_LAZY( vpinwm ); #undef WRAP_LAZY + // Implement fences. + // + basic_block* sfence() { return vpinrm( UNDEFINED, 0ull ); } + basic_block* lfence() { return vpinwm( UNDEFINED, 0ull ); } + basic_block* mfence() { return sfence()->lfence(); } + // Queues a stack shift. // basic_block* shift_sp( int64_t offset, bool merge_instance = false, const const_iterator& it = {} ); diff --git a/VTIL-Common/util/copy_on_write.hpp b/VTIL-Common/util/copy_on_write.hpp index 07920e8..6584302 100644 --- a/VTIL-Common/util/copy_on_write.hpp +++ b/VTIL-Common/util/copy_on_write.hpp @@ -178,7 +178,7 @@ namespace vtil // - Micro optimized to generate cmp branch instead of bitmasked // test since MSVC is too stupid apparently. // - constexpr bool is_temporary() const { return as_signed( combined_value ) < 0; /*return temporary;*/ } + constexpr bool is_temporary() const { return ( ( int64_t ) combined_value ) < 0; /*return temporary;*/ } // Converts to owning reference. // diff --git a/VTIL-Common/util/type_helpers.hpp b/VTIL-Common/util/type_helpers.hpp index 1233039..77c5987 100644 --- a/VTIL-Common/util/type_helpers.hpp +++ b/VTIL-Common/util/type_helpers.hpp @@ -113,16 +113,7 @@ namespace vtil return std::move( *( T* ) &raw ); } - // Changes the way given integer is interpreted. - // - template static auto& as_signed( T& value ) { return ( std::make_signed_t& ) value; } - template static auto& as_signed( const T& value ) { return ( const std::make_signed_t& ) value; } - template static constexpr auto as_signed( T value ) { return ( std::make_signed_t ) value; } - template static auto& as_unsigned( T& value ) { return ( std::make_unsigned_t& ) value; } - template static auto& as_unsigned( const T& value ) { return ( const std::make_unsigned_t& ) value; } - template static constexpr auto as_unsigned( T value ) { return ( std::make_unsigned_t ) value; } - - // Basic helpers for series creation. + // Implement helpers for basic series creation. // namespace impl {