Skip to content

Commit

Permalink
get rid of labels on x86
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Aug 5, 2023
1 parent bf0e22e commit 12b2de5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
17 changes: 0 additions & 17 deletions src/assembler/X86Assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ X86Assembler::X86Assembler(uint64_t baseAddress) :

X86Assembler::~X86Assembler() {}

void X86Assembler::label32(std::string const& name) {
m_labelUpdates.push_back({this->currentAddress(), name, 4});
this->write32(0);
}

void X86Assembler::updateLabels() {
for (auto const& update : m_labelUpdates) {
this->rewrite32(update.m_address, m_labels[update.m_name] - update.m_address - 4);
}
}

void X86Assembler::nop() {
this->write8(0x90);
}
Expand Down Expand Up @@ -156,9 +145,3 @@ void X86Assembler::mov(X86Register dst, X86Register src) {
this->write8(0x89);
encodeModRM(this, dst, regIdx(src));
}

void X86Assembler::mov(X86Register reg, std::string const& label) {
this->write8(0x8b);
this->write8(0x05 | regIdx(reg) * 8);
this->label32(label);
}
4 changes: 0 additions & 4 deletions src/assembler/X86Assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ namespace tulip::hook {
X86Assembler(X86Assembler&&) = delete;
~X86Assembler();

void label32(std::string const& name);
void updateLabels() override;

void nop();

void add(X86Register reg, uint32_t value);
Expand All @@ -62,6 +59,5 @@ namespace tulip::hook {
void mov(X86Register reg, X86Pointer ptr);
void mov(X86Pointer ptr, X86Register reg);
void mov(X86Register reg, X86Register reg2);
void mov(X86Register reg, std::string const& label);
};
}

0 comments on commit 12b2de5

Please sign in to comment.