From d1ec9f1efa080d7698623eb565473ed75d91876e Mon Sep 17 00:00:00 2001
From: whh8b <whh8b@git.zephyr-software.com>
Date: Sat, 23 Jan 2016 22:08:49 +0000
Subject: [PATCH] Make add/sub store all 64-bits of the result

The previous version only stored the lower 32-bits.
This meant that any results that would have
affected the upper 32-bits were ignored. This was
only a problem when jumps are fixed high in the
address space. But, definitely a big problem
nonetheless.
---
 push64_relocs.cpp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/push64_relocs.cpp b/push64_relocs.cpp
index cad5f54..07fb243 100644
--- a/push64_relocs.cpp
+++ b/push64_relocs.cpp
@@ -151,14 +151,15 @@ void Push64Relocs_t::HandlePush64Relocation(Instruction_t *insn, Relocation_t *r
 	 */
 // this is OK, but could we consider the insn->Assemble() method for readability? 
 	databits = "";
-	databits.resize(7);
-	databits[0]=0x81;
-	databits[1]=0x2c;	
-	databits[2]=0x24;
-	databits[3]=0xff;
+	databits.resize(8);
+	databits[0]=0x48;
+	databits[1]=0x81;
+	databits[2]=0x2c;	
+	databits[3]=0x24;
 	databits[4]=0xff;
 	databits[5]=0xff;
 	databits[6]=0xff;
+	databits[7]=0xff;
 	add_insn->SetDataBits(databits);
 
 	/*
@@ -285,9 +286,9 @@ void Push64Relocs_t::UpdatePush64Adds()
 			if (change_to_add)
 			{
 				char add = (char)0x04;
-				m_memory_space.PlopBytes(add_addr+1, (const char*)&add, 1);
+				m_memory_space.PlopBytes(add_addr+2, (const char*)&add, 1);
 			}
-			m_memory_space.PlopBytes(add_addr+3, (const char*)&relocated_value, 4);
+			m_memory_space.PlopBytes(add_addr+4, (const char*)&relocated_value, 4);
 		}
 		else if (reloc = FindPcrelRelocation(insn))
 		{
-- 
GitLab