Fix endianness issues on s390x (#5940)

* Refactor of bflt to guess arch & fix m68k code
* Fix endianness issues
* Always cleanup at the end on travis ci
This commit is contained in:
Giovanni 2026-02-19 23:13:18 +08:00 committed by GitHub
parent 1e33f52ed3
commit 7f55442dc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
71 changed files with 1798 additions and 1252 deletions

View file

@ -52,3 +52,6 @@ script:
pip3 install --user 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python'
pip3 install --user requests
$SHELL travis-script
after_script:
# always cleanup
- rm -rf "${TRAVIS_BUILD_DIR}/install" build test/bins

View file

@ -555,6 +555,11 @@ RZ_DEPRECATE RZ_API int rz_asm_set_bits(RzAsm *a, int bits) {
return false;
}
RZ_API ut32 rz_asm_get_endianness(RzAsm *a) {
rz_return_val_if_fail(a && a->cur, RZ_SYS_ENDIAN_NONE);
return a->cur->endian;
}
RZ_API bool rz_asm_set_big_endian(RzAsm *a, bool b) {
rz_return_val_if_fail(a && a->cur, false);
a->big_endian = false; // little endian by default

View file

@ -187,7 +187,7 @@ static int m68k_analyze_op(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8
cs_m68k *m68k;
cs_detail *detail;
int mode = a->big_endian ? CS_MODE_BIG_ENDIAN : CS_MODE_LITTLE_ENDIAN;
cs_mode mode = 0;
// mode |= (a->bits==64)? CS_MODE_64: CS_MODE_32;
if (mode != ctx->omode || a->bits != ctx->obits) {

View file

@ -37,20 +37,20 @@
#define SET_SRC_DST_3_REGS(op) \
CREATE_SRC_DST_3(op); \
(op)->dst->reg = rz_reg_get(analysis->reg, REG(0), RZ_REG_TYPE_GPR); \
(op)->src[0]->reg = rz_reg_get(analysis->reg, REG(1), RZ_REG_TYPE_GPR); \
(op)->src[1]->reg = rz_reg_get(analysis->reg, REG(2), RZ_REG_TYPE_GPR);
(op)->dst->reg = riscv_reg_get(analysis->reg, REG(0), RZ_REG_TYPE_GPR); \
(op)->src[0]->reg = riscv_reg_get(analysis->reg, REG(1), RZ_REG_TYPE_GPR); \
(op)->src[1]->reg = riscv_reg_get(analysis->reg, REG(2), RZ_REG_TYPE_GPR);
#define SET_SRC_DST_3_IMM(op) \
CREATE_SRC_DST_3(op); \
(op)->dst->reg = rz_reg_get(analysis->reg, REG(0), RZ_REG_TYPE_GPR); \
(op)->src[0]->reg = rz_reg_get(analysis->reg, REG(1), RZ_REG_TYPE_GPR); \
(op)->dst->reg = riscv_reg_get(analysis->reg, REG(0), RZ_REG_TYPE_GPR); \
(op)->src[0]->reg = riscv_reg_get(analysis->reg, REG(1), RZ_REG_TYPE_GPR); \
(op)->src[1]->imm = IMM(2);
#define SET_SRC_DST_2_REGS(op) \
CREATE_SRC_DST_2(op); \
(op)->dst->reg = rz_reg_get(analysis->reg, REG(0), RZ_REG_TYPE_GPR); \
(op)->src[0]->reg = rz_reg_get(analysis->reg, REG(1), RZ_REG_TYPE_GPR);
(op)->dst->reg = riscv_reg_get(analysis->reg, REG(0), RZ_REG_TYPE_GPR); \
(op)->src[0]->reg = riscv_reg_get(analysis->reg, REG(1), RZ_REG_TYPE_GPR);
#define SET_SRC_DST_3_REG_OR_IMM(op) \
if (OPERAND(2).type == RISCV_OP_IMM) { \
@ -61,6 +61,14 @@
static void set_stack_effect(RzAnalysisOp *op, cs_insn *insn);
static RzRegItem *riscv_reg_get(const RzReg *reg, const char *name, int type) {
if (!reg || RZ_STR_ISEMPTY(name)) {
RZ_LOG_DEBUG("riscv: reg (%p) or name (%p) is null (type %d)\n", reg, name, type);
return NULL;
}
return rz_reg_get(reg, name, type);
}
static RzStructuredData *riscv_opex(csh handle, cs_insn *insn) {
if (!insn->detail) {
return NULL;
@ -150,7 +158,7 @@ static void op_fillval(RzAnalysis *analysis, RzAnalysisOp *op, csh *handle, cs_i
ZERO_FILL(ctx->reg);
op->dst = rz_analysis_value_new();
op->dst->type = RZ_ANALYSIS_VAL_REG;
op->dst->reg = rz_reg_get(analysis->reg, cs_reg_name(*handle, FIRST_WRITTEN_REGID(insn)), RZ_REG_TYPE_GPR);
op->dst->reg = riscv_reg_get(analysis->reg, cs_reg_name(*handle, FIRST_WRITTEN_REGID(insn)), RZ_REG_TYPE_GPR);
op->src[0] = rz_analysis_value_new();
op->src[0]->type = RZ_ANALYSIS_VAL_MEM;
op->src[0]->reg = &ctx->reg;
@ -170,7 +178,7 @@ static void op_fillval(RzAnalysis *analysis, RzAnalysisOp *op, csh *handle, cs_i
op->dst->memref = op->refptr;
op->src[0] = rz_analysis_value_new();
op->src[0]->type = RZ_ANALYSIS_VAL_REG;
op->src[0]->reg = rz_reg_get(analysis->reg, cs_reg_name(*handle, FIRST_READ_REGID(insn)), RZ_REG_TYPE_GPR);
op->src[0]->reg = riscv_reg_get(analysis->reg, cs_reg_name(*handle, FIRST_READ_REGID(insn)), RZ_REG_TYPE_GPR);
}
break;
case RZ_ANALYSIS_OP_TYPE_SHL:

View file

@ -1,106 +1,102 @@
// SPDX-FileCopyrightText: 2024-2026 moste00 <ubermenchun@gmail.com>
// SPDX-License-Identifier: BSD-3-Clause
#include <rz_analysis.h>
#ifndef ANALYSIS_RISCV_UTILS_H
#define ANALYSIS_RISCV_UTILS_H
#include "cs_operand.h"
#include "rz_util/rz_log.h"
#include <rz_analysis.h>
#include <capstone/capstone.h>
#include <capstone/riscv.h>
#include <stdint.h>
// A more high-level alternative to direct indexing that can get immediates and operands without exact
// indices
// While also enforcing high-level constraints such as "exactly one immediate operand is present"
// or "at most one operand is present" or "get the single register that is read/written"
// A more high-level alternative to direct indexing that can get immediates and operands without exact indices
// While also enforcing high-level constraints such as "exactly one immediate operand is present" or "at most
// one operand is present" or "get the single register that is read/written"
static inline int find_at_most_one_op(cs_riscv_op *operands, uint8_t op_count, riscv_op_type type, const char *type_str) {
int first = -1;
for (int i = 0; i < op_count; i++) {
static inline ut32 find_at_most_one_op(cs_riscv_op *operands, uint8_t op_count, riscv_op_type type, const char *type_str) {
ut32 first = UT32_MAX;
for (ut32 i = 0; i < op_count; i++) {
if (operands[i].type == type) {
if (first == -1) {
if (first == UT32_MAX) {
first = i;
} else {
RZ_LOG_FATAL("Expected exactly one %s operand, two elements matched (the %ith and %ith elements)", type_str, first, i);
exit(-1);
RZ_LOG_DEBUG("Expected exactly one %s operand, two elements matched (the %ith and %ith elements)", type_str, first, i);
}
}
}
return first;
}
static inline int find_at_most_one_imm(cs_riscv_op *operands, uint8_t op_count) {
static inline ut32 find_at_most_one_imm(cs_riscv_op *operands, uint8_t op_count) {
return find_at_most_one_op(operands, op_count, RISCV_OP_IMM, "immediate");
}
static inline int find_exactly_one_op(cs_riscv_op *operands, uint8_t op_count, riscv_op_type type, const char *type_str) {
int first = find_at_most_one_op(operands, op_count, type, type_str);
if (first == -1) {
RZ_LOG_FATAL("Expected exactly one %s operand, found none", type_str);
exit(-1);
}
return first;
static inline ut32 find_exactly_one_op(cs_riscv_op *operands, uint8_t op_count, riscv_op_type type, const char *type_str) {
return find_at_most_one_op(operands, op_count, type, type_str);
}
static inline int find_exactly_one_imm(cs_riscv_op *operands, uint8_t op_count) {
static inline ut32 find_exactly_one_imm(cs_riscv_op *operands, uint8_t op_count) {
return find_exactly_one_op(operands, op_count, RISCV_OP_IMM, "immediate");
}
static inline int64_t get_exactly_one_immediate(cs_riscv_op *operands, uint8_t op_count) {
return operands[find_exactly_one_imm(operands, op_count)].imm;
ut32 idx = find_exactly_one_imm(operands, op_count);
if (idx < op_count) {
return operands[idx].imm;
}
return INT64_MAX;
}
static inline int64_t get_at_most_one_immediate(cs_riscv_op *operands, uint8_t op_count) {
int64_t idx = find_at_most_one_imm(operands, op_count);
if (idx == -1) {
return INT64_MAX;
ut32 idx = find_at_most_one_imm(operands, op_count);
if (idx < op_count) {
return operands[idx].imm;
}
return operands[idx].imm;
return INT64_MAX;
}
#define SINGLE_IMM(insn) get_exactly_one_immediate(insn->detail->riscv.operands, insn->detail->riscv.op_count);
#define MAYBE_IMM(insn) get_at_most_one_immediate(insn->detail->riscv.operands, insn->detail->riscv.op_count);
static inline int find_first_op(cs_riscv_op *operands, uint8_t op_count, riscv_op_type type) {
for (int i = 0; i < op_count; i++) {
static inline ut32 find_first_op(cs_riscv_op *operands, uint8_t op_count, riscv_op_type type) {
for (ut32 i = 0; i < op_count; i++) {
if (operands[i].type == type) {
return i;
}
}
return -1;
return UT32_MAX;
}
static inline int find_first_imm(cs_riscv_op *operands, uint8_t op_count) {
static inline ut32 find_first_imm(cs_riscv_op *operands, uint8_t op_count) {
return find_first_op(operands, op_count, RISCV_OP_IMM);
}
static inline int64_t get_first_immediate(cs_riscv_op *operands, uint8_t op_count) {
int idx = find_first_imm(operands, op_count);
if (idx == -1) {
return INT64_MAX;
ut32 idx = find_first_imm(operands, op_count);
if (idx < op_count) {
return operands[idx].imm;
}
return operands[idx].imm;
return INT64_MAX;
}
#define FIRST_IMM(insn) get_first_immediate(insn->detail->riscv.operands, insn->detail->riscv.op_count);
static inline unsigned int get_any_reg_accessed_as(cs_riscv_op *operands, uint8_t op_count, cs_ac_type access) {
for (int i = 0; i < op_count; i++) {
static inline ut32 get_any_reg_accessed_as(cs_riscv_op *operands, uint8_t op_count, cs_ac_type access) {
for (ut32 i = 0; i < op_count; i++) {
if (operands[i].type == RISCV_OP_REG && (operands[i].access & access)) {
return operands[i].reg;
}
}
RZ_LOG_FATAL("Expected at least one register with %s access, found none", access == CS_AC_READ ? "read" : "write");
exit(-1);
RZ_LOG_DEBUG("Expected at least one register with %s access, found none", access == CS_AC_READ ? "read" : "write");
return 0; // dummy for type checking, never reached
}
static inline unsigned int first_read_register(cs_riscv_op *operands, uint8_t op_count) {
static inline ut32 first_read_register(cs_riscv_op *operands, uint8_t op_count) {
return get_any_reg_accessed_as(operands, op_count, CS_AC_READ);
}
static inline unsigned int first_written_register(cs_riscv_op *operands, uint8_t op_count) {
static inline ut32 first_written_register(cs_riscv_op *operands, uint8_t op_count) {
return get_any_reg_accessed_as(operands, op_count, CS_AC_WRITE);
}
@ -108,7 +104,7 @@ static inline unsigned int first_written_register(cs_riscv_op *operands, uint8_t
#define FIRST_WRITTEN_REGID(insn) first_written_register(insn->detail->riscv.operands, insn->detail->riscv.op_count)
// check if a certain reg is ever accessed as read/write register
static inline bool is_any_reg_accessed_as(cs_riscv_op *operands, uint8_t op_count, unsigned int reg, cs_ac_type access) {
static inline bool is_any_reg_accessed_as(cs_riscv_op *operands, uint8_t op_count, ut32 reg, cs_ac_type access) {
for (int i = 0; i < op_count; i++) {
if (operands[i].type == RISCV_OP_REG && operands[i].reg == reg && (operands[i].access & access)) {
return true;
@ -117,10 +113,10 @@ static inline bool is_any_reg_accessed_as(cs_riscv_op *operands, uint8_t op_coun
return false;
}
static inline bool is_reg_written(cs_riscv_op *operands, uint8_t op_count, unsigned int reg) {
static inline bool is_reg_written(cs_riscv_op *operands, uint8_t op_count, ut32 reg) {
return is_any_reg_accessed_as(operands, op_count, reg, CS_AC_WRITE);
}
static inline bool is_reg_read(cs_riscv_op *operands, uint8_t op_count, unsigned int reg) {
static inline bool is_reg_read(cs_riscv_op *operands, uint8_t op_count, ut32 reg) {
return is_any_reg_accessed_as(operands, op_count, reg, CS_AC_READ);
}
@ -128,7 +124,7 @@ static inline bool is_reg_read(cs_riscv_op *operands, uint8_t op_count, unsigned
#define IS_REG_READ(insn, reg) is_reg_read(insn->detail->riscv.operands, insn->detail->riscv.op_count, reg)
static inline bool is_any_reg_memory_base(cs_riscv_op *operands, uint8_t op_count, unsigned int reg) {
for (int i = 0; i < op_count; i++) {
for (ut32 i = 0; i < op_count; i++) {
if (operands[i].type == RISCV_OP_MEM && operands[i].mem.base == reg) {
return true;
}
@ -136,4 +132,6 @@ static inline bool is_any_reg_memory_base(cs_riscv_op *operands, uint8_t op_coun
return false;
}
#define MEM_BASE(insn, reg) is_any_reg_memory_base(insn->detail->riscv.operands, insn->detail->riscv.op_count, reg)
#define MEM_BASE(insn, reg) is_any_reg_memory_base(insn->detail->riscv.operands, insn->detail->riscv.op_count, reg)
#endif /* ANALYSIS_RISCV_UTILS_H */

View file

@ -54,7 +54,7 @@ cs_mode cs_mode_from_feature_flag(ut64 feature_flag) {
size_t expect_str(const char *arch_str, const char *expected, size_t curr) {
size_t l = strlen(expected);
if (strncmp(&arch_str[curr], expected, l) != 0) {
RZ_LOG_ERROR("Invalid architecture string: expected %s to equal %s",
RZ_LOG_ERROR("Invalid architecture string: expected %s to equal %s\n",
arch_str, expected);
return curr;
}
@ -205,7 +205,7 @@ bool expect_extension(const char *arch_str, size_t *curr, cs_mode *cs_mode) {
}
// unreachable
RZ_LOG_ERROR("UNREACHABLE STATE WHEN PARSING RISCV ARCH STRING");
rz_warn_if_reached();
return true; // done, this is a bad state and we should terminate parsing immediately
}
@ -233,8 +233,8 @@ bool check_all_whitespace(const char *str) {
return true;
}
size_t mode_from_arch_string(const char *arch_str) {
if (!arch_str || check_all_whitespace(arch_str)) {
RZ_LOG_WARN("RISCV: empty architecture string, no non-default extensions enabled\n");
if (!arch_str || check_all_whitespace(arch_str) || RZ_STR_EQ(arch_str, "riscv")) {
RZ_LOG_INFO("RISCV: empty architecture string, no non-default extensions enabled\n");
return 0;
}
size_t curr = expect_architecture_string_header(arch_str);

View file

@ -20,7 +20,7 @@ static int m68k_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
char *buf_asm = NULL;
cs_insn *insn = NULL;
int ret = 0, n = 0;
cs_mode mode = a->big_endian ? CS_MODE_BIG_ENDIAN : CS_MODE_LITTLE_ENDIAN;
cs_mode mode = 0;
// replace this with the asm.features?
if (a->cpu && strstr(a->cpu, "68000")) {

View file

@ -1,3 +1,4 @@
// SPDX-FileCopyrightText: 2026 deroad <deroad@kumo.xn--q9jyb4c>
// SPDX-FileCopyrightText: 2021 Florian Märkl <info@florianmaerkl.de>
// SPDX-FileCopyrightText: 2016 Oscar Salvador <osalvador.vilardaga@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
@ -19,41 +20,28 @@
#define MAX_SHARED_LIBS 1 // this may be 4 depending on kernel config
#define FLAT_DATA_ALIGN 0x20
#define READ(x, i) \
rz_read_be32((x) + (i)); \
(i) += 4;
static bool bflt_parse_hdr(RzBuffer *buf, ut64 off, RzBfltHdr *h, bool big_endian) {
return rz_buf_read_offset(buf, &off, (ut8 *)h->magic, sizeof(h->magic)) &&
rz_buf_read_ble32_offset(buf, &off, &h->rev, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->entry, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->data_start, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->data_end, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->bss_end, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->stack_size, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->reloc_start, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->reloc_count, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->flags, big_endian) &&
rz_buf_read_ble32_offset(buf, &off, &h->build_date, big_endian) &&
rz_buf_read_offset(buf, &off, (ut8 *)h->padding, sizeof(h->padding));
}
static bool bflt_init_hdr(RzBfltObj *bin) {
ut8 bhdr[BFLT_HDR_SIZE] = { 0 };
st64 len = rz_buf_read_at(bin->b, 0, bhdr, BFLT_HDR_SIZE);
if (len != BFLT_HDR_SIZE) {
RZ_LOG_WARN("read bFLT hdr failed\n");
if (!bflt_parse_hdr(bin->b, 0, &bin->hdr, true)) {
return false;
}
if (strncmp((const char *)bhdr, "bFLT", 4)) {
RZ_LOG_WARN("wrong magic number in bFLT file\n");
return false;
}
memcpy(bin->hdr.magic, bhdr, 4);
size_t i = 4;
bin->hdr.rev = READ(bhdr, i);
bin->hdr.entry = READ(bhdr, i);
bin->hdr.data_start = READ(bhdr, i);
bin->hdr.data_end = READ(bhdr, i);
bin->hdr.bss_end = READ(bhdr, i);
bin->hdr.stack_size = READ(bhdr, i);
bin->hdr.reloc_start = READ(bhdr, i);
bin->hdr.reloc_count = READ(bhdr, i);
bin->hdr.flags = READ(bhdr, i);
bin->hdr.build_date = READ(bhdr, i);
if (bin->hdr.rev != FLAT_VERSION) {
} else if (bin->hdr.rev != FLAT_VERSION) {
RZ_LOG_WARN("only bFLT v4 is supported! This file has version %" PFMT32u "\n", bin->hdr.rev);
return false;
}
if (bin->hdr.flags & FLAT_FLAG_GZIP || bin->hdr.flags & FLAT_FLAG_GZDATA) {
} else if (bin->hdr.flags & FLAT_FLAG_GZIP || bin->hdr.flags & FLAT_FLAG_GZDATA) {
RZ_LOG_WARN("this bFLT file is compressed. This is not (yet) supported.\n");
}
return true;
@ -62,9 +50,7 @@ static bool bflt_init_hdr(RzBfltObj *bin) {
static bool bflt_reloc_big_endian(RzBfltObj *bin) {
// if bin->hdr.flags & FLAT_FLAG_GOTPIC, then all relocs
// are already in target order, otherwise they are always be
return (bin->hdr.flags & FLAT_FLAG_GOTPIC)
? bin->big_endian
: true;
return (bin->hdr.flags & FLAT_FLAG_GOTPIC) ? bin->big_endian : true;
}
static void bflt_load_relocs(RzBfltObj *bin) {
@ -79,7 +65,7 @@ static void bflt_load_relocs(RzBfltObj *bin) {
break;
}
ut32 value;
if (!rz_buf_read_ble32_at(bin->b, paddr, &value, big_endian)) {
if (!rz_buf_read_ble32_at(bin->b, paddr, &value, bin->big_endian)) {
break;
}
if (value == 0xffffffff) {
@ -145,6 +131,47 @@ static void bflt_patch_relocs(RzBfltObj *bin) {
rz_buf_sparse_set_write_mode(bin->buf_patched, RZ_BUF_SPARSE_WRITE_MODE_THROUGH);
}
static void bflt_guess_arch(RzBuffer *buf, ut64 entry, const char **arch, bool *big_endian) {
*arch = "arm";
*big_endian = false;
ut8 code[4] = { 0 };
if (rz_buf_read_at(buf, entry, code, sizeof(code)) != sizeof(code)) {
return;
}
#define IS_BYTE(i, b, m) ((code[i] & m) == b)
#define IS_1_BYTES(b0, m0) IS_BYTE(0, b0, m0)
#define IS_2_BYTES(b0, m0, b1, m1) (IS_BYTE(0, b0, m0) && IS_BYTE(1, b1, m1))
#define IS_4_BYTES(b0, m0, b1, m1, b2, m2, b3, m3) (IS_BYTE(0, b0, m0) && IS_BYTE(1, b1, m1) && IS_BYTE(2, b2, m2) && IS_BYTE(3, b3, m3))
if (IS_2_BYTES(0x20, 0xf1, 0x00, 0x40 /* move.l */) ||
IS_2_BYTES(0x20, 0xf1, 0x40, 0x40 /* movea.l */) ||
IS_2_BYTES(0x30, 0xf1, 0x40, 0x40 /* move.w */) ||
IS_2_BYTES(0x48, 0xff, 0xe0, 0xff /* movem.l */) ||
IS_2_BYTES(0x4e, 0xff, 0x50, 0xf8 /* link.w */) ||
IS_2_BYTES(0x90, 0xf0, 0x80, 0xc0 /* sub.l */) ||
IS_2_BYTES(0x90, 0xf0, 0x40, 0xc0 /* sub.w */) ||
IS_2_BYTES(0x91, 0xf1, 0x80, 0xa0 /* suba.l */) ||
IS_2_BYTES(0x90, 0xf1, 0x80, 0xa0 /* suba.w */) ||
IS_1_BYTES(0x70, 0xff /* moveq */)) {
*arch = "m68k";
*big_endian = true;
return;
} else if (IS_4_BYTES(0xe1, 0xfd, 0xa0, 0xff, 0x00, 0x00, 0x00, 0x00 /* mov */) ||
IS_4_BYTES(0xe9, 0xfd, 0x2d, 0xff, 0x00, 0x00, 0x00, 0x00 /* push */)) {
// it's arm32:be
*big_endian = true;
return;
}
// it's arm32:le
#undef IS_BYTE
#undef IS_1_BYTES
#undef IS_2_BYTES
#undef IS_4_BYTES
}
static bool rz_bflt_init(RzBfltObj *obj, RzBuffer *buf, ut64 baddr, bool big_endian, bool patch_relocs) {
obj->b = rz_buf_ref(buf);
obj->size = rz_buf_size(buf);
@ -155,6 +182,7 @@ static bool rz_bflt_init(RzBfltObj *obj, RzBuffer *buf, ut64 baddr, bool big_end
if (!bflt_init_hdr(obj)) {
return false;
}
bflt_guess_arch(obj->b, 0x44, &obj->arch, &obj->big_endian);
bflt_load_relocs(obj);
if (patch_relocs) {
bflt_patch_relocs(obj);

View file

@ -30,7 +30,7 @@ typedef struct rz_bflt_hdr_t {
ut32 reloc_count;
ut32 flags;
ut32 build_date;
ut32 filler[5];
ut8 padding[20];
} RzBfltHdr;
typedef struct rz_bflt_reloc_t {
@ -46,6 +46,7 @@ typedef struct rz_bflt_obj_t {
RzBuffer *buf_patched; ///< overlay over the original file with relocs patched
ut64 baddr;
bool big_endian;
const char *arch;
size_t size;
uint32_t n_got;
} RzBfltObj;

View file

@ -768,7 +768,7 @@ typedef enum {
* \param [out] result_len The length of usable data in the result buffer, always <= result_maxlen
* \return riscv_attr_type The type of the found attribute, indicating whether it's a string or uleb128 integer and whether it was truncated
*/
static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr_tag, int result_maxlen, ut8 *result, int *result_len) {
static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr_tag, size_t result_maxlen, ut8 *result, size_t *result_len) {
// format:
/*
* <format-byte> <subsection 4-byte length> <null-terminated vendor name> <one or more tag-value pairs> */
@ -778,14 +778,14 @@ static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr
ut64 curr = 0;
// format byte
ut8 format;
ut8 format = 0;
if (!sec || !rz_buf_read8_offset(sec, &curr, &format) || format != 'A') {
RZ_LOG_ERROR("Can't read the format byte of the RISCV attrbiute section or found a different format (expected 'A' at section start)\n");
return RISCV_ATTR_NONE;
}
// subsection length
ut32 subsec_len;
ut32 subsec_len = 0;
if (!rz_buf_read_ble32_offset(sec, &curr, &subsec_len, /* big endian? */ false)) {
RZ_LOG_ERROR("Can't read the subsection length of the RISCV attribute section\n");
return RISCV_ATTR_NONE;
@ -802,7 +802,7 @@ static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr
// now parse the tag-value array
while (curr < rz_buf_size(sec)) {
ut64 tag;
ut64 tag = 0;
ut32 num_bytes_read = rz_buf_uleb128_at(sec, curr, &tag);
curr += num_bytes_read;
@ -822,7 +822,7 @@ static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr
// Like ARM but even simpler, no special cases for tags below 32
bool tag_is_odd = tag & 0x1;
int result_curr = 0;
size_t result_curr = 0;
// value is a null-terminated string
if (tag_is_odd) {
int string_starts_at = curr;
@ -840,7 +840,7 @@ static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr
bool result_overflow = false;
// have we filled the buffer ?
if (result_curr == result_maxlen) {
if (result_curr >= result_maxlen) {
result_overflow = result[result_maxlen - 1] != '\0';
// must force the last byte to null, in case the original string was too long
result[result_maxlen - 1] = '\0';
@ -863,7 +863,7 @@ static riscv_attr_type get_riscv_attribute_from_section(RzBuffer *sec, ut64 attr
bool result_overflow = false;
// have we filled the buffer ?
if (result_curr == result_maxlen) {
if (result_curr >= result_maxlen) {
result_overflow = result[result_maxlen - 1] & 0x80;
// must force the last byte to a terminal byte, in case the original number was too long
result[result_maxlen - 1] = result[result_maxlen - 1] & 0x7F;
@ -926,8 +926,8 @@ static inline bool arch_is_parisc(ELFOBJ *bin) {
return arch_is(bin, EM_PARISC);
}
static bool arch_is_riscv(ELFOBJ *bin) {
return bin->ehdr.e_machine == EM_RISCV;
static inline bool arch_is_riscv(ELFOBJ *bin) {
return arch_is(bin, EM_RISCV);
}
static char *read_elf_intrp(ELFOBJ *bin, ut64 addr, size_t size) {
@ -1523,6 +1523,19 @@ static char *get_cpu_h8xx(ELFOBJ *bin) {
return rz_str_dup("h8300");
}
static char *get_cpu_riscv(ELFOBJ *bin) {
char bin_arch[256] = { 0 };
size_t len = 0;
riscv_attr_type typ = get_riscv_attribute_from_section(get_riscv_attributes_section(bin), T_RISCV_arch, sizeof(bin_arch), (ut8 *)bin_arch, &len);
len = RZ_MIN(len, sizeof(bin_arch));
if (typ == RISCV_ATTR_NT_STRING) {
return rz_str_ndup((const char *)bin_arch, len);
}
// some hardcoded fallback, the mafd + vector
return strdup("rv64i2p0_c2p0_m2p0_a2p0_f2p0_d2p0_v2p0");
}
/**
* \brief List all imported lib
* \param elf binary
@ -2117,14 +2130,7 @@ RZ_OWN char *Elf_(rz_bin_elf_get_cpu)(RZ_NONNULL ELFOBJ *bin) {
} else if (arch_is_h8xx(bin)) {
return get_cpu_h8xx(bin);
} else if (arch_is_riscv(bin)) {
ut8 archstr[256];
int archstr_len;
riscv_attr_type typ = get_riscv_attribute_from_section(get_riscv_attributes_section(bin), T_RISCV_arch, 256, archstr, &archstr_len);
if (typ == RISCV_ATTR_NT_STRING) {
return rz_str_dup((const char *)archstr);
}
// some hardcoded fallback, the mafd + vector
return strdup("rv64i2p0_c2p0_m2p0_a2p0_f2p0_d2p0_v2p0");
return get_cpu_riscv(bin);
}
return NULL;
}

View file

@ -127,7 +127,7 @@ static size_t consume_locals_r(RzBuffer *b, ut64 max, RzBinWasmCodeEntry *out) {
if (!(consume_u32_r(b, max, &out->locals[j].count))) {
goto beach;
}
if (!(consume_s7_r(b, max, (st8 *)&out->locals[j].type))) {
if (!(consume_s7_r(b, max, &out->locals[j].type))) {
goto beach;
}
j++;
@ -314,24 +314,24 @@ static void *parse_type_entry(RzBuffer *b, ut64 max) {
goto beach;
}
if (count > 0) {
if (!(ptr->param_types = RZ_NEWS0(RzBinWasmValueType, count))) {
if (!(ptr->param_types = RZ_NEWS0(st8, count))) {
goto beach;
}
}
int j;
for (j = 0; j < count; j++) {
if (!(consume_s7_r(b, max, (st8 *)&ptr->param_types[j]))) {
if (!(consume_s7_r(b, max, &ptr->param_types[j]))) {
goto beach;
}
}
if (!(consume_u1_r(b, max, (ut8 *)&ptr->return_count))) {
if (!(consume_u1_r(b, max, &ptr->return_count))) {
goto beach;
}
if (ptr->return_count > 1) {
goto beach;
}
if (ptr->return_count == 1) {
if (!(consume_s7_r(b, max, (st8 *)&ptr->return_type))) {
if (!(consume_s7_r(b, max, &ptr->return_type))) {
goto beach;
}
}
@ -363,7 +363,7 @@ static void *parse_import_entry(RzBuffer *b, ut64 max) {
}
break;
case RZ_BIN_WASM_EXTERNALKIND_Table:
if (!(consume_s7_r(b, max, (st8 *)&ptr->type_t.elem_type))) {
if (!(consume_s7_r(b, max, &ptr->type_t.elem_type))) {
goto beach;
}
if (!(consume_limits_r(b, max, &ptr->type_t.limits))) {
@ -376,10 +376,10 @@ static void *parse_import_entry(RzBuffer *b, ut64 max) {
}
break;
case RZ_BIN_WASM_EXTERNALKIND_Global:
if (!(consume_s7_r(b, max, (st8 *)&ptr->type_g.content_type))) {
if (!(consume_s7_r(b, max, &ptr->type_g.content_type))) {
goto beach;
}
if (!(consume_u1_r(b, max, (ut8 *)&ptr->type_g.mutability))) {
if (!(consume_u1_r(b, max, &ptr->type_g.mutability))) {
goto beach;
}
break;
@ -614,7 +614,7 @@ static void *parse_table_entry(RzBuffer *b, ut64 max) {
if (!ptr) {
return NULL;
}
if (!(consume_s7_r(b, max, (st8 *)&ptr->element_type))) {
if (!(consume_s7_r(b, max, &ptr->element_type))) {
goto beach;
}
if (!(consume_limits_r(b, max, &ptr->limits))) {
@ -632,7 +632,7 @@ static void *parse_global_entry(RzBuffer *b, ut64 max) {
if (!ptr) {
return NULL;
}
if (!(consume_u7_r(b, max, (ut8 *)&ptr->content_type))) {
if (!(consume_u7_r(b, max, &ptr->content_type))) {
goto beach;
}
if (!(consume_u1_r(b, max, &ptr->mutability))) {

View file

@ -84,19 +84,19 @@ typedef struct rz_bin_wasm_section_t {
typedef struct rz_bin_wasm_type_t {
ut8 form;
ut32 param_count;
RzBinWasmValueType *param_types;
st8 return_count; // MVP = 1
RzBinWasmValueType return_type;
st8 /* RzBinWasmValueType */ *param_types;
ut8 return_count; // MVP = 1
st8 /* RzBinWasmValueType */ return_type;
} RzBinWasmTypeEntry;
// Other Types
typedef struct rz_bin_wasm_global_type_t {
RzBinWasmValueType content_type;
st8 /* RzBinWasmValueType */ content_type;
ut8 mutability;
} RzBinWasmGlobalType;
typedef struct rz_bin_wasm_table_type_t {
RzBinWasmValueType elem_type;
st8 /* RzBinWasmValueType */ elem_type;
RzBinWasmResizableLimits limits;
} RzBinWasmTableType;
@ -124,7 +124,7 @@ typedef struct rz_bin_wasm_function_t {
} RzBinWasmFunctionEntry;
typedef struct rz_bin_wasm_table_t {
ut8 element_type; // only anyfunc
st8 element_type; // only anyfunc
RzBinWasmResizableLimits limits;
} RzBinWasmTableEntry;
@ -133,7 +133,7 @@ typedef struct rz_bin_wasm_memory_t {
} RzBinWasmMemoryEntry;
typedef struct rz_bin_wasm_global_t {
RzBinWasmValueType content_type;
ut8 /* RzBinWasmValueType */ content_type;
ut8 mutability; // 0 if immutable, 1 if mutable
RzBinWasmInitExpr init;
} RzBinWasmGlobalEntry;
@ -151,7 +151,7 @@ typedef struct rz_bin_wasm_start_t {
typedef struct rz_bin_wasm_local_entry_t {
ut32 count;
RzBinWasmValueType type;
st8 /* RzBinWasmValueType */ type;
} RzBinWasmLocalEntry;
typedef struct rz_bin_wasm_element_t {
@ -164,7 +164,7 @@ typedef struct rz_bin_wasm_element_t {
typedef struct rz_bin_wasm_code_t {
ut32 body_size;
ut32 local_count; // numer of local entries
struct rz_bin_wasm_local_entry_t *locals;
RzBinWasmLocalEntry *locals;
ut32 code; // offset
ut32 len; // real bytecode length
ut8 byte; // 0xb, indicating end of the body

View file

@ -11,12 +11,12 @@
#define VFILE_NAME_PATCHED "patched"
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb) {
static bool bflt_load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb) {
obj->bin_obj = rz_bflt_new_buf(buf, obj->opts.baseaddr, obj->opts.big_endian, obj->opts.patch_relocs);
return obj->bin_obj;
}
static RzPVector /*<RzBinAddr *>*/ *entries(RzBinFile *bf) {
static RzPVector /*<RzBinAddr *>*/ *bflt_entries(RzBinFile *bf) {
RzBfltObj *obj = bf->o->bin_obj;
RzPVector *ret;
RzBinAddr *ptr;
@ -33,7 +33,7 @@ static RzPVector /*<RzBinAddr *>*/ *entries(RzBinFile *bf) {
return ret;
}
static RzPVector /*<RzBinMap *>*/ *maps(RzBinFile *bf) {
static RzPVector /*<RzBinMap *>*/ *bflt_maps(RzBinFile *bf) {
RzBfltObj *obj = bf->o->bin_obj;
RzPVector *ret = rz_pvector_new((RzPVectorFree)rz_bin_map_free);
if (!ret) {
@ -71,7 +71,7 @@ static RzPVector /*<RzBinMap *>*/ *maps(RzBinFile *bf) {
return ret;
}
static RzPVector /*<RzBinSection *>*/ *sections(RzBinFile *bf) {
static RzPVector /*<RzBinSection *>*/ *bflt_sections(RzBinFile *bf) {
RzBfltObj *obj = bf->o->bin_obj;
RzPVector *ret = rz_pvector_new((RzPVectorFree)rz_bin_section_free);
if (!ret) {
@ -164,7 +164,7 @@ beach:
return NULL;
}
static RzPVector /*<RzBinVirtualFile *>*/ *virtual_files(RzBinFile *bf) {
static RzPVector /*<RzBinVirtualFile *>*/ *bflt_virtual_files(RzBinFile *bf) {
RzBfltObj *obj = bf->o->bin_obj;
RzPVector *r = rz_pvector_new((RzPVectorFree)rz_bin_virtual_file_free);
if (!r) {
@ -200,7 +200,7 @@ static void convert_relocs(RzBfltObj *bin, RzPVector /*<RzBinReloc *>*/ *out, Rz
}
}
static RzPVector /*<RzBinReloc *>*/ *relocs(RzBinFile *bf) {
static RzPVector /*<RzBinReloc *>*/ *bflt_relocs(RzBinFile *bf) {
RzBfltObj *obj = (RzBfltObj *)bf->o->bin_obj;
RzPVector *vec = rz_pvector_new((RzPVectorFree)rz_bin_reloc_free);
if (!vec || !obj) {
@ -212,7 +212,7 @@ static RzPVector /*<RzBinReloc *>*/ *relocs(RzBinFile *bf) {
return vec;
}
static RzBinInfo *info(RzBinFile *bf) {
static RzBinInfo *bflt_info(RzBinFile *bf) {
RzBfltObj *obj = NULL;
RzBinInfo *info = NULL;
if (!bf || !bf->o || !bf->o->bin_obj) {
@ -228,7 +228,7 @@ static RzBinInfo *info(RzBinFile *bf) {
info->type = rz_str_dup("bFLT (Executable file)");
info->os = rz_str_dup("Linux");
info->subsystem = rz_str_dup("uClinux");
info->arch = rz_str_dup("arm"); // this is a wild guess, the format does not specify any arch, but arm is probably the most popular
info->arch = rz_str_dup(obj->arch);
info->big_endian = obj->big_endian;
info->bits = 32;
info->has_va = true;
@ -238,13 +238,13 @@ static RzBinInfo *info(RzBinFile *bf) {
return info;
}
static bool check_buffer(RzBuffer *buf) {
static bool bflt_check_buffer(RzBuffer *buf) {
ut8 tmp[4];
int r = rz_buf_read_at(buf, 0, tmp, sizeof(tmp));
return r == sizeof(tmp) && !memcmp(tmp, "bFLT", 4);
}
static void destroy(RzBinFile *bf) {
static void bflt_destroy(RzBinFile *bf) {
rz_bflt_free(bf->o->bin_obj);
}
@ -267,7 +267,8 @@ static RzStructuredData *bflt_structure(RzBinFile *bf) {
return NULL;
}
rz_structured_data_map_add_bytes(bflt_sd, "Magic", (const ut8 *)bin->hdr.magic, 4, RZ_STRUCTURED_DATA_FORMAT_HEXDUMP);
rz_structured_data_map_add_string(bflt_sd, "guessed_arch", bin->arch);
rz_structured_data_map_add_bytes(bflt_sd, "Magic", (const ut8 *)bin->hdr.magic, sizeof(bin->hdr.magic), RZ_STRUCTURED_DATA_FORMAT_HEXDUMP);
rz_structured_data_map_add_unsigned(bflt_sd, "Revision", bin->hdr.rev, true);
rz_structured_data_map_add_unsigned(bflt_sd, "Entry", bin->hdr.entry, true);
@ -279,6 +280,7 @@ static RzStructuredData *bflt_structure(RzBinFile *bf) {
rz_structured_data_map_add_unsigned(bflt_sd, "RelocCount", bin->hdr.reloc_count, false);
rz_structured_data_map_add_unsigned(bflt_sd, "Flags", bin->hdr.flags, true);
rz_structured_data_map_add_unsigned(bflt_sd, "BuildDate", bin->hdr.build_date, false);
rz_structured_data_map_add_bytes(bflt_sd, "Padding", (const ut8 *)bin->hdr.padding, sizeof(bin->hdr.padding), RZ_STRUCTURED_DATA_FORMAT_HEXDUMP);
return info;
}
@ -287,16 +289,16 @@ RzBinPlugin rz_bin_plugin_bflt = {
.desc = "bFLT uClinux binary",
.license = "LGPL3",
.author = "Oscar Salvador",
.load_buffer = &load_buffer,
.destroy = &destroy,
.check_buffer = &check_buffer,
.virtual_files = &virtual_files,
.maps = &maps,
.entries = &entries,
.sections = &sections,
.info = &info,
.load_buffer = &bflt_load_buffer,
.destroy = &bflt_destroy,
.check_buffer = &bflt_check_buffer,
.virtual_files = &bflt_virtual_files,
.maps = &bflt_maps,
.entries = &bflt_entries,
.sections = &bflt_sections,
.info = &bflt_info,
.bin_structure = &bflt_structure,
.relocs = &relocs
.relocs = &bflt_relocs
};
#ifndef RZ_PLUGIN_INCORE

View file

@ -19,6 +19,7 @@
#define core_update_config_s core_update_config_node_without_callback_string
#define core_update_config_i core_update_config_node_without_callback_int
#define core_update_config_b core_update_config_node_without_callback_bool
RZ_DEPRECATE RZ_IPI const char *rz_core_get_arch(RzCore *core) {
rz_return_val_if_fail(core && core->rasm, CORE_DEFAULT_ARCH);
@ -179,6 +180,73 @@ static void core_update_config_features_options(RzCore *core, const char *name)
core_update_config_options(node, core->rasm->cur->features);
}
RZ_DEPRECATE static const RzBinInfo *core_arch_find_bin_info(RzCore *core, const char *arch) {
if (RZ_STR_ISEMPTY(arch)) {
return NULL;
}
const RzCoreFile *cf = NULL;
RzListIter *lit;
void **vit;
rz_list_foreach (core->files, lit, cf) {
rz_pvector_foreach (&cf->binfiles, vit) {
const RzBinFile *bf = *vit;
const RzBinInfo *info = rz_bin_object_get_info(bf->o);
if (info && info->arch && RZ_STR_EQ(info->arch, arch)) {
return info;
}
}
}
return NULL;
}
static bool core_arch_default_is_big_endian(RzCore *core) {
bool big_endian = core->rasm->big_endian;
const char *arch = rz_core_get_arch(core);
const RzBinInfo *info = core_arch_find_bin_info(core, arch);
if (info) {
// always follow what the RzBin says first.
big_endian = info->big_endian;
}
ut32 endian = rz_asm_get_endianness(core->rasm);
if (endian == RZ_SYS_ENDIAN_NONE || endian == RZ_SYS_ENDIAN_BI) {
// always return what the bin or default endianness of the system
return big_endian;
}
if (big_endian && endian & RZ_SYS_ENDIAN_BIG) {
// the endianness must be big endian.
return true;
}
// the user must have asked for an arch that does not follow
// what the bin says (or is just little endian) so, we return
// as little endian.
return false;
}
RZ_DEPRECATE static void core_update_endianness(RzCore *core) {
bool big_endian = core_arch_default_is_big_endian(core);
rz_asm_set_big_endian(core->rasm, big_endian);
rz_analysis_set_big_endian(core->analysis, big_endian);
// While analysis sets endianess for TypesDB there might
// be cases when it isn't availble for the chosen analysis
// plugin but types and printing commands still need the
// corresponding endianness. Thus we set these explicitly:
rz_type_db_set_endian(core->analysis->typedb, big_endian);
core->print->big_endian = big_endian;
// the big endian should also be assigned to dbg->bp->endian
if (core->dbg && core->dbg->bp) {
core->dbg->bp->endian = big_endian;
}
}
// most of this code is a copy from cconfig
RZ_DEPRECATE static void core_update_syscall_db(RzCore *core) {
if (core->analysis->syscall->db) {
@ -254,30 +322,12 @@ RZ_DEPRECATE static bool core_arch_set_cpu(RzCore *core, const char *arch, const
return true;
}
static ut32 core_arch_find_bits_via_bin(RzCore *core, const char *arch) {
const RzCoreFile *cf = NULL;
RzListIter *lit;
void **vit;
rz_list_foreach (core->files, lit, cf) {
rz_pvector_foreach (&cf->binfiles, vit) {
const RzBinFile *bf = *vit;
const RzBinInfo *info = rz_bin_object_get_info(bf->o);
if (info && info->arch && RZ_STR_EQ(info->arch, arch)) {
return info->bits;
}
}
}
return 0;
}
static ut32 core_arch_get_default_bits(RzCore *core, const char *arch) {
const ut32 bits = core_arch_find_bits_via_bin(core, arch);
if (bits) {
return bits;
const RzBinInfo *info = core_arch_find_bin_info(core, arch);
if (!info || info->bits < 1) {
return core->rasm->bits;
}
return core->rasm->bits;
return info->bits;
}
RZ_DEPRECATE static bool core_update_arch(RzCore *core, const char *arch, ut32 bits, const char *cpu, const char *os, const char *platform) {
@ -311,6 +361,9 @@ RZ_DEPRECATE static bool core_update_arch(RzCore *core, const char *arch, ut32 b
bits = rz_core_get_bits(core);
}
// always update the endianness
core_update_endianness(core);
if (RZ_STR_ISEMPTY(arch)) {
// we now need the current arch.
arch = rz_core_get_arch(core);
@ -341,6 +394,7 @@ RZ_DEPRECATE static bool core_update_arch(RzCore *core, const char *arch, ut32 b
}
core_arch_set_os(core, arch, bits, cpu, os);
return true;
}
@ -381,6 +435,22 @@ RZ_DEPRECATE static void core_update_config_node_without_callback_int(RzCore *co
node->setter = setter;
}
// this is a ugly hack
RZ_DEPRECATE static void core_update_config_node_without_callback_bool(RzCore *core, const char *name, bool value) {
RzConfigNode *node = rz_config_node_get(core->config, name);
if (!node) {
// the node does not exist yet and we can set stuff without worring about the callback
rz_config_set_b(core->config, name, value);
return;
}
RzConfigCallback setter = node->setter;
node->setter = NULL;
rz_config_set_b(core->config, name, value);
node->setter = setter;
}
RZ_DEPRECATE static void core_update_config_from_arch(RzCore *core, bool new_arch) {
// this is a terrible way to update the values but the current config
// does weird callback calls which should not be done in this way and
@ -406,6 +476,7 @@ RZ_DEPRECATE static void core_update_config_from_arch(RzCore *core, bool new_arc
core_update_config_s(core, "analysis.arch", arch);
core_update_config_s(core, "analysis.cpu", cpu);
core_update_config_i(core, "analysis.bits", bits);
core_update_config_b(core, "cfg.bigendian", core->rasm->big_endian);
if (new_arch) {
core_update_config_bits_options(core, "asm.bits");

View file

@ -518,7 +518,7 @@ RZ_API RzCmdStatus rz_core_io_plugins_print(RZ_NONNULL RZ_BORROW RzIO *io, RzCmd
RZ_API bool rz_core_write_value_at(RzCore *core, ut64 addr, ut64 value, int sz) {
rz_return_val_if_fail(sz == 0 || sz == 1 || sz == 2 || sz == 4 || sz == 8, false);
ut8 buf[sizeof(ut64)];
bool be = rz_config_get_i(core->config, "cfg.bigendian");
bool be = rz_config_get_b(core->config, "cfg.bigendian");
core->num->value = 0;
if (sz == 0) {
@ -564,7 +564,7 @@ RZ_API bool rz_core_write_value_inc_at(RzCore *core, ut64 addr, st64 value, int
rz_return_val_if_fail(sz == 1 || sz == 2 || sz == 4 || sz == 8, false);
ut8 buf[sizeof(ut64)];
bool be = rz_config_get_i(core->config, "cfg.bigendian");
bool be = rz_config_get_b(core->config, "cfg.bigendian");
if (!rz_io_read_at_mapped(core->io, addr, buf, sz)) {
return false;

View file

@ -1851,7 +1851,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_value_op) {
ut64 v = rz_num_math(core->num, arg_str);
ut8 buf[8] = { 0 };
int be = rz_config_get_i(core->config, "cfg.bigendian");
int be = rz_config_get_b(core->config, "cfg.bigendian");
int bi = rz_config_get_i(core->config, "asm.bits");
rz_write_ble(buf, v, be, bi);

View file

@ -300,7 +300,7 @@ static int rz_core_rtr_gdb_cb(libgdbr_t *g, void *core_ptr, const char *cmd,
break;
case 'r': // dr
rz_debug_reg_sync(core->dbg, RZ_REG_TYPE_ANY, false);
be = rz_config_get_i(core->config, "cfg.bigendian");
be = rz_config_get_b(core->config, "cfg.bigendian");
if (isspace((ut8)cmd[2])) { // dr reg
const char *name, *val_ptr;
char new_cmd[128] = { 0 };

View file

@ -177,6 +177,7 @@ RZ_API bool rz_asm_use_assembler(RzAsm *a, const char *name);
RZ_API bool rz_asm_set_arch(RzAsm *a, const char *name, int bits);
RZ_DEPRECATE RZ_API int rz_asm_set_bits(RzAsm *a, int bits);
RZ_DEPRECATE RZ_API void rz_asm_set_cpu(RzAsm *a, const char *cpu);
RZ_API ut32 rz_asm_get_endianness(RzAsm *a);
RZ_API bool rz_asm_set_big_endian(RzAsm *a, bool big_endian);
RZ_API bool rz_asm_set_syntax(RzAsm *a, int syntax);
RZ_API int rz_asm_syntax_from_string(const char *name);

View file

@ -2,8 +2,8 @@ NAME=arc: [B]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
e cfg.bigendian=false
e asm.bits=32
s 0x40
wx 00e80320
ao~jump
@ -17,6 +17,7 @@ NAME=arcompact: [Bcc]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 2a000300
@ -34,6 +35,7 @@ NAME=arcompact: [Bcc.D]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 2a002300
@ -51,6 +53,7 @@ NAME=arcompact: [B]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 57048091
@ -67,6 +70,7 @@ NAME=arcompact: [B.D]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 5704a091
@ -84,6 +88,7 @@ NAME=arcompact: [BRcc limm,reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 410e4271 65872143
@ -100,6 +105,7 @@ NAME=arcompact: [BRcc.D limm,reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 410e6271 65872143
@ -118,6 +124,7 @@ FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 410e4271 65872143 @ 0x0
ao~cond
@ -133,6 +140,7 @@ NAME=arcompact: [BRcc reg,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 430ed371
@ -149,6 +157,7 @@ NAME=arcompact: [BRcc.D reg,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 430ef371
@ -167,6 +176,7 @@ FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 430ed371 @ 0x40
s 0x40
@ -183,6 +193,7 @@ NAME=arcompact: [BLcc imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 00080404
@ -200,6 +211,7 @@ NAME=arcompact: [BLcc.D imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 00082404
@ -217,6 +229,7 @@ NAME=arcompact: [BL imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 02080001 @ 0x40
s 0x40
@ -235,6 +248,7 @@ NAME=arcompact: [LDw reg,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 08170071 @ 0x40
s 0x40
@ -252,6 +266,7 @@ NAME=arcompact: [LD limm,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 08160070 34127856 @ 0x40
s 0x40
@ -269,6 +284,7 @@ NAME=arcompact: [ST reg,limm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 001e0070 00aa5500 @ 0x40
s 0x40
@ -286,6 +302,7 @@ NAME=arcompact: [ST limm,reg+imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx 0418801f 00aa5500 @ 0x40
s 0x40
@ -302,6 +319,7 @@ NAME=arcompact: [ST reg,PCL+imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx f21fc0f0 @ 0x40
s 0x40
@ -319,6 +337,7 @@ NAME=arcompact: [J blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 2020c007
@ -333,6 +352,7 @@ NAME=arcompact: [J imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 60200004
@ -349,6 +369,7 @@ NAME=arcompact: [J.D imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 61200004
@ -366,6 +387,7 @@ NAME=arcompact: [J reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 20208000
@ -380,6 +402,7 @@ NAME=arcompact: [J limm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 2020800f 34127856
@ -396,6 +419,7 @@ NAME=arcompact: [Jcc reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e0208700
@ -411,6 +435,7 @@ NAME=arcompact: [Jcc limm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e020840f 34127856
@ -428,6 +453,7 @@ FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e020840f 34127856
@ -442,6 +468,7 @@ NAME=arcompact: [Jcc blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e020c207
@ -457,6 +484,7 @@ NAME=arcompact: [JL imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 62200004
@ -473,6 +501,7 @@ NAME=arcompact: [JL.D imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 63200004
@ -490,6 +519,7 @@ NAME=arcompact: [JLcc imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e2202804
@ -507,6 +537,7 @@ NAME=arcompact: [MOV imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 8a270001
@ -522,6 +553,7 @@ NAME=arcompact: [MOV.cc imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx ca272901
@ -538,6 +570,7 @@ NAME=arcompact: [LP]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx a8200004
@ -554,6 +587,7 @@ NAME=arcompact: [LPcc]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e8202a04
@ -571,6 +605,7 @@ NAME=arcompact: [SUB_S.NE reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx c079
@ -586,6 +621,7 @@ FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx c079
@ -600,6 +636,7 @@ NAME=arcompact: [J_S reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 0079
@ -614,6 +651,7 @@ NAME=arcompact: [J_S.D reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 2079
@ -629,6 +667,7 @@ NAME=arcompact: [JEQ_S blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e07c
@ -644,6 +683,7 @@ NAME=arcompact: [JNE_S blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e07d
@ -659,6 +699,7 @@ NAME=arcompact: [J_S blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e07e
@ -673,6 +714,7 @@ NAME=arcompact: [J_S.D blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx e07f
@ -688,6 +730,7 @@ NAME=arcompact: [JL_S reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 4079
@ -702,6 +745,7 @@ NAME=arcompact: [JL_S.D reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 6079
@ -717,6 +761,7 @@ NAME=arcompact: [BREQ_S reg,0,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 04ea
@ -733,6 +778,7 @@ NAME=arcompact: [B_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 06f0
@ -749,6 +795,7 @@ NAME=arcompact: [BEQ_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 06f2
@ -766,6 +813,7 @@ NAME=arcompact: [BNE_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 06f4
@ -783,6 +831,7 @@ NAME=arcompact: [Bcc_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 06f6
@ -800,6 +849,7 @@ FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 06f6
@ -814,6 +864,7 @@ NAME=arcompact: [BL_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
s 0x40
wx 10f8
@ -830,6 +881,7 @@ NAME=arcompact: [BL]] - jump check
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx a60fcfff @ 0x160
s 0x160
@ -844,6 +896,7 @@ NAME=arcompact: [LPNZ] - jump check
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
wx e820a201 @ 0x138
s 0x138
@ -858,7 +911,9 @@ NAME=ARCompact ISA instruction length
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
e cfg.bigendian=false
wx 0a22803f00002839 @ 0
wx cf7200003439 @ 8
wx 422bbc80 @ 8+6
@ -877,6 +932,7 @@ NAME=arc4: [B.D] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx 20040020 @ 0x207c
s 0x207c
@ -891,6 +947,7 @@ NAME=arc4: [BNZ.D] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx 22030020 @ 0x2100
s 0x2100
@ -905,6 +962,7 @@ NAME=arc4: [BNZ.JD] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx c2100020 @ 0x1f68
s 0x1f68
@ -919,6 +977,7 @@ NAME=arc4: [BGT] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx 89040020 @ 0x1b18
s 0x1b18
@ -933,6 +992,7 @@ NAME=arc4: [BL.D] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx a0270228 @ 0x208c
s 0x208c
@ -947,6 +1007,7 @@ NAME=arc4: [BLHI] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx ad130628 @ 0x1148
s 0x1148
@ -961,6 +1022,7 @@ NAME=arc4: [LP] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx 00020030 @ 0x1558
s 0x1558
@ -975,6 +1037,7 @@ NAME=arc4: [LPNZ] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx 02020030 @ 0x1580
s 0x1580
@ -990,6 +1053,7 @@ FILE=malloc://64
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=32
wx 017e1f102f420401 @ 0
wx 0afe5f60 @ 8
@ -1005,6 +1069,7 @@ NAME=ARC regs
FILE==
CMDS=<<EOF
e asm.arch=arc
e cfg.bigendian=false
e asm.bits=16
ar
EOF

View file

@ -3,6 +3,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
s main
af
afi~^size
@ -18,6 +19,7 @@ CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx dff80000 12000000 34000000
pd 1
EOF
@ -31,6 +33,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx dff80000 12000000 34000000
aes
ar r0
@ -45,6 +48,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx dff804c0 fc446047 18e0 0200
af
afi~size[1]
@ -60,6 +64,7 @@ CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 0149 014a 014b 0000 1111 2222 3333 4444 5555 6666
pd 3
EOF
@ -76,6 +81,7 @@ CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
e asm.emu=1
wx 0249 024a 024b 7944 7a44 7b44 1111 2222 3333 4444 5555 6666 7777
pd 6
@ -96,6 +102,7 @@ CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 10b5 01a0 00bf 00bf 52616461726532207465737420737472696e6700
pd 1 @ 0x2
EOF
@ -108,9 +115,10 @@ RUN
NAME=pd bits override for arm
FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bytes=true
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wa "mov r0, r0"
pi 1
pd 1
@ -143,6 +151,7 @@ CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 10b5 01a0 00bf 00bf 5261646172653220746573740d0a00
pd 1 @ 0x2
EOF
@ -201,9 +210,10 @@ RUN
NAME=ARM32 bb 0 size -- af
FILE=malloc://32
CMDS=<<EOF
wx ff0000e2010050e30000001affffffea70009de594008de5e4139fe500f09ee5
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx ff0000e2010050e30000001affffffea70009de594008de5e4139fe500f09ee5
af
#pdf
afb
@ -221,6 +231,7 @@ CMDS=<<EOF
wx 20c09fe5 0cc09ae7
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
# pd 2 - note different colors
pi 2
ao~type[1]
@ -243,6 +254,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx e59a9ae7
e cfg.bigendian=false
pi 1@ 0
@ -260,6 +272,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 2249224a
ao~^ptr
ao@ 2~^ptr
@ -277,6 +290,7 @@ e asm.bytes=true
e asm.calls=false
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 021081e0 1eff2f01 0020a0e3 1eff2fe1
af
pd 4
@ -296,6 +310,7 @@ FILE=malloc://512
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx fffffffa 04210924
af
pi 2 @ 4
@ -311,6 +326,7 @@ FILE=malloc://512
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e analysis.armthumb=true
wx 0910 a0e3 11ff 2fe1 0421 0924
aae
@ -343,6 +359,7 @@ wx 20c09fe5
wx 0cc09ae7 @ 4
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
# pd 2 - note different colors
pi 2
ao~type[1]
@ -365,6 +382,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx e59a9ae7
e cfg.bigendian=false
pi 1@ 0
@ -414,6 +432,7 @@ FILE=malloc://32
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 1f2003d5d0d8065800021fd61f2003d5
e analysis.nopskip=true
e analysis.jmp.after=false
@ -428,10 +447,11 @@ RUN
NAME=ARM64 bl capstone
FILE=malloc://32
CMDS=<<EOF
s 4
wx 07000094
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
s 4
wx 07000094
pi 1
ao~jump
EOF
@ -447,6 +467,7 @@ CMDS=<<EOF
wx 0d039fe5
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=false
e asm.offset=false
@ -464,6 +485,7 @@ CMDS=<<EOF
wx 0c009fe5
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=false
e asm.offset=false
@ -483,6 +505,7 @@ FILE=bins/elf/arm1.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=false
e asm.offset=false
@ -505,6 +528,7 @@ BROKEN=1
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=false
e asm.offset=false
@ -523,6 +547,7 @@ FILE=malloc://4
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e io.va=true
wx ffffffea # bl 0x80000000
om 3 0x7ffffffc
@ -694,6 +719,7 @@ FILE=bins/elf/arm1.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=false
e asm.offset=false
@ -720,6 +746,7 @@ BROKEN=1
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=false
e asm.offset=false
@ -751,6 +778,7 @@ FILE=malloc://1024
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx f0b503af2de9000d95b0002001210222032340f2040940f2050c40f2060e0724082509261490139112921193cdf80090cdf804c0cdf808e0039404950596ddf85080cdf81880ddf84ca0cdf81ca0ddf848b0cdf820b0ddf84480cdf82480cdf82890cdf82cc0cdf830e00d940e950f96fff740ff00211090084615b0bde8000df0bd
aa
afvl~var
@ -840,6 +868,7 @@ FILE=malloc://2048
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
e cfg.wseek=true
wx 01380793d3b24ff00109024600bf00bf00bf00bf59b2a1f120005a28139200f28d81404d02eb8004082601270122dfe810f09700850185015c0085015b008501850185018501a2
wx 0097008501ac007b008501af005d005d005d005d005d005d005d005d005d008501850185018501850185018501c300850185018501c3008501c30085018501850185019c008501
@ -999,6 +1028,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
ar=
EOF
EXPECT=<<EOF
@ -1106,6 +1136,7 @@ CMDS=<<EOF
wx 000090e50fe0a0e113ff2fe1000090e51eff2fe1
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
af
afi~size
EOF
@ -1130,6 +1161,7 @@ FILE=
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.pcalign
e asm.bits=16
e asm.pcalign
@ -1145,6 +1177,7 @@ FILE=malloc://0x1000
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
s 0x100
wx 54bf53f8182c52181846
pi 4
@ -1182,6 +1215,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 10402de90040a0e100e08fe214ff2fe11080bde8
af
pdf
@ -1347,6 +1381,7 @@ CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e cfg.bigendian=false
wx 864860f44d0fe2f4edffffeb04e02de500000000e08322e5f102030e0000a0e30230c1e7000053e3000201f10540d0e8f4800000
ao 13
echo ---

View file

@ -3,6 +3,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx e18f1394 # BL XXX
sd +4
wx 00013fd6 # BLR x8
@ -31,6 +32,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
e asm.os=linux
asn fstat
asr 80

View file

@ -2,6 +2,7 @@ NAME=avr DISasm: [0e940b10 => 0x00002016] (ANAL)
FILE=malloc://4096
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 0e940b10 @ 0x2d0
s 0x2d0
ao 1~^jump[1]
@ -15,6 +16,7 @@ NAME=avr DISasm: [0e940b10 => call] - jump check
FILE=malloc://4096
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
s 0x2d0
wx 0e940b10
ao 1~jump
@ -28,6 +30,7 @@ NAME=avr adiw/sbiw
FILE=malloc://4096
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 2a961a97
pd 2
EOF
@ -41,6 +44,7 @@ NAME=avr ld/ldd
FILE=malloc://4096
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx a984fc91a184
pd 3
EOF
@ -55,6 +59,7 @@ NAME=avr DISasm: [sts] - jump check
FILE=malloc://4096
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
s 0x2d0
wx 9093c007
ao 1~jump
@ -80,6 +85,7 @@ NAME=avr DISasm: opcode size
FILE==
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 0e941122
ao~size[1]
EOF
@ -249,6 +255,7 @@ FILE=malloc://1024
CMDS=<<EOF
wx 61f0 @ 0x136
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega8
pi 1 @ 0x136
ao 1 @ 0x136 ~^jump[1]
@ -264,6 +271,7 @@ FILE=malloc://1024
CMDS=<<EOF
wx e1f7 @ 0x14a
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega8
ao 1 @ 0x14a ~^jump[1]
EOF
@ -277,6 +285,7 @@ FILE=malloc://1024
CMDS=<<EOF
wx f0cf @ 0x14e
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega8
s 0x14e
ao 1 @ 0x14e ~^jump[1]
@ -291,6 +300,7 @@ FILE=malloc://1024
CMDS=<<EOF
wx 0c941234 @ 0x15e
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega8
ao 1 @ 0x15e~^jump[1]
EOF
@ -370,6 +380,7 @@ wx fec5 ffc5 00c6 01c6 7ec6 7fc6 80c6 81c6
wx fec6 ffc6 00c7 01c7 7ec7 7fc7 80c7 81c7
wx fec7 ffc7
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega640
aoe 66 @ 0
EOF
@ -455,6 +466,7 @@ wx 00cd 01cd 7ecd 7fcd 80cd 81cd fecd ffcd @ 0x1050
wx 00ce 01ce 7ece 7fce 80ce 81ce fece ffce @ 0x1060
wx 00cf 01cf 7ecf 7fcf 80cf 81cf fecf ffcf @ 0x1070
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega640
aoe 64 @ 0x1000
EOF
@ -530,6 +542,7 @@ NAME=avr functions 1
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aaa
axt @ 0x28a
EOF
@ -542,6 +555,7 @@ NAME=avr functions 2
FILE==
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 1895
ao 1~fam[1]
af
@ -752,6 +766,7 @@ NAME=avr search
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aaa
/ad call 0x4ec
EOF
@ -764,6 +779,7 @@ NAME=avr search - XXX dupped hit
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aaa
/ad call 0x4ec
EOF
@ -776,6 +792,7 @@ NAME=avr search 2
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aac @ 0
axt @ 0x4ec
EOF
@ -788,6 +805,7 @@ NAME=avr search 3
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aaa
axt @ 0x4ec
EOF
@ -800,6 +818,7 @@ NAME=detect false xrefs
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
e asm.bytes=true
e asm.lines=false
aar
@ -836,6 +855,7 @@ NAME=avr no warnings
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
s 0x2ee8
af
aae
@ -848,6 +868,7 @@ NAME=avr stop analysis when invalid instruction is found
FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aaa
fl
EOF
@ -1016,6 +1037,7 @@ FILE=bins/firmware/arduino_avr.bin
CMDS=<<EOF
e analysis.jmp.cref=true
e asm.arch=avr
e cfg.bigendian=false
e asm.cpu=ATmega168
aaa
s fcn.000005a2
@ -1093,6 +1115,7 @@ NAME=avr regs
FILE=
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
ar
EOF
EXPECT=<<EOF
@ -1147,6 +1170,7 @@ NAME=avr rjmp test
FILE==
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 0f94db6e8091bc1988231fc04090b4195090b5196090b6197090b7190f94e0514616
om 3 0x0003755c 64 0 rwx test_map
pd 10 @ 0x0003755c

View file

@ -310,13 +310,13 @@ FILE==
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=0
e cfg.bigendian=false
pa lui t9, 0x41
e cfg.bigendian=1
e cfg.bigendian=true
pa lui t9, 0x41
e cfg.bigendian=0
e cfg.bigendian=false
pad 4100193c
e cfg.bigendian=1
e cfg.bigendian=true
pad 3c190041
EOF
EXPECT=<<EOF
@ -386,6 +386,7 @@ wx 01001104
e asm.arch=mips
e asm.bits=32
e asm.cpu=mips3
e cfg.bigendian=false
e asm.nbytes=4
ao
EOF
@ -427,6 +428,7 @@ wx 0000000000000000010000100000000000000000
e asm.arch=mips
e asm.bits=32
e asm.nbytes=4
e cfg.bigendian=false
af+ fcn.test @ 0x80100000
afb+ 0x80100000 0x80100000 20
pif
@ -447,6 +449,7 @@ e asm.calls=false
e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
e analysis.nopskip=false
e asm.cmtcol=0
e asm.comments=false
@ -479,6 +482,7 @@ e asm.calls=false
e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
e asm.lines.bb=0
e asm.lines.fcn=false
e asm.nbytes=4
@ -516,6 +520,7 @@ e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e asm.cpu=mips4
e cfg.bigendian=false
e asm.nbytes=4
e asm.lines.bb=false
e asm.lines.fcn=false
@ -539,6 +544,7 @@ e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e asm.cpu=mips4
e cfg.bigendian=false
e asm.nbytes=4
e asm.lines.fcn=false
wx 0800e0030a1844000000000000000000000000
@ -563,6 +569,7 @@ e asm.arch=mips
e asm.bits=32
e asm.cpu=mips4
e asm.comments=false
e cfg.bigendian=false
e asm.nbytes=4
e asm.lines.bb=false
e asm.lines.fcn=false
@ -595,6 +602,7 @@ e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e asm.cpu=mips4
e cfg.bigendian=false
e asm.comments=false
e analysis.nopskip=false
e asm.nbytes=4
@ -627,6 +635,7 @@ e asm.calls=false
e asm.arch=mips
e asm.bits=32
e asm.cpu=mips4
e cfg.bigendian=false
e asm.comments=false
e asm.bytes=true
e analysis.nopskip=false
@ -660,6 +669,7 @@ e asm.calls=false
e asm.arch=mips
e asm.bits=32
e asm.cpu=mips4
e cfg.bigendian=false
e asm.comments=false
e analysis.nopskip=false
e asm.nbytes=4
@ -694,6 +704,7 @@ e asm.calls=false
e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
e asm.comments=0
e analysis.hasnext=1
e analysis.nopskip=1
@ -763,6 +774,7 @@ e asm.calls=false
e asm.bytes=true
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
e analysis.noncode=1
e asm.comments=0
e analysis.hasnext=1
@ -1246,6 +1258,7 @@ FILE==
CMDS=<<EOF
e asm.arch=mips
e asm.cpu=mips32r2
e cfg.bigendian=false
wx 20204401
ao
echo '==============='

View file

@ -2,6 +2,7 @@ NAME=pic regs
FILE=
CMDS=<<EOF
e asm.arch=pic
e cfg.bigendian=false
echo =============== midrange
e asm.cpu=midrange
ar
@ -123,6 +124,7 @@ NAME=pic18 functions
FILE=ihex://bins/pic18c/FreeRTOS-pic18c.hex
CMDS=<<EOF
e asm.arch=pic
e cfg.bigendian=false
e asm.cpu=highend
e asm.lines.call=true
aaa
@ -479,6 +481,7 @@ CMDS=<<EOF
e asm.arch=pic
e asm.cpu=baseline
e asm.lines.call=true
e cfg.bigendian=false
aaa
afl
agf @ 0x000000b0

View file

@ -572,6 +572,7 @@ FILE==
CMDS=<<EOF
e asm.arch=ppc
e asm.bits=64
e cfg.bigendian=false
wx f0ff2194
aoj~{}
EOF

View file

@ -9,34 +9,28 @@ EXPECT=<<EOF
EOF
RUN
NAME=jump with compress instruction
NAME=test instructions
FILE==
CMDS=<<EOF
e asm.arch=riscv
e asm.bytes=true
e asm.bits=32
e cfg.bigendian=false
echo --- jump with compress instruction
wx 21a001009d06aa858146
pd 5
echo --- branch with compress instruction
wx 11c182809d06f5fe0000
pd 5
EOF
EXPECT=<<EOF
--- jump with compress instruction
,=< 0x00000000 21a0 j 8
| 0x00000002 0100 nop
| 0x00000004 9d06 addi a3, a3, 7
| 0x00000006 aa85 mv a1, a0
`-> 0x00000008 8146 li a3, 0
EOF
RUN
NAME=branch with compress instruction
FILE==
CMDS=<<EOF
e asm.bytes=true
e asm.arch=riscv
e asm.bits=32
wx 11c182809d06f5fe
pd 5
EOF
EXPECT=<<EOF
--- branch with compress instruction
,=< 0x00000000 11c1 beqz a0, 4
.--> 0x00000002 8280 ret
:`-> 0x00000004 9d06 addi a3, a3, 7
@ -660,14 +654,85 @@ EOF
RUN
NAME=Vector instructions: symbol table
NAME=Vector instructions
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
echo --- symbol table
is
echo --- vector reductions
s 0x00010c56
pdf
echo --- vector sign injection
s 0x00011566
pdf
echo --- vector saturating
s 0x00011252
pdf
echo --- vector unsigned operations
s 0x00011900
pdf
echo --- vector minmax
s 0x000118ac
pdf
echo --- vector fused multiply-add
s 0x00011416
pdf
echo --- vector float operations
s 0x00011362
pdf
echo --- floating point operations
s 0x00011362
pdf
echo --- widening operations
s 0x000112e0
pdf
echo --- comparisons
s 0x0001106a
pdf
echo --- clipping
s 0x00011830
pdf
echo --- conversions
s 0x00011524
pdf
echo --- narrowing
s 0x0001133c
pdf
echo --- average
s 0x00011804
pdf
echo --- segment access
s 0x00011742
pdf
echo --- floating point comparisons
s 0x000114b8
pdf
echo --- multi byte
s 0x00011778
pdf
echo --- shifts
s 0x00011102
pdf
echo --- strided access
s 0x000115e2
pdf
echo --- absolute value and negation
s 0x00011862
pdf
echo --- main function
s 0x000105c0
pdf
echo --- madd
s 0x00011954
pdf
echo --- bitwise
s 0x000111ae
pdf
EOF
EXPECT=<<EOF
--- symbol table
nth paddr vaddr bind type size lib name
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5 ---------- 0x00013828 GLOBAL NOTYPE 0 __global_pointer$
@ -768,19 +833,7 @@ nth paddr vaddr bind type size lib name
6 0x000005a0 0x000105a0 GLOBAL FUNC 0 imp.printf
7 0x000005b0 0x000105b0 GLOBAL FUNC 0 imp.free
8 0x00000570 0x00010570 GLOBAL FUNC 0 imp.__libc_start_main
EOF
RUN
NAME=Vector instructions: vector reductions
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00010c56
pdf
EOF
EXPECT=<<EOF
--- vector reductions
: ; CALL XREF from main @ 0x10938
/ sym.test_reductions(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg5, int64_t arg6, int64_t arg_7fffffffffffffcfh, int64_t arg_7fffffffffffffd7h, int64_t arg_7fffffffffffffe7h, int64_t arg_7fffffffffffffefh, int64_t arg_7ffffffffffffff7h);
| : ; arg int64_t arg1 @ a0
@ -1111,19 +1164,7 @@ EXPECT=<<EOF
| : 0x00011060 130505a0 addi a0, a0, -0x600
| : 0x00011064 2961 addi sp, sp, 0xc0
\ `=< 0x00011066 6ff0afd3 j sym.imp.printf
EOF
RUN
NAME=Vector instructions: vector sign injection
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011566
pdf
EOF
EXPECT=<<EOF
--- vector sign injection
; CALL XREF from main @ 0x10a04
/ sym.test_sign_injection(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1172,19 +1213,7 @@ EXPECT=<<EOF
| : 0x000115dc 3696 add a2, a2, a3 ; arg3
| `=< 0x000115de 7df3 bnez a4, 0x115c4
\ 0x000115e0 8280 ret
EOF
RUN
NAME=Vector instructions: vector saturating
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011252
pdf
EOF
EXPECT=<<EOF
--- vector saturating
; CALL XREF from main @ 0x10960
/ sym.test_saturating(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg5, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1238,19 +1267,7 @@ EXPECT=<<EOF
| : 0x000112da 3696 add a2, a2, a3 ; arg3
| `=< 0x000112dc 71f7 bnez a4, 0x112a8
\ 0x000112de 8280 ret
EOF
RUN
NAME=Vector instructions: vector unsigned operations
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011900
pdf
EOF
EXPECT=<<EOF
--- vector unsigned operations
; CALL XREF from main @ 0x10b02
/ sym.test_unsigned_ops(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1287,19 +1304,7 @@ EXPECT=<<EOF
| : 0x0001194e 3696 add a2, a2, a3 ; arg3
| `=< 0x00011950 65f3 bnez a4, 0x11930
\ 0x00011952 8280 ret
EOF
RUN
NAME=Vector instructions: vector minmax
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x000118ac
pdf
EOF
EXPECT=<<EOF
--- vector minmax
; CALL XREF from main @ 0x10af8
/ sym.test_minmax(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1336,19 +1341,7 @@ EXPECT=<<EOF
| : 0x000118fa 3696 add a2, a2, a3 ; arg3
| `=< 0x000118fc 65f3 bnez a4, 0x118dc
\ 0x000118fe 8280 ret
EOF
RUN
NAME=Vector instructions: vector fused multiply-add
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011416
pdf
EOF
EXPECT=<<EOF
--- vector fused multiply-add
; CALL XREF from main @ 0x109a8
/ sym.test_fma(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1408,19 +1401,7 @@ EXPECT=<<EOF
| : 0x000114b0 ba96 add a3, a3, a4 ; arg4
| `=< 0x000114b2 e31c08fc bnez a6, 0x1148a
\ 0x000114b6 8280 ret
EOF
RUN
NAME=Vector instructions: vector float operations
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011362
pdf
EOF
EXPECT=<<EOF
--- vector float operations
; CALL XREF from main @ 0x1099c
/ sym.test_float_ops(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1488,18 +1469,7 @@ EXPECT=<<EOF
| : 0x00011410 3696 add a2, a2, a3 ; arg3
| `=< 0x00011412 79ff bnez a4, 0x113f0
\ 0x00011414 8280 ret
EOF
RUN
NAME=Vector instructions: floating point operations
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011362
pdf
EOF
EXPECT=<<EOF
--- floating point operations
; CALL XREF from main @ 0x1099c
/ sym.test_float_ops(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1567,18 +1537,7 @@ EXPECT=<<EOF
| : 0x00011410 3696 add a2, a2, a3 ; arg3
| `=< 0x00011412 79ff bnez a4, 0x113f0
\ 0x00011414 8280 ret
EOF
RUN
NAME=Vector instructions: widening operations
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x000112e0
pdf
EOF
EXPECT=<<EOF
--- widening operations
; CALL XREF from main @ 0x1096a
/ sym.test_widening(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg7, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1618,19 +1577,7 @@ EXPECT=<<EOF
| : 0x00011336 4296 add a2, a2, a6 ; arg3
| `=< 0x00011338 71ff bnez a4, 0x11314
\ 0x0001133a 8280 ret
EOF
RUN
NAME=Vector instructions: comparisons
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x0001106a
pdf
EOF
EXPECT=<<EOF
--- comparisons
; CALL XREF from main @ 0x10942
/ sym.test_comparisons(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1687,18 +1634,7 @@ EXPECT=<<EOF
| : 0x000110fc 3696 add a2, a2, a3 ; arg3
| `=< 0x000110fe 6df3 bnez a4, 0x110e0
\ 0x00011100 8280 ret
EOF
RUN
NAME=Vector instructions: clipping
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011830
pdf
EOF
EXPECT=<<EOF
--- clipping
/ sym.test_clip(int64_t arg1, int64_t arg2, int64_t arg5, int64_t arg6);
| ; arg int64_t arg1 @ a0
| ; arg int64_t arg2 @ a1
@ -1719,18 +1655,7 @@ EXPECT=<<EOF
| : 0x0001185c b695 add a1, a1, a3 ; arg2
| `=< 0x0001185e 6df3 bnez a4, 0x11840
\ 0x00011860 8280 ret
EOF
RUN
NAME=Vector instructions: conversions
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011524
pdf
EOF
EXPECT=<<EOF
--- conversions
/ sym.test_conversions(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6);
| ; arg int64_t arg1 @ a0
| ; arg int64_t arg2 @ a1
@ -1758,18 +1683,7 @@ EXPECT=<<EOF
| : 0x00011560 3696 add a2, a2, a3 ; arg3
| `=< 0x00011562 7df3 bnez a4, 0x11548
\ 0x00011564 8280 ret
EOF
RUN
NAME=Vector instructions: narrowing
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x0001133c
pdf
EOF
EXPECT=<<EOF
--- narrowing
/ sym.test_narrowing(int64_t arg1, int64_t arg2, int64_t arg6);
| ; arg int64_t arg1 @ a0
| ; arg int64_t arg2 @ a1
@ -1786,18 +1700,7 @@ EXPECT=<<EOF
| : 0x0001135c b695 add a1, a1, a3 ; arg2
| `=< 0x0001135e 6df3 bnez a4, 0x11340
\ 0x00011360 8280 ret
EOF
RUN
NAME=Vector instructions: average
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011804
pdf
EOF
EXPECT=<<EOF
--- average
/ sym.test_average(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg6);
| ; arg int64_t arg1 @ a0
| ; arg int64_t arg2 @ a1
@ -1817,18 +1720,7 @@ EXPECT=<<EOF
| : 0x0001182a 3696 add a2, a2, a3 ; arg3
| `=< 0x0001182c 65f3 bnez a4, 0x1180c
\ 0x0001182e 8280 ret
EOF
RUN
NAME=Vector instructions: segment access
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011742
pdf
EOF
EXPECT=<<EOF
--- segment access
/ sym.test_segment_access(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6);
| ; arg int64_t arg1 @ a0
| ; arg int64_t arg2 @ a1
@ -1851,18 +1743,7 @@ EXPECT=<<EOF
| : 0x00011770 ba96 add a3, a3, a4 ; arg4
| `=< 0x00011772 e31a08fc bnez a6, 0x11746
\ 0x00011776 8280 ret
EOF
RUN
NAME=Vector instructions: floating point comparisons
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x000114b8
pdf
EOF
EXPECT=<<EOF
--- floating point comparisons
; CALL XREF from main @ 0x109b2
/ sym.test_float_comparisons(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -1905,18 +1786,7 @@ EXPECT=<<EOF
| : 0x0001151e 3696 add a2, a2, a3 ; arg3
| `=< 0x00011520 71fb bnez a4, 0x114f4
\ 0x00011522 8280 ret
EOF
RUN
NAME=Vector instructions: multi byte
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011778
pdf
EOF
EXPECT=<<EOF
--- multi byte
/ sym.test_multi_byte(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg6);
| ; arg int64_t arg1 @ a0
| ; arg int64_t arg2 @ a1
@ -1935,18 +1805,7 @@ EXPECT=<<EOF
| : 0x0001179a 3696 add a2, a2, a3 ; arg3
| `=< 0x0001179c 65f3 bnez a4, 0x1177c
\ 0x0001179e 8280 ret
EOF
RUN
NAME=Vector instructions: shifts
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011102
pdf
EOF
EXPECT=<<EOF
--- shifts
; CALL XREF from main @ 0x1094c
/ sym.test_shifts(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg7);
| ; arg int64_t arg1 @ a0
@ -2009,18 +1868,7 @@ EXPECT=<<EOF
| : 0x000111a8 2e96 add a2, a2, a1 ; arg3
| `=< 0x000111aa 79f7 bnez a4, 0x11178
\ 0x000111ac 8280 ret
EOF
RUN
NAME=Vector instructions: strided access
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x000115e2
pdf
EOF
EXPECT=<<EOF
--- strided access
; CALL XREF from main @ 0x10a0c
/ sym.test_strided_access(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6);
| ; arg int64_t arg1 @ a0
@ -2131,18 +1979,7 @@ EXPECT=<<EOF
| : 0x0001173a 930e0040 li t4, 0x400
| : 0x0001173e 0148 li a6, 0
\ `===< 0x00011740 3db7 j 0x1166e
EOF
RUN
NAME=Vector instructions: absolute value and negation
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011862
pdf
EOF
EXPECT=<<EOF
--- absolute value and negation
; CALL XREF from main @ 0x10aee
/ sym.test_abs_neg(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6);
| ; arg int64_t arg1 @ a0
@ -2174,18 +2011,7 @@ EXPECT=<<EOF
| : 0x000118a6 b695 add a1, a1, a3 ; arg2
| `=< 0x000118a8 7df3 bnez a4, 0x1188e
\ 0x000118aa 8280 ret
EOF
RUN
NAME=Vector instructions: main function
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x000105c0
pdf
EOF
EXPECT=<<EOF
--- main function
; CODE XREF from loc.__wrap_main @
;-- section..text:
;-- .text:
@ -2743,18 +2569,7 @@ EXPECT=<<EOF
| 0x00010ba2 0145 li a0, 0
| 0x00010ba4 5561 addi sp, sp, 0x130
\ 0x00010ba6 8280 ret
EOF
RUN
NAME=Vector instructions: madd
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x00011954
pdf
EOF
EXPECT=<<EOF
--- madd
; CALL XREF from main @ 0x10b0e
/ sym.test_madd(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0
@ -2796,18 +2611,7 @@ EXPECT=<<EOF
| : 0x000119b6 ba96 add a3, a3, a4 ; arg4
| `=< 0x000119b8 e31c08fc bnez a6, 0x11990
\ 0x000119bc 8280 ret
EOF
RUN
NAME=Vector instructions: bitwise
FILE=bins/elf/riscv_vec_arith
CMDS=<<EOF
e asm.bytes=true
aaa
s 0x000111ae
pdf
EOF
EXPECT=<<EOF
--- bitwise
; CALL XREF from main @ 0x10956
/ sym.test_bitwise(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg6, int64_t arg8);
| ; arg int64_t arg1 @ a0

View file

@ -4,6 +4,7 @@ CMDS=<<EOF
e asm.arch=arm
e asm.bytes=true
e asm.bits=16
e cfg.bigendian=false
e asm.flags.inbytes=true
wx 10b50078114c06281ed2dfe800f01d1d030e1d150e480078002815d00d48a1690222bde81040fcf74dba0020e2f7aefb03220948a169f4e70020e2f7a7fbbde810400020fff7c2bf10bd0000bc0b0010a1010020c9e00508cdf8050870b5002500b10578e6f766f9691c884200d2002500211148eef72cf8e6f75cf90f4c98b165700120f7f718f961780170a0611820f7f712f9206105466178e2f7edfe2846bde87040eaf742bd002020700d206070bde87040f1f76cb9841c0708bc0b001008b506208df80000012269460148fcf7f9f908bd412a0608feb50446e6f72af910b1e6f727f9401e254a0623c0b251788df804102578062d0bd2dfe805f00a03
af

View file

@ -3,6 +3,7 @@ FILE==
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 3a8868037813690568237915783362650232c31072650352c5108723e437640c68037813
ao@ 0x1a~jump
EOF
@ -16,6 +17,7 @@ FILE=malloc://512
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 12c1f0d91140d382c9213d0d093101f5ebc00000cd028c820c034d0d0112e4c0000008312d0cd811c82112c1100df0
af
afvl
@ -33,6 +35,7 @@ FILE=malloc://512
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 00000000ff11ff1121ffff0df0ff
pD 3 @ 8
EOF

View file

@ -124,6 +124,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
e asm.cpu=cortexA8
wx 2f6c642d
aoj~{[0].disasm}

View file

@ -114,6 +114,8 @@ RUN
NAME=avgp - print global variable value
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 40102030405050230590909090
w alfdjsdfgkjdhfgkdghdfgdfg @ 0x20
avga foo int @ 0x10

View file

@ -2,6 +2,7 @@
NAME=basefind via rizin
FILE=bins/firmware/stm32f103-dapboot-v1.20-bluepill.bin
CMDS=<<EOF
e asm.arch=x86
e basefind.max.threads=1
e basefind.search.start=0x06000000
e basefind.search.end=0x10000000

View file

@ -703,6 +703,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
s 0x100
wx f80202a9
f flag_name

View file

@ -68,6 +68,7 @@ RUN
NAME=pCx
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 55aa55aa909055aa9090ff20000ffffffff55fffffaaffffffffff
pCx 5
EOF
@ -84,6 +85,7 @@ RUN
NAME=pCw
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 55aa55aa909055aa9090ff20000ffffffff55fffffaaffffffffff
pCw 4
EOF

View file

@ -189,6 +189,7 @@ e asm.bytes=true
e asm.sub.names=1
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx fa67bba9
pd 1
@ -198,21 +199,6 @@ EXPECT=<<EOF
EOF
RUN
NAME=asm.sub.names issue
FILE=malloc://1024
CMDS=<<EOF
e asm.sub.names=0
e asm.bytes=true
e asm.arch=arm
e asm.bits=64
wx fa67bba9
pd 1
EOF
EXPECT=<<EOF
0x00000000 fa67bba9 stp x26, x25, [sp, -0x50]!
EOF
RUN
NAME=asm.sub.names issue #6752
FILE=malloc://1024
CMDS=<<EOF

View file

@ -22,6 +22,7 @@ FILE=malloc://1024
CMDS=<<EOF
e asm.bytes=true
e asm.arch=mips
e cfg.bigendian=false
e analysis.gpfixed=false
wx 10000824cc009c270500281500000000200c082521401c010a00000800000000300c082521401c010800e003
af

View file

@ -1,6 +1,8 @@
NAME=pf QeQ
FILE==
CMDS=<<EOF
e asm.arch=arm
e cfg.bigendian=false
b 256
woe 0 255 0x11
e cfg.bigendian=false
@ -79,6 +81,7 @@ RUN
NAME=seteq
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfn foo "xd foo bar"
pf. foo
EOF
@ -91,11 +94,13 @@ RUN
NAME=float
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=arm
e cfg.bigendian=false
wx 00007a45457a0000
e cfg.bigendian=0
e cfg.bigendian=false
pf ff
wx 00007a45457a0000
e cfg.bigendian=1
e cfg.bigendian=true
pf ff
EOF
EXPECT=<<EOF
@ -109,6 +114,7 @@ RUN
NAME=seteq2
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfn foo "xd foo bar"
pf. foo
EOF
@ -121,6 +127,7 @@ RUN
NAME=types
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 00007a452a4b9a0200002a
pf fcbiC foo bar fool beer plop
EOF
@ -136,6 +143,7 @@ RUN
NAME=word types
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx efbeadde002a0000adde
pf qw bigWord beef
EOF
@ -148,6 +156,7 @@ RUN
NAME=uleb type
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx e58e26
pf u ulebtest
wx 00000000e58e258e2525 @ 0x10
@ -170,6 +179,7 @@ RUN
NAME=Register
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
e asm.arch=x86
e analysis.arch=x86
@ -189,6 +199,7 @@ RUN
NAME=Pointers
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 30
wx 20 @ 0x04
wx 40 @ 0x08
@ -209,6 +220,7 @@ RUN
NAME=Pointer sizes
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx added0dec0de5eba7ada1eab11caefbeadde0bb0
pf p2p4p8pp2
@ -225,6 +237,7 @@ RUN
NAME=swap endianess
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx deadbeef00000000adde
pf eqew bigWord beef
EOF
@ -237,6 +250,7 @@ RUN
NAME=String pointer
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
w TROLL @ 0x30
wx 30
wx a00f @ 0x04
@ -252,6 +266,7 @@ RUN
NAME=timestamp
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 321ED92D90DF5254
pf tt troll plop
EOF
@ -264,6 +279,7 @@ RUN
NAME=named obj
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx a00f00004b
pfn troll "ic lol cat"
pf. troll
@ -277,6 +293,7 @@ RUN
NAME=array obj
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx a00f00004b2a0000004c
pfn troll "2ic nb plop"
pf. troll
@ -296,6 +313,7 @@ RUN
NAME=write test
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 32000000424c41424c41424c41424c41
pfn troll "izi hu swagg plop"
.pfw troll.hu 42
@ -313,6 +331,7 @@ RUN
NAME=write wide string
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 42004c00410042004c00410042004c00410042004c0041000000a00f0000
pfn troll "Zi swagg plop"
pf. troll
@ -331,6 +350,7 @@ RUN
NAME=fixed size variable
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx a00f0000000000002a412f00007a4500000000402a44adde00000000efbeadde00000000000000000000000040
pf [2]i[3]b[2]f[3]c[3]w[2]q[6]x
EOF
@ -348,6 +368,7 @@ RUN
NAME=fixed size str, widechar, and var
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
w TROLL
wx 12 @ 0x02
wx a00f @ 0x0a
@ -366,6 +387,7 @@ RUN
NAME=Enum test
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
td enum troll { BITE=42, PATE=4000};
wx a00f
@ -379,6 +401,7 @@ RUN
NAME=32 bit twice then string
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wv 0x10
wv 0x10 @ 4
@ -400,6 +423,7 @@ RUN
NAME=simple union test
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wv 0x2a
pf 0iw integer word
@ -413,6 +437,7 @@ RUN
NAME=simple nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 2a
wx a00f @ 0x04
@ -441,6 +466,7 @@ RUN
NAME=nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 2a000000a00f00001234100000006416
wx 2a0000002a @ 0x10
@ -466,6 +492,7 @@ RUN
NAME=nested unions
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 2a000000a00f0000a02000000172
pfn struct "xx first second"
@ -490,6 +517,7 @@ RUN
NAME=complex nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 341289679a020000a00f00002a003000000014426416
wx 800600000040 @ 0x20
@ -526,6 +554,7 @@ RUN
NAME=flag for nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 341289679a020000a00f00002a00300000001442
wx 800600000040 @ 0x20
@ -561,6 +590,7 @@ RUN
NAME=struct size
FILE=malloc://256
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
pfn plop "wi word int"
pfn troll "bciwqfdoxs:S.[4]z[2]B[4]E? byte char int word quad float hexa octal hex strp wstrp str bitfield enum (plop)struct"
@ -575,6 +605,7 @@ NAME=Print value only
FILE=bins/pe/ch22.exe
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
s 0x80
pfv .pe_nt_image_headers32.optionalHeader.dataDirectory[5].virtualAddress
@ -587,6 +618,7 @@ RUN
NAME=print signed and unsigned values
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 71776572747975696f706173646667686a6b6c7a786376626e6d71776572747975696f706173646667686a6b6c7a786376626e6d
pf N8..N4.N2:N1..n8..n4n2n1 a b c d e f
EOF
@ -605,6 +637,7 @@ RUN
NAME=Combining flags, backtick, and var length array
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
f test 4 @ 0x20
w SWAG
@ -623,6 +656,7 @@ RUN
NAME=print n-times a format
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 71776572747975696f706173646667686a6b6c7a786376626e6d71776572747975696f706173646667686a6b6c7a786376626e6d
pfn plop "ip int ptr"
@ -643,6 +677,7 @@ RUN
NAME=print with byte(s) skip
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=64
wx 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
pfn abc "ic...i:pii a b c d e f"
@ -662,6 +697,7 @@ NAME=PE test
FILE=bins/pe/ch22.exe
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
s 0x80
pf. pe_nt_image_headers32
EOF
@ -780,6 +816,7 @@ RUN
NAME=Variable length array
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 2a @ 0x20
pf [*0x20]c
@ -794,6 +831,7 @@ RUN
NAME=Infinite Recursion segfault 1
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfn _NT_TIB "? (_NT_TIB)Self"
pf. _NT_TIB > /dev/null
pfn~NT_TIB
@ -806,6 +844,7 @@ RUN
NAME=Infinite Recursion segfault 2
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfn _NT_TIB "pppppip? ExceptionList StackBase StackLimit SubSystemTib FiberData Version ArbitraryUserPointer (_NT_TIB)Self"
pf. _NT_TIB > /dev/null
pfn~NT_TIB
@ -819,6 +858,7 @@ NAME=One byte enum endianness
BROKEN=1
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=arm
e cfg.bigendian=true
wb 4142434431323334
td "enum ascii{ LETTER_A=0x41, LETTER_D=0x44, DIGIT_1=0x31, DIGIT_4=0x34}"
@ -840,6 +880,7 @@ RUN
NAME=union pf
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wv4 1234
pf "i;i"
pf "i,,,,i"
@ -868,6 +909,7 @@ RUN
NAME=pf z, scr.strconv and str.escbslash
FILE==
CMDS=<<EOF
e asm.arch=x86
wz \x7fabc\\123\n
(print strconv escbslash; e scr.strconv=${strconv}; e str.escbslash=${escbslash}; pf z)
.(print asciiesc false)
@ -886,6 +928,7 @@ RUN
NAME=pfj and triply-nested struct
FILE==
CMDS=<<EOF
e asm.arch=x86
wv2 0x1234
wv4 0x56789abc @ 0x2
wv8 0xdef0123456789abc @ 0x6
@ -945,6 +988,7 @@ RUN
NAME=pfj and Matryoshka dolls
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 7f
wv8 0xdef0123456789abc @ 0x1
pfn fourth "b fo1"

View file

@ -1,7 +1,9 @@
NAME=PE JSON test
FILE=bins/pe/ch22.exe
ARGS=-e asm.bits=32 -nn
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
s 0x80
pfj pe_nt_image_headers32
EOF
@ -15,6 +17,7 @@ RUN
NAME=JSON output
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 341289679a020000a00f00002a003000000014426416
wx 800600000040 @ 0x20
@ -32,6 +35,7 @@ RUN
NAME=access specific element through nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 341289679a020000a00f00002a003000000014426416
wx 800600000040 @ 0x20
@ -57,6 +61,7 @@ RUN
NAME=access specific element in an array
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx a00f0000adde @ 0x10
pfn plop "iwqw one two three four"
@ -85,6 +90,7 @@ NAME=Complex request with specific array element and specific field
FILE=bins/pe/ch22.exe
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
s 0x80
pf. pe_dos_header.e_res[2]
@ -99,6 +105,7 @@ RUN
NAME=write specific element through nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 341289679a020000a00f00002a003000000014426416
wx 800600000040 @ 0x20
@ -141,6 +148,7 @@ RUN
NAME=print anonymous nested struct
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
wx 71776572747975696f706173646667686a6b6c7a786376626e6d71776572747975696f706173646667686a6b6c7a786376626e6d
pfn dsf "ii a b"
@ -177,7 +185,10 @@ RUN
NAME=pf field name
FILE=malloc://1024
CMDS=pf 2x x2
CMDS=<<EOF
e asm.arch=x86
pf 2x x2
EOF
EXPECT=<<EOF
0x00000000 [0] {
x2 : 0x00000000 = 0x00000000
@ -191,8 +202,10 @@ RUN
NAME=pf *z (64bit addr)
FILE==
CMDS=<<EOF
e io.cache=true
e asm.arch=arm
e asm.bits=64
e io.cache=true
e cfg.bigendian=false
wz root @ 0x0000000100000faf
pf z @ 0x0000000100000faf
e cfg.bigendian=false
@ -214,6 +227,7 @@ RUN
NAME=pf F max precision (#13027)
FILE==
CMDS=<<EOF
e asm.arch=x86
wv8 0x400921fb54442d18
pf F
echo
@ -232,6 +246,7 @@ RUN
NAME=pf f max precision
FILE==
CMDS=<<EOF
e asm.arch=x86
wv4 0x40490fdb
pf f
EOF
@ -243,6 +258,7 @@ RUN
NAME=pfj z not-at-start fix
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 46
wz ABCDE @ 0x1
pf bz
@ -258,6 +274,7 @@ RUN
NAME=pf/pfj z with size
FILE==
CMDS=<<EOF
e asm.arch=x86
wz ABCDE
(pf2 format; pf ${format}; pfj ${format})
.(pf2 z)
@ -282,6 +299,7 @@ NAME=pf z overflow
FILE=malloc://2048
ARGS=-m 1000
CMDS=<<EOF
e asm.arch=x86
e io.cache=false
echo --- io.unalloc = true ---
echo
@ -353,6 +371,7 @@ NAME=pfj z overflow
FILE=malloc://2048
ARGS=-m 1000
CMDS=<<EOF
e asm.arch=x86
e io.unalloc=true
s 3046
w AB
@ -375,17 +394,14 @@ RUN
NAME=pfn
FILE==
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pfn elf_header
pfn cat_sat_on_keyboard
EOF
EXPECT=<<EOF
?[2]E[2]E[4]ExxxxN2N2N2N2N2N2 (elf_ident)ident (elf_type)type (elf_machine)machine (elf_obj_version)version entry phoff shoff flags ehsize phentsize phnum shentsize shnum shstrndx
EOF
RUN
NAME=pfn format not defined
FILE==
CMDS=pfn cat_sat_on_keyboard
EXPECT_ERR=<<EOF
ERROR: Format with "cat_sat_on_keyboard" name not found
EOF
@ -395,6 +411,7 @@ NAME=-nn filename with @
FILE=bins/elf/analysis/tiny1@invalid_addr
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
e io.va=0
pf. elf_header @ elf_header
EOF

View file

@ -1,6 +1,7 @@
NAME=32: Elf header size
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pfs elf_header
EOF
@ -12,6 +13,7 @@ RUN
NAME=64: Elf header size
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf64
pfs elf_header
EOF
@ -23,6 +25,7 @@ RUN
NAME=32: Elf program header size
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pfs elf_phdr
EOF
@ -34,6 +37,7 @@ RUN
NAME=64: Elf program header size
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf64
pfs elf_phdr
EOF
@ -45,6 +49,7 @@ RUN
NAME=32: Elf section header size
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pfs elf_shdr
EOF
@ -56,6 +61,7 @@ RUN
NAME=64: Elf section header size
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf64
pfs elf_shdr
EOF
@ -67,6 +73,7 @@ RUN
NAME=32: Multiple section headers
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pf "[2]? (elf_shdr)sections"
EOF
@ -103,6 +110,7 @@ RUN
NAME=64: Multiple section headers
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
pfo elf64
pf "[2]? (elf_shdr)sections"
EOF
@ -138,7 +146,7 @@ RUN
NAME=Issue 5640 pfj produce wrong json
FILE=bins/elf/analysis/main
ARGS=-nn
ARGS=-nn -a x86
CMDS=pfj {1}? (elf_phdr) @ 0x0000000000000040
EXPECT=<<EOF
[{"name":"","type":"elf_phdr","offset":64,"value":[{"name":"type","type":"E","offset":64,"value":6,"label":"PT_PHDR","enum":"elf_p_type"},{"name":"flags","type":"E","offset":68,"value":5,"label":"PF_Read_Exec","enum":"elf_p_flags"},{"name":"offset","type":"q","offset":72,"value":64},{"name":"vaddr","type":"q","offset":80,"value":4194368},{"name":"paddr","type":"q","offset":88,"value":4194368},{"name":"filesz","type":"q","offset":96,"value":448},{"name":"memsz","type":"q","offset":104,"value":448},{"name":"align","type":"q","offset":112,"value":8}]}]
@ -148,6 +156,7 @@ RUN
NAME=32: Elf header
FILE=bins/elf/analysis/tiny1
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pf. elf_header @ 0x8048000
EOF
@ -177,6 +186,7 @@ RUN
NAME=64: Elf header
FILE=bins/elf/analysis/x64-simple
CMDS=<<EOF
e asm.arch=x86
pfo elf64
pf. elf_header @ `i~baddr[1]`
EOF
@ -207,6 +217,7 @@ NAME=32: -nn elf header
FILE=bins/elf/analysis/tiny1
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
e io.va=0
pf. elf_header @ elf_header
echo
@ -363,6 +374,7 @@ NAME=64: -nn elf header
FILE=bins/elf/analysis/x64-simple
ARGS=-nn
CMDS=<<EOF
e asm.arch=x86
e io.va=0
pf. elf_header @ elf_header
EOF
@ -392,6 +404,7 @@ RUN
NAME=pf elf_header times fix
FILE==
CMDS=<<EOF
e asm.arch=x86
pfo elf32
pfn elf_header
pfs elf_header

View file

@ -64,6 +64,7 @@ RUN
NAME=pf xxd print happy
FILE==
CMDS=<<EOF
e asm.arch=x86
pfn foo "xxd foo bar cow"
w hello happy world
e asm.lines=0

View file

@ -18,6 +18,7 @@ RUN
NAME=pfd test E (elf_type)var0
FILE==
CMDS=<<EOF
e asm.arch=x86
td "enum elf_type {ET_HIPROC=0xffff};"
wx 0xffff
pfn test "E (elf_type)var0"

View file

@ -39,6 +39,7 @@ RUN
NAME=plf big function
FILE=malloc://10240
CMDS=<<EOF
e asm.arch=x86
. bins/arm/arm64_rzil_test.rz
aaa
plf

View file

@ -1,6 +1,9 @@
NAME=pointer read
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wv8 0xdeadbeefdeadbeef
*0
*0 @e:asm.bits=64
@ -22,6 +25,9 @@ RUN
NAME=pointer write value
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx ffffffffffffffff
*0=0xdeadbeefdeadbeef
*0 @e:asm.bits=64
@ -58,6 +64,8 @@ RUN
NAME=pointer write hex
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=arm
e cfg.bigendian=false
wx ffffffffffffffff
*0+2=addeefbe
*0 @e:asm.bits=64

View file

@ -2,6 +2,7 @@ NAME=ps+ libc++ 32bit
FILE=bins/elf/stdstring32-libc++.LOAD1
ARGS=-n -m 0x08049ee8
CMDS=<<EOF
e asm.arch=x86
on bins/elf/stdstring32-libc++.heap 0x09eb8000 > /dev/null
f obj.empty_str 12 @ 0x0804a064
f obj.long_str1 12 @ 0x0804a04c
@ -28,6 +29,7 @@ NAME=ps+ libc++ 64bit
FILE=bins/elf/stdstring64-libc++.LOAD1
ARGS=-n -m 0x00600dc8
CMDS=<<EOF
e asm.arch=x86
on bins/elf/stdstring64-libc++.heap 0x0128b000 > /dev/null
f obj.empty_str 24 @ 0x006010b8
f obj.long_str1 24 @ 0x00601088

View file

@ -107,6 +107,7 @@ RUN
NAME=pxdw 16
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 1020ffff30400000
pxdw 16
EOF
@ -119,6 +120,7 @@ RUN
NAME=pxdw 8
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wx 1020ffff30400000
pxdw 8
EOF
@ -131,6 +133,7 @@ RUN
NAME=pxH
FILE=bins/elf/sse2-add
CMDS=<<EOF
e asm.arch=x86
s 0x00000708
pxH 0x6
e hex.section=true

View file

@ -1,93 +1,50 @@
NAME=pxd
NAME=pxd commands
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 554889e54157415641554154534881ec
pxd 0x10
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 85 72 -119 -27 65 87 65 86 65 85 65 84 83 72 -127 -20 UH..AWAVAUATSH..
EOF
RUN
NAME=pxdh
FILE==
CMDS=<<EOF
wx 554889e54157415641554154534881ec
echo ---
pxdh 0x10
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 18517 -6775 22337 22081 21825 21569 18515 -4991 UH..AWAVAUATSH..
EOF
RUN
NAME=pxdw
FILE==
CMDS=<<EOF
wx 554889e54157415641554154534881ec
echo ---
pxdw 0x10
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 1413567809 -327071661 UH..AWAVAUATSH..
EOF
RUN
NAME=pxdq
FILE==
CMDS=<<EOF
wx 554889e54157415641554154534881ec
echo ---
pxdq 0x10
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 6215344901283465301 -1404762086029830847 UH..AWAVAUATSH..
EOF
RUN
NAME=pxdw arg
FILE==
CMDS=<<EOF
wx 554889e54157415641554154534881ec
echo ---
pxdw 0x10
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 1413567809 -327071661 UH..AWAVAUATSH..
EOF
RUN
NAME=pxdw no arg
FILE==
CMDS=<<EOF
echo ---
wx 00000000000000000000000000000000
b 0x10
wx 554889e54157415641554154534881ec
pxdw
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 1413567809 -327071661 UH..AWAVAUATSH..
EOF
RUN
NAME=pxd zero arg
FILE==
CMDS=<<EOF
echo ---
b 0x100
wx 554889e54157415641554154534881ec
pxd 0
EOF
EXPECT=
RUN
NAME=pxdw negative arg
FILE==
CMDS=<<EOF
wx 554889e54157415641554154534881ec
echo ---
s 8
pxdw -8
EOF
EXPECT=<<EOF
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 85 72 -119 -27 65 87 65 86 65 85 65 84 83 72 -127 -20 UH..AWAVAUATSH..
---
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 18517 -6775 22337 22081 21825 21569 18515 -4991 UH..AWAVAUATSH..
---
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 1413567809 -327071661 UH..AWAVAUATSH..
---
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 6215344901283465301 -1404762086029830847 UH..AWAVAUATSH..
---
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 1413567809 -327071661 UH..AWAVAUATSH..
---
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 1413567809 -327071661 UH..AWAVAUATSH..
---
---
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000 -443987883 1447122753 UH..AWAV
EOF

View file

@ -396,6 +396,7 @@ NAME=search rop for AVR
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
e scr.color=false
wx 11241fbecfefd8e0debfcdbf12e0a0e0b1e0e6e3f4e302c005900d92a431b107d9f722e0a4e1b2e001c01d92ae3cb207e1f710e0c2e6d0e004c02197fe010e94041ac136d107c9f70e944f090c9456160c940000ef92ff920f931f93cf93df93cdb7deb7c054d1090fb6f894debf0fbecdbf6ce071e08fe192e00e946b04ce0101967c018e010f5c1f4ffc011192e017f107e1f720e330e0a7016ae08fe192e00e94d8080297f8f0c801d701fd01ee19ff092d91222321f0fc012193cf01f6cfe00ff11f108260e071e0c8010e949816892b49f46de171e08fe192e00e946b0481e090e008c066e471e08fe192e00e946b0480e090e0c05cdf4f0fb6f894debf0fbecdbfdf91cf911f910f91ff90ef9008956de671e08fe192e00e946b0485b1805885b908956fe771e08fe192e00e946b048bb180588bb908956de671e08fe192e00e946b0485b1805885b985b1805885b985b1805885b908956fe771e08fe192e00e946b048bb180588bb98bb180588bb98bb180588bb908950f931f93cf93df93cdb7deb727970fb6f894debf0fbecdbf9c018e010f5f1f4fd801ad01401b510bf90191919f01992311f09d93f6cffa01e00ff11f10826fe871e0c8010e949816892b81f40e948c00892bf9f027960fb6f894debf0fbecdbfdf91cf911f910f910c940f0163e971e0c8010e949816892b61f427960fb6f894debf0fbecdbf
/R ldi
@ -609,6 +610,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rs "=0"
EOF
EXPECT=<<EOF
@ -702,6 +704,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rs "<0x2000"
EOF
EXPECT=<<EOF
@ -795,6 +798,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rs "<=0x2000"
EOF
EXPECT=<<EOF
@ -2382,6 +2386,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rl "=4"
echo "================================"
/R | grep -A 8 0x00000900
@ -2454,6 +2459,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rl "<10"
echo "================================"
/R | grep -A 8 0x00000900
@ -2548,6 +2554,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rl "<=10"
echo "================================"
/R | grep -A 8 0x00000900
@ -2675,6 +2682,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rl ">10"
echo "================================"
/R | grep -A 8 0x000010cc
@ -2774,6 +2782,7 @@ FILE=bins/arm/crackme.arm32.bin
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
/Rl ">=10"
echo "================================"
/R | grep -A 8 0x000010cc

View file

@ -240,6 +240,7 @@ RUN
NAME=/vj 4a search 4 byte in range with json
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 0x12345678aabbccddeeff12345678
/vj 4a [0x78563412,0x78563420]
EOF

View file

@ -289,6 +289,7 @@ RUN
NAME=wv
FILE==
CMDS=<<EOF
e asm.arch=x86
wv1 0x55
pv4
wv2 0x7733

View file

@ -33,6 +33,7 @@ RUN
NAME=wD/ 0x41417641
FILE==
ARGS=-a x86
CMDS=wD/ 0x41417641
EXPECT=<<EOF
140

View file

@ -1,6 +1,7 @@
NAME=use after free - requires asan
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
0
~[[0
EOF
@ -10,6 +11,7 @@ RUN
NAME=sum flags
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
f foo @ 2
f bar @ 4
%v bar/foo
@ -22,6 +24,7 @@ RUN
NAME=div $$
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
%v 10/2
%v $$/2@ 10
EOF
@ -34,6 +37,7 @@ RUN
NAME=div [0]
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
wv 10
%v [0]/2
%v $$/2@ [0]
@ -47,6 +51,7 @@ RUN
NAME=basic
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=x86
%v 0x10+0x30
%v 1+3*2
%v (1+3)*2
@ -61,6 +66,7 @@ RUN
NAME=sum
FILE==
CMDS=<<EOF
e asm.arch=x86
f a@ 3
%v a+3
%v a +3
@ -78,6 +84,7 @@ RUN
NAME=binary
FILE==
CMDS=<<EOF
e asm.arch=x86
echo
!rz-ax Bxff3f0000fcff
!rz-ax Bxff3ffcff
@ -92,6 +99,7 @@ RUN
NAME=invalid nums
FILE==
CMDS=<<EOF
e asm.arch=x86
e scr.interactive=true
s beach; s
s batch; s

View file

@ -16,6 +16,7 @@ RUN
NAME="p8|sed -e s,1,x,g>x;cat x;rm x"
FILE=malloc://512
CMDS=<<EOF
e asm.arch=x86
wv 0x100
p8 8| sed -e s,1,x,g>x;!dos2unix x;cat x;rm x
EOF

View file

@ -175,6 +175,7 @@ RUN
NAME=format memory metadata
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 41424344
Cf 4 x
pd 1

View file

@ -1,8 +1,9 @@
NAME=endian tests: pv4
FILE==
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 01020304
pv4
e cfg.bigendian=true
@ -17,8 +18,9 @@ RUN
NAME=endian tests: pv2
FILE==
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 01020304
pv2
e cfg.bigendian=true
@ -33,8 +35,9 @@ RUN
NAME=endian tests: pv8
FILE==
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 0102030405060708
pv8
e cfg.bigendian=true
@ -49,8 +52,9 @@ RUN
NAME=endian tests: %v
FILE==
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 01020304
%v [$$]
e cfg.bigendian=true
@ -65,6 +69,7 @@ RUN
NAME=pfq
FILE==
CMDS=<<EOF
e asm.arch=x86
wv4 32
pfq i
EOF

View file

@ -844,6 +844,7 @@ RUN
NAME=tp struct
FILE==
CMDS=<<EOF
e asm.arch=x86
td "struct person { int age; char name[10]; }"
s 14
w Carlos
@ -865,6 +866,7 @@ FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
td "union bla { int a; int b; float c; }"
td "struct foo { union poo { int a; int b; long long c; } q; char *p; }"
td "struct alb { int a; union moo { int t; char b; long long c; } f; void *goo; }"
@ -939,7 +941,7 @@ RUN
NAME=tpv
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
td "struct s16ui { uint16_t a_u; int16_t b_i; uint16_t c_u; int16_t d_i;}"
@ -1086,6 +1088,7 @@ RUN
NAME=tpx test
FILE==
CMDS=<<EOF
e asm.arch=x86
td "struct foo {char* a; int b;}"
tpx foo 41414141441414141414420010000000
EOF
@ -1101,6 +1104,7 @@ CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=32
e cfg.bigendian=false
wx 082090e5040081e5
td "struct foo {int a; int b; int c;};"
aht foo.c @ 0x00000000
@ -1123,6 +1127,7 @@ FILE==
CMDS=<<EOF
e asm.bytes=true
e asm.arch=mips
e cfg.bigendian=false
wx 08007fac040053800800538c
td "struct foo {int a; int b; int c;};"
aht foo.c @ 0x00000000
@ -2272,6 +2277,7 @@ RUN
NAME=td uint64_t
FILE==
CMDS=<<EOF
e asm.arch=x86
wx 0xa00f
wx 0x401f @ 0x4
wx 0800000000000080 @ 0x8

View file

@ -250,7 +250,7 @@ RUN
NAME=endian tests: wv
FILE==
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=x86
e asm.bits=32
wv4 3
p8 4
@ -267,7 +267,7 @@ RUN
NAME=wv endian
FILE=malloc://1024
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=x86
wv4 0x1234
p8 2
wv4 0x12345678
@ -282,7 +282,7 @@ RUN
NAME=wx 0x
FILE=malloc://1024
CMDS=<<EOF
e cfg.bigendian=false
e asm.arch=x86
wx 0x1234
p8 2
wx 0x12345678

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
e io.cache=true
s 0x0008735c
wx 30a1
@ -23,6 +24,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wa "clz r0, r1"
ar r1=0x80000000
aes
@ -47,6 +49,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
e io.cache=true
s 0x00088a1c
wx 0ff26c71
@ -67,6 +70,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
aei
aeim
ar sp=0x00108000
@ -85,6 +89,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
aei
aeim
ar sp=0x00108000
@ -104,6 +109,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
aei
aeim
ar sp=0x00108000
@ -124,6 +130,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
aei
aeim
ar sp=0x00108000
@ -144,6 +151,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r0=4
ar r1=2
@ -162,6 +170,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=8
# put value at r1 into r2 and at r1+4 into r3
wx d1e90023 # ldrd r2,r3,[r1]
@ -182,6 +191,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=4
# put value at r1+4 into r2 and at r1+4+4 into r3
wx d1e90123 # ldrd r2,r3,[r1, 4]
@ -202,6 +212,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
# put value at pc+4 into r2 and at pc+4+4 into r3
wx dfe90223 # ldrd r2, r3, [pc, #8]
wx ddccbbaa @ 12
@ -221,6 +232,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=4
# put value at r1+4 into r2 and at r1+4+4 into r3 then put r1+4 into r1
wx f1e90123 # ldrd r2, r3, [r1, #4]!
@ -243,6 +255,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=8
# put value at r1 into r2 and at r1+4 into r3 then put r1+4 into r1
wx f1e80123 # ldrd r2,r3,[r1], 4
@ -265,6 +278,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r3=4 # address
ar r1=0 # init with dummy values
@ -288,6 +302,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=4 # address
ar r5=0xaabbccdd
wx 20c1
@ -306,6 +321,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r2=4 # address
ar r1=0x11111111
@ -328,6 +344,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r0=0x11223344
wx c0f30722
@ -344,6 +361,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 08bf
aoe
EOF
@ -357,6 +375,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 18bf00000000
aoe
EOF
@ -370,6 +389,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 28bf00000000
aoe
EOF
@ -383,6 +403,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 38bf00000000
aoe
EOF
@ -396,6 +417,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 48bf00000000
aoe
EOF
@ -409,6 +431,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 58bf00000000
aoe
EOF
@ -422,6 +445,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 68bf00000000
aoe
EOF
@ -435,6 +459,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 78bf00000000
aoe
EOF
@ -448,6 +473,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx e8bf00000000
aoe
EOF
@ -461,6 +487,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r3=1
ar r1=2
wx 5a58aabbccddeeff
@ -477,6 +504,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r1=0x80000001
ar r2=0x1
@ -501,6 +529,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r1=-8
ar r2=2
@ -525,6 +554,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar > /dev/null
ar r4=-8
wx a410
@ -541,6 +571,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=0x3
ar r2=0x7
wv 0x0002ea61
@ -557,6 +588,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wv 0x4478
aes
ar r0
@ -571,6 +603,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 90e85000
wv 0x11223344 @ 4
wv 0x55667788 @ 8
@ -590,6 +623,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 7158 #ldr r1, [r6, r1]
wv 0x11223344 @ 2
ar r1=0x4796eebe
@ -607,6 +641,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wa "ldr r2, [r3], 10"
wx aabbccdd @ 10
ar r3=10
@ -625,6 +660,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 0144 #add r1, r0
ar r1=0x4796eebe
ar r0=0xb8691144
@ -641,6 +677,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wa "adcs r1, r3;adcs r1, r3"
ar r1=0x90000000
ar r3=0x80000000
@ -665,6 +702,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wa "adds r1, 1"
ar r1=0xffffffff
aes
@ -682,6 +720,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wa "subs r1, 1"
ar r1=1
aes
@ -699,6 +738,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 51fb0001 #smmla r1, r1, r0, r0
ar r1=0x4796eebe
ar r0=0x11
@ -715,6 +755,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 51fb1001 #smmlar r1, r1, r0, r0
ar r1=0x4796eebe
ar r0=0x11
@ -731,6 +772,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx a1fb0212 #umull r1, r2, r1, r2
ar r1=0x4796eebe
ar r2=0x11
@ -749,6 +791,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 01fb1200 #mls r0, r1, r2, r0
ar r0=0x16161616
ar r1=0x45
@ -766,6 +809,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 00fb0211 #mla r1, r0, r2, r1
ar r1=0x16161616
ar r0=0x45
@ -783,6 +827,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 6ff01201 #mvn r1, 0x12
aes
ar r1
@ -797,6 +842,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r4=0x696969f9
wx 6ff30604 #bfc r4, 0, 7
aes
@ -812,6 +858,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r2=0x696969f9
ar r3=0x33333333
wx 62f38703 #bfi r3, r2, 2, 6
@ -828,6 +875,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r5=0x11223344
wx 2bba #rev r3, r5
aes
@ -843,6 +891,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r7=0x11223344
wx 7eba #rev16 r6, r7
aes
@ -858,6 +907,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=0x11223344
wx cfba #revsh r7, r1
aes
@ -873,6 +923,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
ar r1=0x11223388
wx cfba #revsh r7, r1
aes
@ -916,6 +967,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 7846 # mov r0, pc
aes
ar r0
@ -930,6 +982,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 00f002f8 # bl 8
aes
ar lr
@ -941,73 +994,17 @@ pc = 0x00000008
EOF
RUN
NAME=x86-16 dos syscall
FILE==
ARGS=-ax86 -b16 -kdos
CMDS=<<EOF
wa "mov ah,0x30;int 0x21"
aecu 0x4
as
EOF
EXPECT=<<EOF
48 = GetDOSVersion ()
EOF
RUN
NAME=arm s110 syscalls esil
BROKEN=1
FILE==
ARGS=-aarm -b16 -easm.os=s110
CMDS=<<EOF
wx 05220aa17cdf
e emu.str=1
pd 3
EOF
EXPECT=<<EOF
0x00000000 0522 movs r2, 5
0x00000002 0aa1 adr r1, 0x28 ; 0x2c ; ','
0x00000004 7cdf svc 0x7c ; '|' ; 124 = sd_ble_gap_device_name_set (0x00000000, 0x00000028, 0x00000005)
EOF
RUN
NAME=arm s110 syscalls as
BROKEN=1
FILE==
ARGS=-aarm -b16 -easm.os=s110
CMDS=<<EOF
wx 05220aa17cdf
e emu.str=1
sd +4
as
pd 1
EOF
EXPECT=<<EOF
124 = sd_ble_gap_device_name_set (0x00000000, 0x00000000, 0x00000000)
0x00000004 7cdf svc 0x7c ; '|' ; 124 = sd_ble_gap_device_name_set (0x00000000, 0x00000000, 0x00000000)
EOF
RUN
NAME=arm s110 syscalls as num
BROKEN=1
FILE==
ARGS=-aarm -b16 -easm.os=s110
CMDS=<<EOF
wx 05220aa17cdf
e emu.str=1
sd +4
as 123
pd 1
EOF
EXPECT=<<EOF
123 = sd_ble_gap_ppcp_get (0x00000000)
0x00000004 7cdf svc 0x7c ; '|' ; 124 = sd_ble_gap_device_name_set (0x00000000, 0x00000000, 0x00000000)
EOF
RUN
NAME=arm s110 syscalls /ad svc
FILE=bins/elf/BLE_Beacon2.NRF51822_OTA.bin
ARGS=-aarm -b16 -easm.os=s110 -m 0x16000
CMDS=/ad svc
ARGS=-m 0x16000
CMDS=
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e asm.os=s110
e cfg.bigendian=false
/ad svc
EOF
EXPECT=<<EOF
0x000168d0 # 2: svc 0x51
0x000168f2 # 2: svc 0x61
@ -1037,64 +1034,12 @@ EXPECT=<<EOF
EOF
RUN
NAME=arm s110 syscalls /as
BROKEN=1
FILE=bins/elf/BLE_Beacon2.NRF51822_OTA.bin
ARGS=-aarm -b16 -easm.os=s110 -m 0x16000
CMDS=/as
EXPECT=<<EOF
0x000168d0 sd_evt_get
0x000168f2 sd_ble_evt_get
0x00016b42 sd_ble_gap_sec_params_reply
0x00016c1c sd_ble_gap_device_name_set
0x00016c28 sd_ble_gap_appearance_set
0x00016c32 sd_ble_gap_ppcp_set
0x00016c3a sd_ble_gap_tx_power_set
0x00016ce4 sd_ble_gatts_service_add
0x00016ed6 sd_ble_gatts_sys_attr_set
0x000171b2 sd_ble_gap_adv_start
0x00017212 sd_ble_gap_adv_data_set
0x0001721e sd_ble_gap_appearance_set
0x00017408 sd_power_pof_threshold_set
0x000177f6 sd_power_system_off
0x000177f8 sd_softdevice_disable
0x00017820 sd_softdevice_vector_table_base_set
0x0001785c sd_ble_enable
0x00017864 sd_ble_gap_address_get
0x0001786c sd_ble_gap_address_set
0x0001794c sd_ble_gatts_characteristic_add
0x0001799e sd_ble_gatts_descriptor_add
0x00017a1a sd_ble_uuid_vs_add
0x00017d5e sd_softdevice_enable
0x00017d6a sd_ppi_group_assign
0x00018660 sd_ble_gatts_value_set
EOF
RUN
NAME=arm s110 syscalls aae
BROKEN=1
FILE=bins/elf/BLE_Beacon2.NRF51822_OTA.bin
ARGS=-aarm -b16 -easm.os=s110 -m 0x16000
CMDS=<<EOF
e bin.baddr=0x16000;
aae $s @ 0x00016000
fs
EOF
EXPECT=<<EOF
0 0 * sections
1 0 * segments
2 0 * relocs
3 0 * symbols
4 25 * syscalls
5 5 * strings
EOF
RUN
NAME=Pre-indexed addressing mode
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wx 10f8013f # ldrb r3, [r0, 1]!
aes
ar pc
@ -1108,13 +1053,13 @@ r3 = 0x000000f8
EOF
RUN
NAME=test-thumb-load
FILE=malloc://0x200
CMDS=<<EOF
e asm.bytes=true
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=false
wb 054b
pd 10
EOF

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar sp=4
wx f91740f9
@ -21,6 +22,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar sp=0x2c
wx f9835df8
@ -39,6 +41,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar sp=4
wx f91740f9
@ -57,6 +60,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar sp=4
wx ec1f40b9
@ -92,6 +96,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x16=4
wx 0a024039
@ -109,6 +114,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x16=4
wx 0c064039
@ -126,6 +132,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x19=4
ar x23=2
@ -144,6 +151,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x8=4
wx 170140f9
@ -161,6 +169,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x15=4
wx e80140b9
@ -178,6 +187,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x10=4
ar x9=2
@ -196,6 +206,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x11=4
ar w10=2
@ -214,6 +225,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x13=4
ar x9=4
@ -232,6 +244,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x13=4
ar x9=4
@ -250,6 +263,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
wx 0c008012
aes
@ -265,6 +279,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w15=0xaabbccdd
ar w13=0x000000ff
@ -282,6 +297,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w15=0xaabbccdd
ar w12=0xffffffff
@ -299,6 +315,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w11=4
wx 6b7d8b4a
@ -315,6 +332,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w11=-4
wx 6b7d8b4a
@ -331,6 +349,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x21=-4
wx b4fe95ca
@ -347,6 +366,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w11=-4
wx 6b010152
@ -363,6 +383,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w11=-4
ar w13=0x11223344
@ -380,6 +401,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w11=0xffeeddcc
ar w15=0x7ffffffc
@ -397,6 +419,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x14=0xf982834129348123
wx cdb52eca
@ -413,6 +436,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
wx ed1f0032
aes
@ -428,6 +452,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar w0=0xffffffff
wx 1f000153
@ -444,6 +469,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x14=0xf982834129348123
ar x19=0xf982834129348123
@ -461,6 +487,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
wx 000000915c000014
2aes
@ -476,6 +503,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
wx 400080d2210080d21f0001eb4d000054
4aes
@ -486,31 +514,12 @@ pc = 0x0000000000000010
EOF
RUN
NAME=subs x0, x0, x1; csel x0, x2, x3, mi
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
ar > /dev/null
ar x0=0
ar x1=1
ar x2=0x100
ar x3=0x200
wx 000001eb4040839a
2aes
ar x0
EOF
EXPECT=<<EOF
0x0000000000000100
EOF
RUN
NAME=stp tests
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x0=0
ar x1=1
@ -538,6 +547,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar > /dev/null
ar x8=0x140
wx 0415ffa8020dffa9000540a9061d7fa9
@ -565,6 +575,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 7f010c6bea179f1aaf090a0bea158f1a
ar w11=0x20
ar w12=0x20
@ -588,6 +599,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 3f1d00720000811a
ar w9=0x0
ar w0=0x1337
@ -613,6 +625,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 7f010c6bee138a1aef038a1af0b38a1af3c38a1a
ar w10=1
ar w11=0x20
@ -659,6 +672,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx ea7bbd52caff9772eaceac722a2dcdf2
ar w10=0x11223344aabbccdd
aeip
@ -684,6 +698,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar x11=0xffffffffffffffff
ar x10=0
ar x8=0
@ -702,6 +717,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar x11=0x45
ar x10=0x3
ar x9=0xa
@ -721,6 +737,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ar x11=3
wx eb030bcb
aeip
@ -737,6 +754,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
ara0
ar tmp=0xbebeef
ar~bebeef
@ -751,6 +769,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 1ffc0371 # cmp w0, 0xff
ar w0=0x55
%v pstate & 0xf0000000
@ -806,6 +825,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 4a012b8a #bic x10, x11
ar x10=0x1122334455667788
ar x11=0xff
@ -822,6 +842,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 4a012b0a #bic w10, w11
ar x10=0x12345678
ar x11=0xf
@ -838,6 +859,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 200cc0da #rev x0, x1
ar x1=0x1122334455667788
aes
@ -853,6 +875,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 2008c05a #rev w0, w1
ar w1=0x11223344
aes
@ -868,6 +891,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 2004c0da #rev16 x0, x1
ar x1=0x1122334455667788
aes
@ -883,6 +907,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 2004c05a #rev16 w0, w1
ar w1=0x11223344
aes
@ -898,6 +923,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 02000094 # bl 8
aes
ar lr
@ -914,6 +940,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 000940d3 # ubfx x0, x8, 0, 3
aeip
ar x8=5
@ -930,6 +957,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 16b4000f # orr v22.4h, 0, lsl 8
pd 1
pie 1
@ -945,6 +973,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=arm
e asm.bits=64
e cfg.bigendian=false
wx 0x0074006f # bic v0.4s, #0, lsl #24
pie 1
EOF

View file

@ -2,6 +2,7 @@ NAME=AVR: aeso on call
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
e asm.bits=8
wx 0xf8 0x94 0x08 0xe0 0x0e 0xbf 0x0f 0xe5 0x0d 0xbf 0x0e 0x94 0x08 0x00 0x88 0x95 0x08 0x95
aei
@ -24,6 +25,7 @@ FILE=malloc://1024
CMDS=<<EOF
(regs ;ar 8~:0..16) # show regs r0-r15
e asm.arch=avr
e cfg.bigendian=false
wx 0b941b942b943b944b945b946b947b948b949b94ab94bb94cb94db94eb94fb94
ar r0 = 0x41
ar r1 = 0x20
@ -359,6 +361,7 @@ FILE=malloc://1024
CMDS=<<EOF
(regs ;ar 8~:0..16) # show regs r0-r15
e asm.arch=avr
e cfg.bigendian=false
wx 58940b941b942b943b944b945b946b947b948b949b94ab94bb94cb94db94eb94fb94
ar r0 = 0xf5
ar r1 = 0xfe
@ -697,6 +700,7 @@ NAME=AVR: mul
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 019f
aei
(mul x y; echo ======== ${x} * ${y} ========; ar r16 = ${x}; ar r17 = ${y}; ar pc = 0; aes; echo r0; ar r0; echo r1; ar r1; echo r16; ar r16; echo r17; ar r17; echo sreg; ar sreg)
@ -757,6 +761,7 @@ NAME=AVR: muls
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 0102
aei
(muls x y; echo ======== ${x} * ${y} ========; ar r16 = ${x}; ar r17 = ${y}; ar pc = 0; aes; echo r0; ar r0; echo r1; ar r1; echo r16; ar r16; echo r17; ar r17; echo sreg; ar sreg)
@ -817,6 +822,7 @@ NAME=AVR: mulsu
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 0103
aei
(mulsu x y; echo ======== ${x} * ${y} ========; ar r16 = ${x}; ar r17 = ${y}; ar pc = 0; aes; echo r0; ar r0; echo r1; ar r1; echo r16; ar r16; echo r17; ar r17; echo sreg; ar sreg)
@ -913,6 +919,7 @@ NAME=AVR: fmul
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 0903
aei
(fmul x y; echo ======== ${x} * ${y} ========; ar r16 = ${x}; ar r17 = ${y}; ar pc = 0; aes; echo r0; ar r0; echo r1; ar r1; echo r16; ar r16; echo r17; ar r17; echo sreg; ar sreg)
@ -973,6 +980,7 @@ NAME=AVR: fmuls
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 8103
aei
(fmuls x y; echo ======== ${x} * ${y} ========; ar r16 = ${x}; ar r17 = ${y}; ar pc = 0; aes; echo r0; ar r0; echo r1; ar r1; echo r16; ar r16; echo r17; ar r17; echo sreg; ar sreg)
@ -1033,6 +1041,7 @@ NAME=AVR: fmulsu
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx 8903
aei
(fmulsu x y; echo ======== ${x} * ${y} ========; ar r16 = ${x}; ar r17 = ${y}; ar pc = 0; aes; echo r0; ar r0; echo r1; ar r1; echo r16; ar r16; echo r17; ar r17; echo sreg; ar sreg)
@ -1129,6 +1138,7 @@ NAME=AVR: adiw
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aei
(adiw h l x; echo ======== ${h}:${l} + ${x} ========; wa "adiw r27:r26, ${x}"; pi 1; ar r27 = ${h}; ar r26 = ${l}; ar pc = 0; aes; echo r26; ar r26; echo r27; ar r27; echo sreg; ar sreg)
.(adiw 0xca 0xfe 0x3f)
@ -1203,6 +1213,7 @@ NAME=AVR: sbiw
FILE=malloc://1024
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
aei
(sbiw h l x; echo ======== ${h}:${l} - ${x} ========; wa "sbiw r27:r26, ${x}"; pi 1; ar r27 = ${h}; ar r26 = ${l}; ar pc = 0; aes; echo r26; ar r26; echo r27; ar r27; echo sreg; ar sreg)
.(sbiw 0xca 0x21 0x3f)

View file

@ -142,20 +142,6 @@ ihgf
EOF
RUN
NAME=memory write (non-MIPS big endian)
FILE==
BROKEN=1
CMDS=<<EOF
e cfg.bigendian=true
aeim
ae "0x69686766,0x00100000,=[4]"
ps @0x00100000
EOF
EXPECT=<<EOF
ihgf
EOF
RUN
NAME=esil poke some (32-bits ARM big endian)
FILE==
ARGS=-a arm -b 32

View file

@ -107,47 +107,3 @@ EXPECT=<<EOF
0x0
EOF
RUN
NAME=float div 1.0 / 1.0
FILE==
BROKEN=1
CMDS=<<EOF
ae "Fx3ff0000000000000,Fx3ff0000000000000,/"
EOF
EXPECT=<<EOF
0x3ff0000000000000
EOF
RUN
NAME=float mul 1.0 6502 8051 apple arm-16 arm-32 arm-64 brainfuck cmd_aae cmd_aea cmd_aetr cmd_aex cmd_pae cmp cond debug_esil esil flag_tests intreg math mips sh step step-back step-over syscall x86-32 x86-64 xtensa 1.0
FILE==
BROKEN=1
CMDS=<<EOF
ae "Fx3ff0000000000000,Fx3ff0000000000000,*"
EOF
EXPECT=<<EOF
0x3ff0000000000000
EOF
RUN
NAME=float add 1.0 + 1.0
FILE==
BROKEN=1
CMDS=<<EOF
ae "Fx3ff0000000000000,Fx3ff0000000000000,+"
EOF
EXPECT=<<EOF
0x4000000000000000
EOF
RUN
NAME=float sub 1.0 - 1.0
FILE==
BROKEN=1
CMDS=<<EOF
ae "Fx3ff0000000000000,Fx3ff0000000000000,-"
EOF
EXPECT=<<EOF
0x0
EOF
RUN

View file

@ -3,6 +3,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx 20000200
aei
@ -21,6 +22,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx 20280200
aei
@ -39,6 +41,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xFFFFFFFF
ar v1=0x5
wx 20284300
@ -58,6 +61,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 05000020
aei
aeim
@ -75,6 +79,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx 05000520
aei
@ -93,6 +98,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx fbff0520
aei
@ -111,6 +117,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=6
wx fbff4520
aei
@ -129,6 +136,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx 21000200
aei
@ -147,6 +155,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx 21280200
aei
@ -165,6 +174,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xFFFFFFFF
ar v1=0x5
wx 21284300
@ -184,6 +194,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 05000024
aei
aeim
@ -201,6 +212,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx 05000524
aei
@ -219,6 +231,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
wx fbff0524
aei
@ -237,6 +250,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=6
wx fbff4524
aei
@ -255,6 +269,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=5
ar v1=1
wx 22004300
@ -274,6 +289,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=1
ar v1=5
wx 22284300
@ -293,6 +309,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xFFFFFFFF
ar v1=0x5
wx 22284300
@ -312,6 +329,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=1
ar v1=5
wx 23284300
@ -331,6 +349,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xFFFFFFFF
ar v1=0x5
wx 23284300
@ -350,6 +369,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffffffff
ar v1=0x10101010
wx 24284300
@ -369,6 +389,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffffffff
wx ffff4530
aei
@ -387,6 +408,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffffffff
wx 01004530
aes
@ -402,6 +424,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
wx 25000200
aes
@ -417,6 +440,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
wx 25280200
aes
@ -432,6 +456,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v1=0x01010111
ar v0=0x10101010
wx 25284300
@ -448,6 +473,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx ffff0034
aes
ar zero
@ -462,6 +488,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx ffff0534
aes
ar a1
@ -476,6 +503,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffff0000
wx 01004534
aes
@ -491,6 +519,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
wx 26000200
aes
@ -506,6 +535,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
wx 26280200
aes
@ -521,6 +551,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x01010111
ar v1=0x10101010
wx 26284300
@ -537,6 +568,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx ffff0038
aes
ar zero
@ -551,6 +583,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx ffff0538
aes
ar a1
@ -565,6 +598,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffff0000
wx 01004538
aes
@ -580,6 +614,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffff00ff
wx f1004538
aes
@ -595,6 +630,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
wx 27000200
aes
@ -610,6 +646,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
wx 27280200
aes
@ -625,6 +662,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x10101010
ar v1=0xffff0000
wx 27284300
@ -641,6 +679,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000004
s 4
wx aabbccdd00004384
@ -661,6 +700,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000006
s 4
wx aabbccddfeff4384
@ -681,6 +721,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000000
wx aabbccdd02004384
s 4
@ -700,6 +741,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000004
s 4
wx aabbccdd112233440000438c
@ -720,6 +762,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000008
s 0x4
wx aabbccdd11223344fcff438c
@ -740,6 +783,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000000
wx aabbccdd112233440400438c
s 8
@ -759,6 +803,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x11aa22bb
ar v1=0x10
s 4
@ -779,6 +824,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x11aa22bb
ar v1=0x14
s 4
@ -799,6 +845,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x11aa22bb
ar v1=0x10
wx 00000000000062a4
@ -819,6 +866,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x11aa22bb
ar v1=0x10
wx 00000000020062a4
@ -839,6 +887,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x11aa22bb
ar v1=0x10
wx 00000000000062a0
@ -859,6 +908,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x11aa22bb
ar v1=0
wx 00000000030062a0
@ -879,6 +929,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x0001ffff
wx 00140200
aes
@ -894,6 +945,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x0001ffff
ar v1=16
wx 04106200
@ -910,6 +962,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar v1=0x44556677
wx 18004300
@ -928,6 +981,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar v1=0x44556677
wx 18004300
@ -945,8 +999,9 @@ NAME=mul s0, a0, v0
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.cpu=mips32r5
e asm.bits=32
e asm.cpu=mips32r5
e cfg.bigendian=false
wx 02808270
ar a0=21
ar v0=12
@ -969,6 +1024,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar lo=0xffffffff12345678
wx 12100000
@ -985,6 +1041,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar hi=0xffffffff12345678
wx 10100000
@ -1001,6 +1058,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar lo=0xffffffff12345678
wx 12100000
aes
@ -1016,6 +1074,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar hi=0xffffffff12345678
wx 10100000
aes
@ -1031,6 +1090,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar lo=0xffffffff12345678
wx 13004000
@ -1047,6 +1107,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar hi=0xffffffff12345678
wx 11004000
@ -1063,6 +1124,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffffffff
ar hi=0xffffffff12345678
wx 11004000
@ -1079,6 +1141,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar v1=0x00112233
wx 0e004314
@ -1095,6 +1158,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00222233
ar v1=0x00112233
wx 0e004314
@ -1111,6 +1175,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00222233
ar v1=0x00112233
wx 0e004310
@ -1127,6 +1192,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00112233
ar v1=0x00112233
wx 0e004310
@ -1143,6 +1209,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar s4=0x00000000
wx 02008016
aes
@ -1153,59 +1220,12 @@ pc = 0x00000004
EOF
RUN
NAME=bnez s4, 0xc (taken)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar s4=0x00112233
wx 02008016
aes
ar pc
EOF
EXPECT=<<EOF
pc = 0x0000000c
EOF
RUN
NAME=blez v0, 0x3c (not taken)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v0=0x00000001
wx 0e004018
aes
ar pc
EOF
EXPECT=<<EOF
pc = 0x00000004
EOF
RUN
NAME=blez v0, 0x3c (taken)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v0=0xfffffffc
wx 0e004018
aes
ar pc
EOF
EXPECT=<<EOF
pc = 0x0000003c
EOF
RUN
NAME=blez zero, 0x3c (taken)
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 0e000018
aes
ar pc
@ -1220,6 +1240,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000001
wx 0e004104
aes
@ -1235,6 +1256,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xfffffffc
wx 0e004104
aes
@ -1250,6 +1272,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 0e000104
aes
ar pc
@ -1264,6 +1287,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000001
wx 0e004004
aes
@ -1279,6 +1303,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xfffffffc
wx 0e004004
aes
@ -1294,6 +1319,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 0e000004
aes
ar pc
@ -1308,6 +1334,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0x00000001
wx 0e00401c
aes
@ -1323,6 +1350,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xfffffffc
wx 0e00401c
aes
@ -1338,6 +1366,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 0e00001c
aes
ar pc
@ -1352,6 +1381,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
wx 0400000c
aes
ar pc
@ -1363,99 +1393,12 @@ ra = 0x00000008
EOF
RUN
NAME=jalr t9
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar t9=16
wx 09f82003
aes
ar pc
ar ra
EOF
EXPECT=<<EOF
pc = 0x00000010
ra = 0x00000008
EOF
RUN
NAME=jalr t4, t9
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar t9=16
wx 09602003
aes
ar pc
ar t4
EOF
EXPECT=<<EOF
pc = 0x00000010
t4 = 0x00000008
EOF
RUN
NAME=jalr t4, t9 (invalid delay instruction)
FILE=malloc://8
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar t9=16
wx 09602003f6736430
aes
ar pc
ar t4
EOF
EXPECT=<<EOF
pc = 0x00000010
t4 = 0x00000008
EOF
RUN
NAME=slt s0, v0, v1 (1<2=1)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v0=1
ar v1=2
wx 2a804300
aes
ar s0
EOF
EXPECT=<<EOF
s0 = 0x00000001
EOF
RUN
NAME=slt s0, v0, v1 (0<0=0)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v0=0
ar v1=0
wx 2a804300
aes
ar s0
EOF
EXPECT=<<EOF
s0 = 0x00000000
EOF
RUN
NAME=slt s0, v0, v1 (2<1=0)
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=2
ar v1=1
wx 2a804300
@ -1472,6 +1415,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=-1
ar v1=1
wx 2a804300
@ -1488,6 +1432,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0xffffffff
ar v1=1
wx 2b804300
@ -1504,6 +1449,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=false
ar v0=0
ar v1=0xffffffff
wx 2b804300
@ -1515,154 +1461,6 @@ s0 = 0x00000001
EOF
RUN
NAME=negu v1, v0 (neg -1 = 1)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v1=0
ar v0=-1
wx 23180200
aes
ar v1
EOF
EXPECT=<<EOF
v1 = 0x00000001
EOF
RUN
NAME=negu v1, v0 (neg 1 = -1)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v1=0
ar v0=1
wx 23180200
aes
ar v1
EOF
EXPECT=<<EOF
v1 = 0xffffffff
EOF
RUN
NAME=negu v1, v0 (neg 3497 = -3497)
FILE=malloc://0x200
BROKEN=1
CMDS=<<EOF
e asm.arch=mips
e asm.bits=32
ar v1=0
ar v0=3497
wx 23180200
aes
ar v1
EOF
EXPECT=<<EOF
v1 = 0xfffff257
EOF
RUN
NAME=negative mem reference
FILE=malloc://0x200
BROKEN=1
ARGS=-m 0x410984
CMDS=<<EOF
e io.va=true
e asm.arch=mips
e asm.bits=32
e cfg.bigendian=true
aei
aeim
aeip
ar t9=0
ar gp=0
wx 3c1c0042279c89408f99805011223344
aes
aes
aes
ar t9
EOF
EXPECT=<<EOF
t9 = 0x11223344
EOF
RUN
BROKEN=1
NAME=complex function
FILE=malloc://0x800
ARGS=-m 0x0040092c
CMDS=<<EOF
e io.va=true
e asm.arch=mips
e asm.bits=32
ar t9=0
ar v0=14
ar a0=0x00400a7c
ar fp=0x00401000
wx 2000c2af1c00c0af42000010250820001c00c28f3000c38f25082000211062000000428025082000410042282e004014250820001c00c28f3000c38f250820002110620000004280250820007b00422825004010250820001c00c28f3000c38f25082000211062000000428025082000610042281f004014250820001c00c28f3000c38f250820002110620000004280250820007b00422819004010250820001c00c28f3000c38f25082000211062001c00c38f3000c48f25082000211883000000638025082000ff006330e0ff6324ff006330001e0300031e0300000043a008000010250820001800c0a30500001025082000250820000200001025082000250820001c00c28f25082000010042241c00c2af2000c28f25082000ffff43241c00c28f250820002a104300b8ff4014250820001800c29321e8c0032c00bf8f2800be8f3000bd270800e00325082000736c6f77646f776e776f6d616e00
wx 7c0a4000 @ 0x00401030
wx 0d000000 @ 0x00401020
aeip
aesu 0x00400a74
s 0x00400a7c
ps
EOF
EXPECT=<<EOF
SLOWDOWNWOMAN
EOF
RUN
BROKEN=1
NAME=complex function 2
FILE=malloc://0x800
ARGS=-m 0x0040092c
CMDS=<<EOF
e io.va=true
e asm.arch=mips
e asm.bits=32
ar t9=0
ar v0=14
ar a0=0x00400a7c
ar fp=0x00401000
wx 2000c2af1c00c0af42000010250820001c00c28f3000c38f25082000211062000000428025082000410042282e004014250820001c00c28f3000c38f250820002110620000004280250820007b00422825004010250820001c00c28f3000c38f25082000211062000000428025082000610042281f004014250820001c00c28f3000c38f250820002110620000004280250820007b00422819004010250820001c00c28f3000c38f25082000211062001c00c38f3000c48f25082000211883000000638025082000ff006330e0ff6324ff006330001e0300031e0300000043a008000010250820001800c0a30500001025082000250820000200001025082000250820001c00c28f25082000010042241c00c2af2000c28f25082000ffff43241c00c28f250820002a104300b8ff4014250820001800c29321e8c0032c00bf8f2800be8f3000bd270800e003250820006e336d342f707230626c336d3400
wx 7c0a4000 @ 0x00401030
wx 0d000000 @ 0x00401020
aeip
aesu 0x00400a74
s 0x00400a7c
ps
EOF
EXPECT=<<EOF
N3M4/PR0BL3M4
EOF
RUN
NAME=complex function 3
BROKEN=1
FILE=malloc://0x800
ARGS=-m 0x00400ac0
CMDS=<<EOF
e io.va=true
e asm.arch=mips
e asm.bits=32
ar v0=8
ar a0=0x00400b48
ar fp=0x00401000
wx 2000c2af1800c0af0e000010250820001800c28f3000c38f2508200021106200000042801c00c38f25082000211062001c00c2af1800c28f25082000010042241800c2af2000c28f25082000ffff43241800c28f250820002a104300ecff4014250820001c00c28f250820002134423821e8c0032c00bf8f2800be8f3000bd270800e003250820004449474954414c00
wx 480b4000 @ 0x00401030
wx 08000000 @ 0x00401020
aesu 0x00400b40
ar v0
EOF
EXPECT=<<EOF
v0 = 0x000035df
EOF
RUN
NAME=asm.emu with meta
FILE=bins/elf/analysis/crackmips
CMDS=<<EOF

View file

@ -17,4 +17,17 @@ EXPECT=<<EOF
ip = 0x000c
ip = 0x000c
EOF
RUN
RUN
NAME=x86-16 dos syscall
FILE==
ARGS=-ax86 -b16 -kdos
CMDS=<<EOF
wa "mov ah,0x30;int 0x21"
aecu 0x4
as
EOF
EXPECT=<<EOF
48 = GetDOSVersion ()
EOF
RUN

View file

@ -166,39 +166,6 @@ EXPECT=<<EOF
EOF
RUN
NAME=rep movsb 0x1000 randombytes x86-32
FILE==
BROKEN=1
CMDS=<<EOF
e io.va=true
e asm.arch=x86
e asm.bits=32
aei
aeim
ar esp=0x00108000
aeim 0x10000000 0x1000 source
aeim 0x20000000 0x1000 destination
wr 0x1000 @ 0x10000000
ar edi=0x20000000
ar esi=0x10000000
ar ecx=0x1000
.arf
wx f3a4
aes
.arf
s 0x10000000
cX 0x20000000
ar?edi
ar?esi
ar?ecx
EOF
EXPECT=<<EOF
0x20001000
0x10001000
0x00000000
EOF
RUN
NAME=lodsb ++ x86-32
FILE==
CMDS=<<EOF

View file

@ -339,21 +339,6 @@ esil: rdx,rax,+,rbx,=
EOF
RUN
NAME=ldrh instruction
FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
wx b030dfe10101010141424344
aes
ar r3
EOF
EXPECT=<<EOF
r3 = 0x00004241
EOF
RUN
NAME=x86-64 linux syscall
FILE=bins/elf/syscall_x86
CMDS=<<EOF

View file

@ -3,6 +3,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 22a0060c7330828030729022c2012b3242a0080c354065c04065d0
aecu 0x0000001b
ar~a2,a3,a4,a5,a6,a7,a8
@ -23,6 +24,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 22a05032a0bb42afff52a0cc7cf6326200425202524208722200829202921202a20208
aecu 0x00000023
ar~a2,a3,a4,a5,a6,a7,a8,a9,a10
@ -42,8 +44,10 @@ RUN
NAME=load relative
FILE=malloc://0x200
ARGS=-a xtensa -b 32
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx ddccbbaa @ 0
s 0x14
wx 21fbff31faff41f9ff51f8fff8ff
@ -65,6 +69,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx c5000022a020c00200000000000000008000000000000000000000000000000002a030c00000
aes
ar~^pc
@ -96,6 +101,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 22a002e6320526320200000086fdff
aes
aes
@ -117,6 +123,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 22a002d6920000000000000000000000060000
aes
aes
@ -132,6 +139,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 22a00232a00327130627a30300000000060000
aes
aes
@ -149,6 +157,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 00000fff34120fff000000000000000021fcff31fcff2743060000000000000006ffff
s 0x10
aeip
@ -167,6 +176,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 0000004000000000000000000000000021fcffe7f2090000000000000000000006ffff
s 0x10
aeip
@ -184,6 +194,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
wx 0000000400000000000000000000000021fcff32a01a37d2060000000000000006ffff
s 0x10
aeip
@ -202,6 +213,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
e asm.esil=1
wx ddccbbaa00000000000000000000000021fcff2038f4
s 0x10
@ -220,6 +232,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
e asm.esil=1
wx 4ce87cdb
s 0x0
@ -237,6 +250,7 @@ FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=xtensa
e asm.bits=32
e cfg.bigendian=false
e asm.esil=1
wx 4ce87cdb
s 0x0

View file

@ -3,7 +3,7 @@ FILE=bins/bflt/bin.bflt
ARGS=-B0x6908000
CMDS=<<EOF
# Basic loading info
i~format,os,subsys,PIE,endian
iI
iH
iS
iSS
@ -20,12 +20,45 @@ pv4 @ 0x6908000+0x2fb8 # data -> data reloc
pi 1 @ 0x6908000+0x0000016c
EOF
EXPECT=<<EOF
format bflt
arch arm
cpu N/A
features N/A
baddr 0x06908000
binsz 0x00003134
bintype bflt
bits 32
retguard false
class bflt
compiler N/A
dbg_file N/A
endian LE
hdr.csum N/A
guid N/A
intrp N/A
laddr 0x00000000
lang N/A
machine unknown
maxopsz 4
minopsz 4
os Linux
cc N/A
pcalign 4
rpath N/A
subsys uClinux
stripped false
crypto false
havecode true
va true
sanitiz false
static true
linenum false
lsyms false
canary false
PIE true
RELROCS false
NX false
bflt:
guessed_arch: "arm"
Magic: "62 46 4c 54 |bFLT |"
Revision: 0x4
Entry: 0x44
@ -37,6 +70,9 @@ bflt:
RelocCount: 92
Flags: 0x1
BuildDate: 1481527744
Padding: |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00 00 00 00 |.... |
paddr size vaddr vsize align perm name type flags
-----------------------------------------------------------------
@ -160,6 +196,9 @@ NAME=busybox arm32 data reference chain
FILE=bins/bflt/busybox-arm32.bflt
ARGS=-B0x4080000
CMDS=<<EOF
e cfg.bigendian
iI
iH
aae
aav
echo ------ reloc to string
@ -171,6 +210,61 @@ pd 1 @ 0x0408b780
axf @ 0x0408b780
EOF
EXPECT=<<EOF
false
arch arm
cpu N/A
features N/A
baddr 0x04080000
binsz 0x00035bcc
bintype bflt
bits 32
retguard false
class bflt
compiler N/A
dbg_file N/A
endian LE
hdr.csum N/A
guid N/A
intrp N/A
laddr 0x00000000
lang N/A
machine unknown
maxopsz 4
minopsz 4
os Linux
cc N/A
pcalign 4
rpath N/A
subsys uClinux
stripped false
crypto false
havecode true
va true
sanitiz false
static true
linenum false
lsyms false
canary false
PIE true
RELROCS false
NX false
bflt:
guessed_arch: "arm"
Magic: "62 46 4c 54 |bFLT |"
Revision: 0x4
Entry: 0x44
DataStart: 0x2f2f4
DataEnd: 0x33f58
BssEnd: 0x373d0
StackSize: 16000
RelocStart: 0x33f58
RelocCount: 1821
Flags: 0x1
BuildDate: 1634814878
Padding: |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00 00 00 00 |.... |
------ reloc to string
; DATA XREFS from fcn.0408aafc @ +0xc84, +0xd80
0x0408b884 .dword 0x040af7c4 ; str.Success ; RELOC 32
@ -187,9 +281,11 @@ RUN
NAME=busybox m68k with gotpic
FILE=bins/bflt/busybox-m68k.bflt
ARGS=-a m68k -e cfg.bigendian=true -B 0x41e40000
ARGS=-B0x41e40000
CMDS=<<EOF
i~format,os,subsys,PIE,endian
e cfg.bigendian
iI
iH
echo ------ got relocs (begin)
ir~:0..10
pv4 8 @ 0x41e6a8a0
@ -202,11 +298,59 @@ ir~0x41e6c030
pv4 @ 0x41e6c030
EOF
EXPECT=<<EOF
format bflt
true
arch m68k
cpu N/A
features N/A
baddr 0x41e40000
binsz 0x0002c6b8
bintype bflt
bits 32
retguard false
class bflt
compiler N/A
dbg_file N/A
endian BE
hdr.csum N/A
guid N/A
intrp N/A
laddr 0x00000000
lang N/A
machine unknown
minopsz 1
os Linux
cc N/A
rpath N/A
subsys uClinux
stripped false
crypto false
havecode true
va true
sanitiz false
static true
linenum false
lsyms false
canary false
PIE true
RELROCS false
NX false
bflt:
guessed_arch: "m68k"
Magic: "62 46 4c 54 |bFLT |"
Revision: 0x4
Entry: 0x44
DataStart: 0x2a88c
DataEnd: 0x2c418
BssEnd: 0x2d2e0
StackSize: 16000
RelocStart: 0x2c418
RelocCount: 168
Flags: 0x2
BuildDate: 1634755328
Padding: |
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00 00 00 00 |.... |
------ got relocs (begin)
vaddr paddr target type name
---------------------------------------------

View file

@ -80,6 +80,7 @@ NAME=arm cmp
FILE=malloc://0x100
ARGS=-aarm -b32
CMDS=<<EOF
e cfg.bigendian=false
wx 0f0053e3
aezi
ar r3=0
@ -155,6 +156,7 @@ NAME=arm sdiv
FILE=malloc://0x100
ARGS=-aarm -b32
CMDS=<<EOF
e cfg.bigendian=false
wx 10f110e7
aezi
ar r0=42
@ -213,6 +215,7 @@ NAME=arm udiv
FILE=malloc://0x100
ARGS=-aarm -b32
CMDS=<<EOF
e cfg.bigendian=false
wx 10f130e7
aezi
ar r0=42
@ -265,12 +268,11 @@ r0 = 0x3333332a
-- -42 / -5
r0 = 0x00000000
EOF
TIMEOUT=10
RUN
NAME=emulateme_vfp
FILE=bins/elf/emulateme_vfp.arm32
TIMEOUT=30
TIMEOUT=60
CMDS=<<EOF
o malloc://0x1000 0x40000
o malloc://0x10 0x50000

View file

@ -109,6 +109,7 @@ NAME=fmul 1.5 * 1.25
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0xC0 ; ldi r17, 0xA0 ; fmul r16, r17"
aezi
aezse 3
@ -130,6 +131,7 @@ NAME=fmul test 2
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0xec ; ldi r17, 0x17 ; fmul r16, r17"
aezi
aezse 3
@ -151,6 +153,7 @@ NAME=fmuls -0.75 * -0.125
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0xA0 ; ldi r17, 0xF0 ; fmuls r16, r17"
aezi
aezse 3
@ -172,6 +175,7 @@ NAME=fmuls test 2
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0x0f ; ldi r17, 0x1f ; fmuls r16, r17"
aezi
aezse 3
@ -193,6 +197,7 @@ NAME=fmulsu -0.5 * 0.75
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0xc0 ; ldi r17, 0x60 ; fmulsu r16, r17"
aezi
aezse 3
@ -214,6 +219,7 @@ NAME=fmulsu test 2
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0xff ; ldi r17, 0x50 ; fmulsu r16, r17"
aezi
aezse 3
@ -235,6 +241,7 @@ NAME=push & pop
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0xC0 ; ldi r17, 0xA0 ; push r16 ; push r17 ; pop r16 ; pop r17"
aezi
ar SP=0x3F
@ -274,6 +281,7 @@ NAME=Subtract r17:r16 from r31:r30
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r31, 0x11 ; ldi r30, 0xEE ; subi r30, 0x50 ; sbci r31, 0x72"
aezi
aezs 2
@ -309,6 +317,7 @@ NAME=Perform SWAP
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "inc r1 ; swap r1 ; inc r1 ; swap r1 ; inc r1"
aezi
echo increase r1
@ -345,6 +354,7 @@ NAME=Add r17:r16 to r31:r30
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r17, 0x7f" @ 0x0
wa "ldi r16, 0x50" @ 0x2
wa "ldi r31, 0x11" @ 0x4
@ -388,6 +398,7 @@ NAME=Add Immediate to Word
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "adiw r25:r24, 1 ; adiw r31:r30, 63"
aezi
aezse 2~name
@ -414,6 +425,7 @@ NAME=Shifts
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
# Load decimal 16 into r16
wa "ldi r16, 0x10" @ 0
# r16 /= 2
@ -475,6 +487,7 @@ NAME=Status regs & bit Manipulations
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "ldi r16, 0x4" @ 0
# Store bit 2 of r16 in T Flag
wa "bst r16, 2" @ 2
@ -534,6 +547,7 @@ NAME=Status regs clear and set
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wa "sei ; set ; seh ; ses ; sev ; sen ; sez ; sec"
aezi
aezs 8
@ -553,6 +567,7 @@ NAME=Simple call & ret
FILE=malloc://512
CMDS=<<EOF
e asm.arch=avr
e cfg.bigendian=false
wx "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" @ 0x70
wa "ldi r16, 0x7F" @ 0
wa "ldi r17, 0xFC" @ 2

View file

@ -8,8 +8,16 @@ static RzCore *fake_core_new(void) {
RzCore *core = rz_core_new();
RzCoreFile *file = rz_core_file_open(core, "malloc://1024", RZ_PERM_RW, 0);
mu_assert_notnull(file, "open file");
rz_config_set_b(core->config, "cfg.bigendian", false);
rz_core_bin_load(core, NULL, 0);
// the default arch depends by the RZ_SYS_ARCH, and
// some archs allows different endianness, like ARM, but
// x86 is always LE, s390x is always BE, so we cannot set
// the endianness to a value not supported by the arch.
// ARM can be LE and BE, so we change the arch first
// then change the endianness.
rz_config_set(core->config, "asm.arch", "arm");
rz_config_set_b(core->config, "cfg.bigendian", false);
return core;
}