- Added pseudo-instruction .bits
  - Added asm_x86_nasm as static plugin
* r_bin
  - Added pe, pe64, elf64 and java as static plugins
This commit is contained in:
Nibble 2009-04-22 16:29:30 +02:00
parent e37ca5367e
commit f47b8c01e6
5 changed files with 33 additions and 16 deletions

1
configure vendored
View File

@ -260,6 +260,7 @@ echo "checking target system type... ${TARGET}"
[ "${CROSSBUILD}" = 1 ] && echo "using crosscompilation mode."
split_host BUILD HOST TARGET
[ -n "${prefix}" ] && PREFIX=${prefix}
echo "checking for working directories... ${WODIS}"
echo "using prefix '${PREFIX}'"
ACR_RMFILES=" test.c a.out a.exe"

View File

@ -11,7 +11,7 @@
static struct r_asm_handle_t *asm_static_plugins[] =
{ R_ASM_STATIC_PLUGINS };
static int r_asm_string(struct r_asm_aop_t *aop, const char *input)
static int r_asm_pseudo_string(struct r_asm_aop_t *aop, const char *input)
{
int len = 0;
char *arg = strchr(input, ' ');
@ -23,12 +23,11 @@ static int r_asm_string(struct r_asm_aop_t *aop, const char *input)
return len;
}
static int r_asm_arch(struct r_asm_t *a, const char *input)
static int r_asm_pseudo_arch(struct r_asm_t *a, const char *input)
{
char *arg = strchr(input, ' '), str[R_ASM_BUFSIZE];
if (arg) {
arg += 1;
sprintf(str, "asm_%s", arg);
sprintf(str, "asm_%s", arg+1);
if (!r_asm_set(a, str)) {
fprintf(stderr, "Error: Unknown plugin\n");
return -1;
@ -37,17 +36,26 @@ static int r_asm_arch(struct r_asm_t *a, const char *input)
return 0;
}
static int r_asm_org(struct r_asm_t *a, const char *input)
static int r_asm_pseudo_bits(struct r_asm_t *a, const char *input)
{
char *arg = strchr(input, ' ');
if (arg) {
arg += 1;
r_asm_set_pc(a, r_num_math(NULL, arg));
}
if (arg)
if (!(r_asm_set_bits(a, r_num_math(NULL, arg+1)))) {
fprintf(stderr, "Error: Unsupported bits value\n");
return -1;
}
return 0;
}
static int r_asm_byte(struct r_asm_aop_t *aop, const char *input)
static int r_asm_pseudo_org(struct r_asm_t *a, const char *input)
{
char *arg = strchr(input, ' ');
if (arg)
r_asm_set_pc(a, r_num_math(NULL, arg+1));
return 0;
}
static int r_asm_pseudo_byte(struct r_asm_aop_t *aop, const char *input)
{
int len = 0;
char *arg = strchr(input, ' ');
@ -286,13 +294,15 @@ R_API int r_asm_massemble(struct r_asm_t *a, struct r_asm_aop_t *aop, char *buf)
}
if ((ptr = strchr(ptr_start, '.'))) { /* Pseudo */
if (!memcmp(ptr, ".string", 7))
ret = r_asm_string(aop, ptr);
ret = r_asm_pseudo_string(aop, ptr);
else if (!memcmp(ptr, ".arch", 5))
ret = r_asm_arch(a, ptr);
ret = r_asm_pseudo_arch(a, ptr);
else if (!memcmp(ptr, ".bits", 5))
ret = r_asm_pseudo_bits(a, ptr);
else if (!memcmp(ptr, ".byte", 5))
ret = r_asm_byte(aop, ptr);
ret = r_asm_pseudo_byte(aop, ptr);
else if (!memcmp(ptr, ".org", 4))
ret = r_asm_org(a, ptr);
ret = r_asm_pseudo_org(a, ptr);
else return 0;
if (!ret)
continue;

View File

@ -12,11 +12,16 @@
#define R_ASM_STATIC_PLUGINS \
&r_asm_plugin_java, \
&r_asm_plugin_x86_olly, \
&r_asm_plugin_x86_nasm, \
&r_asm_plugin_mips, \
0
#define R_BIN_STATIC_PLUGINS \
&r_bin_plugin_elf , \
&r_bin_plugin_elf64 , \
&r_bin_plugin_pe , \
&r_bin_plugin_pe64 , \
&r_bin_plugin_java , \
0
#define R_BININFO_STATIC_PLUGINS \

View File

@ -9,8 +9,8 @@ USE_RIO=1
# static plugins
STATIC_DEBUG=0
RUNTIME_DEBUG=1
STATIC_ASM_PLUGINS=p/x86olly.mk p/mips.mk p/java.mk
STATIC_BIN_PLUGINS=p/elf.mk
STATIC_ASM_PLUGINS=p/x86olly.mk p/x86nasm.mk p/mips.mk p/java.mk
STATIC_BIN_PLUGINS=p/elf.mk p/elf64.mk p/pe.mk p/pe64.mk p/java.mk
STATIC_BP_PLUGINS=p/x86.mk
STATIC_BININFO_PLUGINS=p/addr2line.mk

View File

@ -69,6 +69,7 @@ extern struct r_asm_handle_t r_asm_plugin_mips;
extern struct r_asm_handle_t r_asm_plugin_x86;
extern struct r_asm_handle_t r_asm_plugin_x86_bea;
extern struct r_asm_handle_t r_asm_plugin_x86_olly;
extern struct r_asm_handle_t r_asm_plugin_x86_nasm;
extern struct r_asm_handle_t r_asm_plugin_arm;
extern struct r_asm_handle_t r_asm_plugin_csr;
extern struct r_asm_handle_t r_asm_plugin_m68k;