mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-08 11:23:27 +00:00
x86_64: Support mov r64, 0xffffffffffffffff (#16630) ##asm
This commit is contained in:
parent
342da21bc8
commit
123aa79117
@ -1793,7 +1793,7 @@ static int opmov(RAsm *a, ut8 *data, const Opcode *op) {
|
||||
if (!op->operands[1].is_good_flag) {
|
||||
return -1;
|
||||
}
|
||||
if (op->operands[1].immediate == -1) {
|
||||
if (op->operands[1].immediate == -1 && a->num && a->num->nc.errors > 0) {
|
||||
return -1;
|
||||
}
|
||||
immediate = op->operands[1].immediate * op->operands[1].sign;
|
||||
|
@ -34,6 +34,9 @@ static RAsmState *__as_new() {
|
||||
if (as) {
|
||||
as->l = r_lib_new (NULL, NULL);
|
||||
as->a = r_asm_new ();
|
||||
if (as->a) {
|
||||
as->a->num = r_num_new (NULL, NULL, NULL);
|
||||
}
|
||||
as->anal = r_anal_new ();
|
||||
__load_plugins (as);
|
||||
__as_set_archbits (as);
|
||||
@ -42,6 +45,9 @@ static RAsmState *__as_new() {
|
||||
}
|
||||
|
||||
static void __as_free(RAsmState *as) {
|
||||
if (as->a) {
|
||||
r_num_free (as->a->num);
|
||||
}
|
||||
r_asm_free (as->a);
|
||||
r_anal_free (as->anal);
|
||||
r_lib_free (as->l);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h> /* for ceill */
|
||||
#include <r_util.h>
|
||||
#define R_NUM_USE_CALC 1
|
||||
@ -73,7 +74,7 @@ R_API RNum *r_num_new(RNumCallback cb, RNumCallback2 cb2, void *ptr) {
|
||||
}
|
||||
|
||||
R_API void r_num_free(RNum *num) {
|
||||
R_FREE (num);
|
||||
free (num);
|
||||
}
|
||||
|
||||
#define KB (1ULL << 10)
|
||||
@ -233,13 +234,18 @@ R_API ut64 r_num_get(RNum *num, const char *str) {
|
||||
char *s = strdup (str + 2);
|
||||
if (s) {
|
||||
r_str_replace_char (s, '_', 0);
|
||||
errno = 0;
|
||||
ret = strtoull (s, NULL, 16);
|
||||
free (s);
|
||||
}
|
||||
} else {
|
||||
errno = 0;
|
||||
ret = strtoull (str + 2, NULL, 16);
|
||||
// sscanf (str+2, "%"PFMT64x, &ret);
|
||||
}
|
||||
if (errno == ERANGE) {
|
||||
error (num, "number won't fit into 64 bits");
|
||||
}
|
||||
} else {
|
||||
char *endptr;
|
||||
int len_num = len > 0 ? len - 1 : 0;
|
||||
@ -365,7 +371,11 @@ R_API ut64 r_num_get(RNum *num, const char *str) {
|
||||
ret = _strtoui64 (str, &endptr, 10);
|
||||
#endif
|
||||
#endif
|
||||
errno = 0;
|
||||
ret = strtoull (str, &endptr, 10);
|
||||
if (errno == ERANGE) {
|
||||
error (num, "number won't fit into 64 bits");
|
||||
}
|
||||
if (!IS_DIGIT (*str) || (*endptr && *endptr != lch)) {
|
||||
error (num, "unknown symbol");
|
||||
}
|
||||
|
@ -54,9 +54,12 @@ a "mov rax, 0x100000000" 48b80000000001000000
|
||||
ad "movabs rax, 0x100000000" 48b80000000001000000
|
||||
ad "mov rax, 0" 48c7c000000000
|
||||
a "mov rax, -1" 48c7c0ffffffff
|
||||
adB "mov rax, 0xffffffffffffffff" 48c7c0ffffffff
|
||||
a "mov rax, -0x1" 48c7c0ffffffff
|
||||
ad "mov rax, 0xffffffffffffffff" 48c7c0ffffffff
|
||||
a "mov rax, 0xFfFFffFFFFffffff" 48c7c0ffffffff
|
||||
a "mov rax, -1U" 48c7c0ffffffff
|
||||
a "mov rax, 0xffffffffffffffffU" 48c7c0ffffffff
|
||||
a "mov rax, -2" 48c7c0feffffff
|
||||
a "mov rax, -0x2" 48c7c0feffffff
|
||||
ad "mov rax, 0xfffffffffffffffe" 48c7c0feffffff
|
||||
a "mov rax, -0x80000000" 48c7c000000080
|
||||
ad "mov rax, 0xffffffff80000000" 48c7c000000080
|
||||
|
Loading…
Reference in New Issue
Block a user