code cleanup
const etc
This commit is contained in:
parent
d8d3d85444
commit
dbdfa84fab
3 changed files with 17 additions and 10 deletions
|
|
@ -56,12 +56,12 @@ static_assert(sizeof(detour_trampoline) == 192);
|
|||
|
||||
typedef uint32_t detours_arm64_opcode_t;
|
||||
|
||||
static inline detours_arm64_opcode_t fetch_opcode(uint8_t* code)
|
||||
static inline detours_arm64_opcode_t fetch_opcode(const uint8_t* code)
|
||||
{
|
||||
return *(detours_arm64_opcode_t*)code;
|
||||
}
|
||||
|
||||
static inline void write_opcode(uint8_t** int_out_code, detours_arm64_opcode_t opcode)
|
||||
static inline void write_opcode(uint8_t** int_out_code, const detours_arm64_opcode_t opcode)
|
||||
{
|
||||
uint8_t* code = *int_out_code;
|
||||
*(detours_arm64_opcode_t*)code = opcode;
|
||||
|
|
@ -98,10 +98,10 @@ union detours_arm64_indirect_imm {
|
|||
uint64_t adrp_immhi : 19;
|
||||
};
|
||||
|
||||
int64_t value;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
static inline uint8_t* internal_detour_gen_jmp_indirect(uint8_t* code, uint64_t* jump_val)
|
||||
static inline uint8_t* internal_detour_gen_jmp_indirect(uint8_t* code, const uint64_t* jump_val)
|
||||
{
|
||||
// adrp x17, [jmpval]
|
||||
// ldr x17, [x17, jmpval]
|
||||
|
|
@ -135,7 +135,7 @@ static inline uint8_t* internal_detour_gen_jmp_indirect(uint8_t* code, uint64_t*
|
|||
return code;
|
||||
}
|
||||
|
||||
static inline uint8_t* internal_detour_gen_brk(uint8_t* code, uint8_t* limit)
|
||||
static inline uint8_t* internal_detour_gen_brk(uint8_t* code, const uint8_t* limit)
|
||||
{
|
||||
while (code < limit) {
|
||||
write_opcode(&code, 0xd4100000 | (0xf000 << 5));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue