We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8c5424 commit 51a2800Copy full SHA for 51a2800
monoasm/src/jit_memory.rs
@@ -570,6 +570,16 @@ impl JitMemory {
570
slice.iter().for_each(|b| self.emitb(*b));
571
}
572
573
+ ///
574
+ /// Apply patch for the displacement of the jmp instruction in *patch_point*.
575
576
+ pub fn apply_jmp_patch(&mut self, patch_point: DestLabel, jmp_dest: DestLabel) {
577
+ let patch_point = self.get_label_address(patch_point);
578
+ let jmp_dest = self.get_label_address(jmp_dest);
579
+ let offset = jmp_dest - patch_point - 5;
580
+ unsafe { *(patch_point.as_ptr().add(1) as *mut [u8; 4]) = (offset as i32).to_ne_bytes() };
581
+ }
582
+
583
///
584
/// Apply patch for the displacement of the jmp instruction in *patch_point*.
585
0 commit comments