Rizin
unix-like reverse engineering framework and cli tools
omf.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2015 ampotos <mercie_i@epitech.eu>
2
// SPDX-FileCopyrightText: 2015-2019 pancake <pancake@nopcode.org>
3
// SPDX-License-Identifier: LGPL-3.0-only
4
5
#ifndef OMF_H_
6
#define OMF_H_
7
8
#include <
rz_util.h
>
9
#include <
rz_types.h
>
10
#include <
rz_bin.h
>
11
12
#include "
omf_specs.h
"
13
14
typedef
struct
OMF_record_handler
{
15
OMF_record
record
;
16
struct
OMF_record_handler
*
next
;
17
}
OMF_record_handler
;
18
19
typedef
struct
{
20
ut32
nb_elem
;
21
void
*
elems
;
22
}
OMF_multi_datas
;
23
24
typedef
struct
OMF_DATA
{
25
ut64
paddr
;
// offset in file
26
ut64
size
;
27
ut32
offset
;
28
ut16
seg_idx
;
29
struct
OMF_DATA
*
next
;
30
}
OMF_data
;
31
32
// sections return by the plugin are the addr of datas because sections are
33
// separate on non contiguous block on the omf file
34
typedef
struct
{
35
ut32
name_idx
;
36
ut64
size
;
37
ut8
bits
;
38
ut64
vaddr
;
39
OMF_data
*
data
;
40
}
OMF_segment
;
41
42
typedef
struct
{
43
char
*
name
;
44
ut16
seg_idx
;
45
ut32
offset
;
46
}
OMF_symbol
;
47
48
typedef
struct
{
49
ut8
bits
;
50
char
**
names
;
51
ut32
nb_name
;
52
OMF_segment
**
sections
;
53
ut32
nb_section
;
54
OMF_symbol
**
symbols
;
55
ut32
nb_symbol
;
56
OMF_record_handler
*
records
;
57
}
rz_bin_omf_obj
;
58
59
// this value was chosen arbitrarily to made the loader work correctly
60
// if someone want to implement rellocation for omf he has to remove this
61
#define OMF_BASE_ADDR 0x1000
62
63
bool
rz_bin_checksum_omf_ok
(
const
ut8
*
buf
,
ut64
buf_size
);
64
rz_bin_omf_obj
*
rz_bin_internal_omf_load
(
const
ut8
*
buf
,
ut64
size
);
65
void
rz_bin_free_all_omf_obj
(
rz_bin_omf_obj
*obj);
66
bool
rz_bin_omf_get_entry
(
rz_bin_omf_obj
*obj,
RzBinAddr
*
addr
);
67
int
rz_bin_omf_get_bits
(
rz_bin_omf_obj
*obj);
68
int
rz_bin_omf_send_sections
(
RzList
*
list
,
OMF_segment
*
section
,
rz_bin_omf_obj
*obj);
69
ut64
rz_bin_omf_get_paddr_sym
(
rz_bin_omf_obj
*obj,
OMF_symbol
*sym);
70
ut64
rz_bin_omf_get_vaddr_sym
(
rz_bin_omf_obj
*obj,
OMF_symbol
*sym);
71
72
#endif
buf_size
static int buf_size
Definition:
debug_qnx.c:35
ut16
uint16_t ut16
Definition:
demangler_util.h:30
ut32
uint32_t ut32
Definition:
demangler_util.h:31
size
voidpf void uLong size
Definition:
ioapi.h:138
buf
voidpf void * buf
Definition:
ioapi.h:138
ut8
uint8_t ut8
Definition:
lh5801.h:11
list
static void list(RzEgg *egg)
Definition:
rz-gg.c:52
rz_bin_omf_get_entry
bool rz_bin_omf_get_entry(rz_bin_omf_obj *obj, RzBinAddr *addr)
Definition:
omf.c:701
rz_bin_omf_get_vaddr_sym
ut64 rz_bin_omf_get_vaddr_sym(rz_bin_omf_obj *obj, OMF_symbol *sym)
Definition:
omf.c:797
rz_bin_omf_send_sections
int rz_bin_omf_send_sections(RzList *list, OMF_segment *section, rz_bin_omf_obj *obj)
Definition:
omf.c:746
rz_bin_free_all_omf_obj
void rz_bin_free_all_omf_obj(rz_bin_omf_obj *obj)
Definition:
omf.c:665
OMF_record_handler
struct OMF_record_handler OMF_record_handler
rz_bin_omf_get_bits
int rz_bin_omf_get_bits(rz_bin_omf_obj *obj)
Definition:
omf.c:731
rz_bin_checksum_omf_ok
bool rz_bin_checksum_omf_ok(const ut8 *buf, ut64 buf_size)
Definition:
omf.c:30
rz_bin_omf_get_paddr_sym
ut64 rz_bin_omf_get_paddr_sym(rz_bin_omf_obj *obj, OMF_symbol *sym)
Definition:
omf.c:774
rz_bin_internal_omf_load
rz_bin_omf_obj * rz_bin_internal_omf_load(const ut8 *buf, ut64 size)
Definition:
omf.c:683
OMF_data
struct OMF_DATA OMF_data
omf_specs.h
rz_bin.h
rz_types.h
rz_util.h
OMF_DATA
Definition:
omf.h:24
OMF_DATA::seg_idx
ut16 seg_idx
Definition:
omf.h:28
OMF_DATA::offset
ut32 offset
Definition:
omf.h:27
OMF_DATA::next
struct OMF_DATA * next
Definition:
omf.h:29
OMF_DATA::size
ut64 size
Definition:
omf.h:26
OMF_DATA::paddr
ut64 paddr
Definition:
omf.h:25
OMF_multi_datas
Definition:
omf.h:19
OMF_multi_datas::elems
void * elems
Definition:
omf.h:21
OMF_multi_datas::nb_elem
ut32 nb_elem
Definition:
omf.h:20
OMF_record_handler
Definition:
omf.h:14
OMF_record_handler::next
struct OMF_record_handler * next
Definition:
omf.h:16
OMF_record_handler::record
OMF_record record
Definition:
omf.h:15
OMF_record
Definition:
omf_specs.h:76
OMF_segment
Definition:
omf.h:34
OMF_segment::data
OMF_data * data
Definition:
omf.h:39
OMF_segment::name_idx
ut32 name_idx
Definition:
omf.h:35
OMF_segment::vaddr
ut64 vaddr
Definition:
omf.h:38
OMF_segment::bits
ut8 bits
Definition:
omf.h:37
OMF_segment::size
ut64 size
Definition:
omf.h:36
OMF_symbol
Definition:
omf.h:42
OMF_symbol::offset
ut32 offset
Definition:
omf.h:45
OMF_symbol::name
char * name
Definition:
omf.h:43
OMF_symbol::seg_idx
ut16 seg_idx
Definition:
omf.h:44
rz_bin_addr_t
Definition:
rz_bin.h:185
rz_bin_omf_obj
Definition:
omf.h:48
rz_bin_omf_obj::nb_name
ut32 nb_name
Definition:
omf.h:51
rz_bin_omf_obj::nb_symbol
ut32 nb_symbol
Definition:
omf.h:55
rz_bin_omf_obj::names
char ** names
Definition:
omf.h:50
rz_bin_omf_obj::sections
OMF_segment ** sections
Definition:
omf.h:52
rz_bin_omf_obj::bits
ut8 bits
Definition:
omf.h:49
rz_bin_omf_obj::symbols
OMF_symbol ** symbols
Definition:
omf.h:54
rz_bin_omf_obj::nb_section
ut32 nb_section
Definition:
omf.h:53
rz_bin_omf_obj::records
OMF_record_handler * records
Definition:
omf.h:56
rz_list_t
Definition:
rz_list.h:18
section
Definition:
mach0_defines.h:645
ut64
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
addr
static int addr
Definition:
z80asm.c:58
librz
bin
format
omf
omf.h
Generated by
1.9.1