bool Target::patchEntryAddr()
{
  Elf32_Ehdr* self = (Elf32_Ehdr*)0x8048000;
  unsigned char* self_entry_code = (unsigned char*)self->e_entry;
  unsigned char* target_entry_code = p.b + (p.ehdr->e_entry - 0x8048000);

  if (0 != memcmp(self_entry_code, target_entry_code, 0xc))
    return false;

  /* check for "call" */
  if (self_entry_code[0x1c] != target_entry_code[0x1c])
    return false;

  /* check for "hlt" */
  if (self_entry_code[0x21] != target_entry_code[0x21])
    return false;

  int beyond_the_call = p.ehdr->e_entry + 0x21; 
  int* patch_point = (int*)(target_entry_code + 0x1D);
  original_entry = beyond_the_call + *patch_point;
  *patch_point = newEntryAddr() - beyond_the_call;

  return true;
}
