Add fence aliases, try fixing for clang #2.

This commit is contained in:
Can Bölük 2020-07-17 09:34:04 +02:00
parent 0b034393a7
commit 39914c5a7f
4 changed files with 12 additions and 15 deletions

View file

@ -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] */

View file

@ -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 = {} );

View file

@ -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.
//

View file

@ -113,16 +113,7 @@ namespace vtil
return std::move( *( T* ) &raw );
}
// Changes the way given integer is interpreted.
//
template<Integral T> static auto& as_signed( T& value ) { return ( std::make_signed_t<T>& ) value; }
template<Integral T> static auto& as_signed( const T& value ) { return ( const std::make_signed_t<T>& ) value; }
template<Integral T> static constexpr auto as_signed( T value ) { return ( std::make_signed_t<T> ) value; }
template<Integral T> static auto& as_unsigned( T& value ) { return ( std::make_unsigned_t<T>& ) value; }
template<Integral T> static auto& as_unsigned( const T& value ) { return ( const std::make_unsigned_t<T>& ) value; }
template<Integral T> static constexpr auto as_unsigned( T value ) { return ( std::make_unsigned_t<T> ) value; }
// Basic helpers for series creation.
// Implement helpers for basic series creation.
//
namespace impl
{