Rizin
unix-like reverse engineering framework and cli tools
mach0_utils.inc
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2021 Florian Märkl <info@florianmaerkl.de>
2 // SPDX-FileCopyrightText: 2010-2020 nibble <nibble.ds@gmail.com>
3 // SPDX-FileCopyrightText: 2010-2020 pancake <pancake@nopcode.org>
4 // SPDX-License-Identifier: LGPL-3.0-only
5 
6 static ut64 read_uleb128(ut8 **p, ut8 *end) {
7  const char *error = NULL;
8  ut64 v;
9  *p = (ut8 *)rz_uleb128(*p, end - *p, &v, &error);
10  if (error) {
11  RZ_LOG_ERROR("%s", error);
12  RZ_FREE(error);
13  return UT64_MAX;
14  }
15  return v;
16 }
17 
18 static size_t get_word_size(struct MACH0_(obj_t) * bin) {
19  const size_t word_size = MACH0_(get_bits)(bin) / 8;
20  return RZ_MAX(word_size, 4);
21 }
#define NULL
Definition: cris-opc.c:27
const char * v
Definition: dsignal.c:12
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
#define MACH0_(name)
Definition: mach0_specs.h:20
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
#define RZ_FREE(x)
Definition: rz_types.h:369
#define RZ_MAX(x, y)
#define UT64_MAX
Definition: rz_types_base.h:86
RZ_API const ut8 * rz_uleb128(const ut8 *data, int datalen, RZ_NULLABLE ut64 *v, const char **error)
Definition: uleb128.c:9
Definition: malloc.c:26
#define get_bits(av, af, an)
Definition: tms320_dasm.c:18
void error(const char *msg)
Definition: untgz.c:593
ut64(WINAPI *w32_GetEnabledXStateFeatures)()