Rizin
unix-like reverse engineering framework and cli tools
ebc_disas.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2013-2015 Fedor Sakharov <fedor.sakharov@gmail.com>
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#ifndef RZ_EBC_DISAS_H
5
#define RZ_EBC_DISAS_H
6
7
#include <
stdint.h
>
8
9
#define EBC_OPCODE_MASK 0x3F
10
#define EBC_MODIFIER_MASK 0xC0
11
#define EBC_OPERAND1_MASK 0x07
12
#define EBC_OPERAND2_MASK (0x07 << 4)
13
#define EBC_OPERAND1_DIRECT 0x08
14
#define EBC_OPERAND2_DIRECT 0xA0
15
#define EBC_OPERAND1_INDX 0x01
16
#define EBC_OPERAND2_INDX 0x02
17
18
#define EBC_GET_OPCODE(byte) (byte & EBC_OPCODE_MASK)
19
20
#define EBC_INSTR_MAXLEN 32
21
#define EBC_OPERANDS_MAXLEN 32
22
23
#define EBC_NTH_BIT(n) (1ULL << n)
24
#define EBC_N_BIT_MASK(n) (~(~0U << (n)))
25
#define EBC_GET_BIT(v, n) ((v >> n) & 1)
26
27
#define TEST_BIT(x, n) (x & (1 << n))
28
29
enum
ebc_opcodes
{
30
EBC_BREAK
= 0x00,
31
EBC_JMP
= 0x01,
32
EBC_JMP8
= 0x02,
33
EBC_CALL
= 0x03,
34
EBC_RET
= 0x04,
35
EBC_CMPEQ
= 0x05,
36
EBC_CMPLTE
= 0x06,
37
EBC_CMPGTE
= 0x07,
38
EBC_CMPULTE
= 0x08,
39
EBC_CMPUGTE
= 0x09,
40
EBC_NOT
= 0x0A,
41
EBC_NEG
= 0x0B,
42
EBC_ADD
= 0x0C,
43
EBC_SUB
= 0x0D,
44
EBC_MUL
= 0x0E,
45
EBC_MULU
= 0x0F,
46
EBC_DIV
= 0x10,
47
EBC_DIVU
= 0x11,
48
EBC_MOD
= 0x12,
49
EBC_MODU
= 0x13,
50
EBC_AND
= 0x14,
51
EBC_OR
= 0x15,
52
EBC_XOR
= 0x16,
53
EBC_SHL
= 0x17,
54
EBC_SHR
= 0x18,
55
EBC_ASHR
= 0x19,
56
EBC_EXTNDB
= 0x1A,
57
EBC_EXTNDW
= 0x1B,
58
EBC_EXTNDD
= 0x1C,
59
EBC_MOVBW
= 0x1D,
60
EBC_MOVWW
= 0x1E,
61
EBC_MOVDW
= 0x1F,
62
EBC_MOVQW
= 0x20,
63
EBC_MOVBD
= 0x21,
64
EBC_MOVWD
= 0x22,
65
EBC_MOVDD
= 0x23,
66
EBC_MOVQD
= 0x24,
67
EBC_MOVSNW
= 0x25,
68
EBC_MOVSND
= 0x26,
69
EBC_UNDEFINED
= 0x27,
70
EBC_MOVQQ
= 0x28,
71
EBC_LOADSP
= 0x29,
72
EBC_STORESP
= 0x2A,
73
EBC_PUSH
= 0x2B,
74
EBC_POP
= 0x2C,
75
EBC_CMPIEQ
= 0x2D,
76
EBC_CMPILTE
= 0x2E,
77
EBC_CMPIGTE
= 0x2F,
78
EBC_CMPIULTE
= 0x30,
79
EBC_CMPIUGTE
= 0x31,
80
EBC_MOVNW
= 0x32,
81
EBC_MOVND
= 0x33,
82
EBC_UNDEFINED2
= 0x34,
83
EBC_PUSHN
= 0x35,
84
EBC_POPN
= 0x36,
85
EBC_MOVI
= 0x37,
86
EBC_MOVIN
= 0x38,
87
EBC_MOVREL
= 0x39,
88
EBC_COMMAND_NUM
89
};
90
91
typedef
struct
ebc_command
{
92
char
instr
[
EBC_INSTR_MAXLEN
];
93
char
operands
[
EBC_OPERANDS_MAXLEN
];
94
}
ebc_command_t
;
95
96
int
ebc_decode_command
(
const
uint8_t
*instr,
ebc_command_t
*
cmd
);
97
98
#endif
/* EBC_DISAS_H */
cmd
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
Definition:
sflib.h:79
EBC_INSTR_MAXLEN
#define EBC_INSTR_MAXLEN
Definition:
ebc_disas.h:20
EBC_OPERANDS_MAXLEN
#define EBC_OPERANDS_MAXLEN
Definition:
ebc_disas.h:21
ebc_decode_command
int ebc_decode_command(const uint8_t *instr, ebc_command_t *cmd)
Definition:
ebc_disas.c:986
ebc_command_t
struct ebc_command ebc_command_t
ebc_opcodes
ebc_opcodes
Definition:
ebc_disas.h:29
EBC_LOADSP
@ EBC_LOADSP
Definition:
ebc_disas.h:71
EBC_NOT
@ EBC_NOT
Definition:
ebc_disas.h:40
EBC_ADD
@ EBC_ADD
Definition:
ebc_disas.h:42
EBC_PUSH
@ EBC_PUSH
Definition:
ebc_disas.h:73
EBC_SHL
@ EBC_SHL
Definition:
ebc_disas.h:53
EBC_CMPIUGTE
@ EBC_CMPIUGTE
Definition:
ebc_disas.h:79
EBC_JMP8
@ EBC_JMP8
Definition:
ebc_disas.h:32
EBC_MOVDD
@ EBC_MOVDD
Definition:
ebc_disas.h:65
EBC_MUL
@ EBC_MUL
Definition:
ebc_disas.h:44
EBC_MULU
@ EBC_MULU
Definition:
ebc_disas.h:45
EBC_DIV
@ EBC_DIV
Definition:
ebc_disas.h:46
EBC_ASHR
@ EBC_ASHR
Definition:
ebc_disas.h:55
EBC_SUB
@ EBC_SUB
Definition:
ebc_disas.h:43
EBC_CMPULTE
@ EBC_CMPULTE
Definition:
ebc_disas.h:38
EBC_POP
@ EBC_POP
Definition:
ebc_disas.h:74
EBC_EXTNDD
@ EBC_EXTNDD
Definition:
ebc_disas.h:58
EBC_MOVDW
@ EBC_MOVDW
Definition:
ebc_disas.h:61
EBC_COMMAND_NUM
@ EBC_COMMAND_NUM
Definition:
ebc_disas.h:88
EBC_UNDEFINED
@ EBC_UNDEFINED
Definition:
ebc_disas.h:69
EBC_CMPLTE
@ EBC_CMPLTE
Definition:
ebc_disas.h:36
EBC_MOD
@ EBC_MOD
Definition:
ebc_disas.h:48
EBC_STORESP
@ EBC_STORESP
Definition:
ebc_disas.h:72
EBC_RET
@ EBC_RET
Definition:
ebc_disas.h:34
EBC_CALL
@ EBC_CALL
Definition:
ebc_disas.h:33
EBC_MOVQQ
@ EBC_MOVQQ
Definition:
ebc_disas.h:70
EBC_MOVQW
@ EBC_MOVQW
Definition:
ebc_disas.h:62
EBC_XOR
@ EBC_XOR
Definition:
ebc_disas.h:52
EBC_EXTNDW
@ EBC_EXTNDW
Definition:
ebc_disas.h:57
EBC_MOVQD
@ EBC_MOVQD
Definition:
ebc_disas.h:66
EBC_CMPEQ
@ EBC_CMPEQ
Definition:
ebc_disas.h:35
EBC_MOVI
@ EBC_MOVI
Definition:
ebc_disas.h:85
EBC_MODU
@ EBC_MODU
Definition:
ebc_disas.h:49
EBC_CMPIULTE
@ EBC_CMPIULTE
Definition:
ebc_disas.h:78
EBC_CMPGTE
@ EBC_CMPGTE
Definition:
ebc_disas.h:37
EBC_MOVSNW
@ EBC_MOVSNW
Definition:
ebc_disas.h:67
EBC_DIVU
@ EBC_DIVU
Definition:
ebc_disas.h:47
EBC_CMPUGTE
@ EBC_CMPUGTE
Definition:
ebc_disas.h:39
EBC_JMP
@ EBC_JMP
Definition:
ebc_disas.h:31
EBC_MOVREL
@ EBC_MOVREL
Definition:
ebc_disas.h:87
EBC_MOVWW
@ EBC_MOVWW
Definition:
ebc_disas.h:60
EBC_NEG
@ EBC_NEG
Definition:
ebc_disas.h:41
EBC_CMPILTE
@ EBC_CMPILTE
Definition:
ebc_disas.h:76
EBC_EXTNDB
@ EBC_EXTNDB
Definition:
ebc_disas.h:56
EBC_MOVBW
@ EBC_MOVBW
Definition:
ebc_disas.h:59
EBC_MOVIN
@ EBC_MOVIN
Definition:
ebc_disas.h:86
EBC_SHR
@ EBC_SHR
Definition:
ebc_disas.h:54
EBC_BREAK
@ EBC_BREAK
Definition:
ebc_disas.h:30
EBC_POPN
@ EBC_POPN
Definition:
ebc_disas.h:84
EBC_MOVSND
@ EBC_MOVSND
Definition:
ebc_disas.h:68
EBC_CMPIGTE
@ EBC_CMPIGTE
Definition:
ebc_disas.h:77
EBC_AND
@ EBC_AND
Definition:
ebc_disas.h:50
EBC_MOVBD
@ EBC_MOVBD
Definition:
ebc_disas.h:63
EBC_MOVWD
@ EBC_MOVWD
Definition:
ebc_disas.h:64
EBC_UNDEFINED2
@ EBC_UNDEFINED2
Definition:
ebc_disas.h:82
EBC_PUSHN
@ EBC_PUSHN
Definition:
ebc_disas.h:83
EBC_CMPIEQ
@ EBC_CMPIEQ
Definition:
ebc_disas.h:75
EBC_OR
@ EBC_OR
Definition:
ebc_disas.h:51
EBC_MOVNW
@ EBC_MOVNW
Definition:
ebc_disas.h:80
EBC_MOVND
@ EBC_MOVND
Definition:
ebc_disas.h:81
uint8_t
unsigned char uint8_t
Definition:
sftypes.h:31
stdint.h
ebc_command
Definition:
ebc_disas.h:91
ebc_command::instr
char instr[EBC_INSTR_MAXLEN]
Definition:
ebc_disas.h:92
operands
Definition:
analysis_or1k.c:9
librz
asm
arch
ebc
ebc_disas.h
Generated by
1.9.1