2013-06-14 00:51:33 +00:00
|
|
|
/* radare - LGPL - Copyright 2009-2013 - pancake */
|
2011-02-02 12:02:20 +00:00
|
|
|
|
2014-03-27 15:34:17 +00:00
|
|
|
#ifndef R2_SYSCALL_H
|
|
|
|
#define R2_SYSCALL_H
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2013-06-18 10:09:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-03-04 00:46:25 +00:00
|
|
|
#include <r_types.h>
|
2011-09-04 03:33:59 +00:00
|
|
|
#include <r_db.h>
|
2010-03-04 00:46:25 +00:00
|
|
|
#include <list.h>
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2013-06-14 00:51:33 +00:00
|
|
|
R_LIB_VERSION_HEADER (r_syscall);
|
|
|
|
|
2013-04-21 23:09:27 +00:00
|
|
|
#define R_SYSCALL_ARGS 7
|
2011-02-02 12:02:20 +00:00
|
|
|
|
|
|
|
typedef struct r_syscall_regs_t {
|
2011-02-02 23:20:39 +00:00
|
|
|
const char *arg[R_SYSCALL_ARGS];
|
2011-02-02 12:02:20 +00:00
|
|
|
} RSyscallRegs;
|
|
|
|
|
2010-03-04 00:46:25 +00:00
|
|
|
typedef struct r_syscall_item_t {
|
2011-09-05 22:38:56 +00:00
|
|
|
char *name;
|
2010-01-26 00:28:33 +00:00
|
|
|
int swi;
|
|
|
|
int num;
|
|
|
|
int args;
|
|
|
|
char *sargs;
|
2010-03-04 00:46:25 +00:00
|
|
|
} RSyscallItem;
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2010-09-24 14:45:56 +00:00
|
|
|
typedef struct r_syscall_port_t {
|
|
|
|
int port;
|
|
|
|
const char *name;
|
|
|
|
} RSyscallPort;
|
|
|
|
|
2010-01-26 00:28:33 +00:00
|
|
|
typedef struct r_syscall_t {
|
|
|
|
FILE *fd;
|
2014-03-07 00:26:11 +00:00
|
|
|
// memoization
|
|
|
|
char *arch;
|
|
|
|
char *os;
|
|
|
|
int bits;
|
|
|
|
// database
|
2011-02-02 12:02:20 +00:00
|
|
|
RSyscallRegs *regs;
|
2010-03-04 00:46:25 +00:00
|
|
|
RSyscallItem *sysptr;
|
2010-09-24 14:45:56 +00:00
|
|
|
RSyscallPort *sysport;
|
2014-03-07 00:26:11 +00:00
|
|
|
Sdb *db;
|
2011-08-09 00:03:12 +00:00
|
|
|
// TODO: deprecate
|
2010-09-24 14:45:56 +00:00
|
|
|
PrintfCallback printf;
|
2010-01-26 00:28:33 +00:00
|
|
|
} RSyscall;
|
2009-08-14 00:37:18 +00:00
|
|
|
|
|
|
|
/* plugin struct */
|
2010-05-25 23:42:22 +00:00
|
|
|
typedef struct r_syscall_plugin_t {
|
2009-08-14 00:37:18 +00:00
|
|
|
char *name;
|
|
|
|
char *arch;
|
|
|
|
char *os;
|
|
|
|
char *desc;
|
|
|
|
int bits;
|
|
|
|
int nargs;
|
|
|
|
struct r_syscall_args_t *args;
|
|
|
|
struct list_head list;
|
2010-05-25 23:42:22 +00:00
|
|
|
} RSyscallPlugin;
|
2009-08-14 00:37:18 +00:00
|
|
|
|
2010-05-25 23:42:22 +00:00
|
|
|
typedef struct r_syscall_arch_plugin_t {
|
2009-08-14 00:37:18 +00:00
|
|
|
char *name;
|
|
|
|
char *arch;
|
|
|
|
char *desc;
|
|
|
|
int *bits;
|
|
|
|
int nargs;
|
|
|
|
struct r_syscall_args_t **args;
|
|
|
|
struct list_head list;
|
2010-05-25 23:42:22 +00:00
|
|
|
} RSyscallArchPlugin;
|
2010-01-26 00:28:33 +00:00
|
|
|
|
|
|
|
#ifdef R_API
|
2011-09-04 01:56:35 +00:00
|
|
|
R_API RSyscallItem *r_syscall_item_new_from_string(const char *name, const char *s);
|
|
|
|
R_API void r_syscall_item_free(RSyscallItem *si);
|
|
|
|
|
2010-03-04 00:46:25 +00:00
|
|
|
R_API RSyscall *r_syscall_new();
|
|
|
|
R_API void r_syscall_free(RSyscall *ctx);
|
2011-09-04 01:56:35 +00:00
|
|
|
R_API int r_syscall_setup(RSyscall *ctx, const char *arch, const char *os, int bits);
|
2010-03-04 00:46:25 +00:00
|
|
|
R_API int r_syscall_setup_file(RSyscall *ctx, const char *path);
|
|
|
|
R_API RSyscallItem *r_syscall_get(RSyscall *ctx, int num, int swi);
|
|
|
|
R_API int r_syscall_get_num(RSyscall *ctx, const char *str);
|
2011-09-04 03:33:59 +00:00
|
|
|
R_API char *r_syscall_get_i(RSyscall *ctx, int num, int swi);
|
2011-02-02 12:23:44 +00:00
|
|
|
R_API const char *r_syscall_reg(RSyscall *s, int idx, int num);
|
2011-07-02 08:14:46 +00:00
|
|
|
R_API RList *r_syscall_list(RSyscall *ctx);
|
2010-01-26 00:28:33 +00:00
|
|
|
#endif
|
2009-08-14 00:37:18 +00:00
|
|
|
|
2013-06-18 10:09:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-02-05 21:08:46 +00:00
|
|
|
#endif
|