Skip to content
Snippets Groups Projects
Commit 347fbbe3 authored by Jason Hiser's avatar Jason Hiser
Browse files

fixed issues on x32 that had crept in

parent 24d29543
No related branches found
No related tags found
No related merge requests found
...@@ -155,15 +155,15 @@ void Push64Relocs_t::HandlePush64Relocation(Instruction_t *insn, Relocation_t *r ...@@ -155,15 +155,15 @@ void Push64Relocs_t::HandlePush64Relocation(Instruction_t *insn, Relocation_t *r
*/ */
// this is OK, but could we consider the insn->Assemble() method for readability? // this is OK, but could we consider the insn->Assemble() method for readability?
databits = ""; databits = "";
databits.resize(8); if(m_firp.GetArchitectureBitWidth()==64)
databits[0]=0x48; databits+=(char)0x48; // rex prefix to convert esp->rsp
databits[1]=0x81; databits+=(char)0x81;
databits[2]=0x2c; databits+=(char)0x2c;
databits[3]=0x24; databits+=(char)0x24;
databits[4]=0xff; databits+=(char)0xff;
databits[5]=0xff; databits+=(char)0xff;
databits[6]=0xff; databits+=(char)0xff;
databits[7]=0xff; databits+=(char)0xff;
add_insn->SetDataBits(databits); add_insn->SetDataBits(databits);
/* /*
...@@ -301,12 +301,13 @@ void Push64Relocs_t::UpdatePush64Adds() ...@@ -301,12 +301,13 @@ void Push64Relocs_t::UpdatePush64Adds()
<< " as the updated offset." << endl << " as the updated offset." << endl
<< "Using 0x" << std::hex << add_offset << "Using 0x" << std::hex << add_offset
<< " as the base offset." << endl; << " as the base offset." << endl;
const auto rex_skip=m_firp.GetArchitectureBitWidth()==64 ? 1 : 0;
if (change_to_add) if (change_to_add)
{ {
char add = (char)0x04; char add = (char)0x04;
m_memory_space.PlopBytes(add_addr+2, (const char*)&add, 1); m_memory_space.PlopBytes(add_addr+rex_skip+1, (const char*)&add, 1);
} }
m_memory_space.PlopBytes(add_addr+4, (const char*)&relocated_value, 4); m_memory_space.PlopBytes(add_addr+rex_skip+3, (const char*)&relocated_value, 4);
} }
// handle basic pcrel relocations. // handle basic pcrel relocations.
// zipr_unpin_plugin handles pcrel + WRT // zipr_unpin_plugin handles pcrel + WRT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment