Skip to content

Commit

Permalink
fix the error about riscv nop instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
Godones authored and Evian-Zhang committed Aug 7, 2024
1 parent 0799d99 commit c87d9fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
target: [
i686-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
riscv64gc-unknown-linux-gnu,
]
steps:
- name: checkout
Expand Down
2 changes: 1 addition & 1 deletion src/arch/riscv64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn arch_jump_entry_instruction(
jal.to_ne_bytes()
}
// RISCV_INSN_NOP 0x00000013
JumpLabelType::Nop => [0x00, 0x00, 0x00, 0x13],
JumpLabelType::Nop => [0x13, 0x00, 0x00, 0x00],
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use code_manipulate::CodeManipulator;
///
/// The relative addresses will be updated to absolute address after calling [`global_init`]. This
/// is because we want to sort the jump entries in place.
#[derive(Debug)]
struct JumpEntry {
/// Address of the JMP/NOP instruction to be modified.
code: usize,
Expand Down Expand Up @@ -375,6 +376,7 @@ unsafe fn static_key_update<M: CodeManipulator, const S: bool>(
}

/// Type of the instructions to be modified
#[derive(Debug)]
enum JumpLabelType {
/// 5 byte NOP
Nop = 0,
Expand Down

0 comments on commit c87d9fd

Please sign in to comment.