Rizin
unix-like reverse engineering framework and cli tools
asm_ppc_as.c
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2020 eagleoflqj <liumeo@pku.edu.cn>
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#include <
rz_lib.h
>
5
#include "../binutils_as.h"
6
7
#define ASSEMBLER "RZ_PPC_AS"
8
9
static
int
assemble
(
RzAsm
*
a
,
RzAsmOp
*
op
,
const
char
*
buf
) {
10
#if __powerpc__
11
char
*as =
"as"
;
12
#else
13
char
*as =
""
;
14
#endif
15
char
cmd_opt[4096];
16
snprintf
(cmd_opt,
sizeof
(cmd_opt),
"-mregnames -a%d %s"
,
17
a
->bits,
a
->big_endian ?
"-be"
:
"-le"
);
18
return
binutils_assemble
(
a
,
op
,
buf
,
19
as,
ASSEMBLER
,
""
, cmd_opt);
20
}
21
22
RzAsmPlugin
rz_asm_plugin_ppc_as
= {
23
.
name
=
"ppc.as"
,
24
.desc =
"as PPC Assembler (use "
ASSEMBLER
" environment)"
,
25
.arch =
"ppc"
,
26
.author =
"eagleoflqj"
,
27
.license =
"LGPL3"
,
28
.bits = 32 | 64,
29
.endian =
RZ_SYS_ENDIAN_LITTLE
|
RZ_SYS_ENDIAN_BIG
,
30
.assemble = &
assemble
,
31
};
32
33
#ifndef RZ_PLUGIN_INCORE
34
RZ_API
RzLibStruct
rizin_plugin
= {
35
.
type
=
RZ_LIB_TYPE_ASM
,
36
.data = &
rz_asm_plugin_ppc_as
,
37
.
version
=
RZ_VERSION
38
};
39
#endif
rizin_plugin
RZ_API RzLibStruct rizin_plugin
Definition:
asm_ppc_as.c:34
rz_asm_plugin_ppc_as
RzAsmPlugin rz_asm_plugin_ppc_as
Definition:
asm_ppc_as.c:22
ASSEMBLER
#define ASSEMBLER
Definition:
asm_ppc_as.c:7
assemble
static int assemble(RzAsm *a, RzAsmOp *op, const char *buf)
Definition:
asm_ppc_as.c:9
binutils_assemble
int binutils_assemble(RzAsm *a, RzAsmOp *op, const char *buf, const char *as, const char *env, const char *header, const char *cmd_opt)
Definition:
binutils_as.c:7
RZ_API
#define RZ_API
Definition:
core_plugin_example.c:36
buf
voidpf void * buf
Definition:
ioapi.h:138
snprintf
snprintf
Definition:
kernel.h:364
rz_lib.h
RZ_LIB_TYPE_ASM
@ RZ_LIB_TYPE_ASM
Definition:
rz_lib.h:72
RZ_SYS_ENDIAN_BIG
#define RZ_SYS_ENDIAN_BIG
Definition:
rz_types.h:527
RZ_SYS_ENDIAN_LITTLE
#define RZ_SYS_ENDIAN_LITTLE
Definition:
rz_types.h:526
RZ_VERSION
#define RZ_VERSION
Definition:
rz_version.h:8
a
#define a(i)
Definition:
sha256.c:41
rz_asm_op_t
Definition:
rz_asm.h:66
rz_asm_plugin_t
Definition:
rz_asm.h:129
rz_asm_plugin_t::name
const char * name
Definition:
rz_asm.h:130
rz_asm_plugin_t::version
const char * version
Definition:
rz_asm.h:133
rz_asm_t
Definition:
rz_asm.h:98
rz_lib_struct_t
Definition:
rz_lib.h:57
rz_lib_struct_t::type
int type
Definition:
rz_lib.h:58
op
Definition:
dis.c:32
librz
asm
p
asm_ppc_as.c
Generated by
1.9.1