Skip to content

Commit

Permalink
make adrp use int64_t instead of uint32_t
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Apr 11, 2024
1 parent 272cba9 commit 3ec2e6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/assembler/ArmV8Assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ void ArmV8Assembler::stp(ArmV8Register reg1, ArmV8Register reg2, ArmV8Register r
this->write32(opc | reg2Shifted | regBaseShifted | immShifted | val(reg1));
}

void ArmV8Assembler::adrp(ArmV8Register dst, uint32_t imm) {
void ArmV8Assembler::adrp(ArmV8Register dst, int64_t imm) {
const auto immlo = ((imm >> 12) & 3ull) << 29;
const auto immhi = (imm >> 14) << 5;
const auto immhi = ((imm >> 14) & 0x7ffffull) << 5;
this->write32(0x90000000 | immlo | immhi | val(dst));
}

Expand Down
2 changes: 1 addition & 1 deletion src/assembler/ArmV8Assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace tulip::hook {
void ldr(ArmV8Register dst, std::string const& label);
void ldp(ArmV8Register reg1, ArmV8Register reg2, ArmV8Register regBase, int16_t imm, ArmV8IndexKind kind);
void stp(ArmV8Register reg1, ArmV8Register reg2, ArmV8Register regBase, int16_t imm, ArmV8IndexKind kind);
void adrp(ArmV8Register dst, uint32_t imm);
void adrp(ArmV8Register dst, int64_t imm);
void add(ArmV8Register dst, ArmV8Register src, uint16_t imm);
void b(uint32_t imm);
void br(ArmV8Register reg);
Expand Down

0 comments on commit 3ec2e6e

Please sign in to comment.