Implement assembler endbr32 and endbr64 instructions for x86-32/64 (#17035) ##asm

Co-authored-by: pancake <pancake@nopcode.org>
This commit is contained in:
pancake 2020-06-10 13:15:46 +02:00 committed by GitHub
parent ae883f0cd3
commit 9978bbd7c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008-2018 - pancake, unlogic, emvivre */
/* Copyright (C) 2008-2020 - pancake, unlogic, emvivre */
#include <r_flag.h>
#include <r_core.h>
@ -646,6 +646,16 @@ static int opneg(RAsm *a, ut8 * data, const Opcode *op) {
return -1;
}
static int endbr64(RAsm *a, ut8 * data, const Opcode *op) {
memcpy (data, "\xf3\x0f\x1e\xfa", 4);
return 4;
}
static int endbr32(RAsm *a, ut8 * data, const Opcode *op) {
memcpy (data, "\xf3\x0f\x1e\xfb", 4);
return 4;
}
static int opnot(RAsm *a, ut8 * data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
@ -4268,6 +4278,8 @@ LookupTable oplookup[] = {
{"dec", 0, &opdec, 0},
{"div", 0, &opdiv, 0},
{"emms", 0, NULL, 0x0f77, 2},
{"endbr32", 0, endbr32, 0},
{"endbr64", 0, endbr64, 0},
{"f2xm1", 0, NULL, 0xd9f0, 2},
{"fabs", 0, NULL, 0xd9e1, 2},
{"fadd", 0, &opfadd, 0},

View File

@ -134,6 +134,7 @@ d "div byte [eax]" f630
d "divsd xmm0, qword [eax]" f20f5e00
d "divss xmm0, dword [eax]" f30f5e00
d "emms" 0f77
ad "endbr32" f30f1efb
d "femms" 0f0e
d "fxrstor [eax]" 0fae08
d "fxsave [eax]" 0fae00

View File

@ -960,6 +960,7 @@ a "bswap rax" 480fc8
a "bswap r15" 490fcf
a "bswap eax" 0fc8
a "bswap r15d" 410fcf
ad "endbr64" f30f1efa
ad "xchg eax, r8d" 4190
a "xchg r8d, eax" 4190
ad "xchg rax, rdx" 4892