Small change

This commit is contained in:
fed 2023-11-23 15:01:13 +01:00
parent 31d4abb84a
commit 6159aaea39
3 changed files with 10 additions and 2 deletions

View File

@ -23,8 +23,7 @@ namespace tls
void get_tls_stub(utils::hook::assembler& a)
{
std::uint8_t bytes[] = {0x65, 0x48, 0x8B, 0x04, 0x25, 0x58, 0x00, 0x00, 0x00}; // mov rax, gs:58h
a.embed(bytes, sizeof(bytes));
a.mov(rax, seg_ptr(gs, 0x58));
a.add(rax, get_tls_index() * 8);
a.ret();
}

View File

@ -3,6 +3,13 @@
#include <MinHook.h>
Mem seg_ptr(const SReg& segment, const uint64_t off)
{
auto mem = ptr_abs(off);
mem.setSegment(segment);
return mem;
}
namespace utils::hook
{
namespace

View File

@ -7,6 +7,8 @@
using namespace asmjit::x86;
Mem seg_ptr(const SReg& segment, const uint64_t off);
namespace utils::hook
{
namespace detail