13 #define EMIT_NAME emit_x64
19 #define SYSCALL_ATT "syscall"
20 #define SYSCALL_INTEL "syscall"
21 #define RZ_REG_AR_OFF 1
22 static char *
regs[] = {
"rax",
"rdi",
"rsi",
"rdx",
"r10",
"r8",
"r9" };
24 #define EMIT_NAME emit_x86
30 #define SYSCALL_ATT "int $0x80"
31 #define SYSCALL_INTEL "int 0x80"
32 #define RZ_REG_AR_OFF 0
33 static char *
regs[] = {
"eax",
"ebx",
"ecx",
"edx",
"esi",
"edi",
"ebp" };
36 #define RZ_NGP (sizeof(regs) / sizeof(char *))
61 " : mov rax, `.arg`\n"
65 " : mov eax, `.arg`\n"
86 " sub $%d, %%" RZ_SP "\n",
92 " sub " RZ_SP ", %d\n",
130 if (i < 0 || i >=
RZ_NGP) {
138 for (j = 0; j <
nargs; j++) {
142 eprintf(
"Cannot find gpr %d\n", j + 1);
172 #define BPOFF (RZ_SZ - 4)
173 #define M32(x) (unsigned int)((x)&0xffffffff)
175 for (
i = 4;
i <= oj;
i += 4) {
219 for (
i=0;
i<oj;
i+=4) {
221 int *
n = (
int *)(
str+
i);
261 eprintf(
"Jump without destination\n");
357 }
else if (
idx < 0) {
365 eprintf(
"WARNING: Using stack vars in naked functions\n");
369 }
else if (
idx < 0) {
378 }
else if (
idx < 0) {
394 char *
p = strchr(
dst,
'+');
415 int signed_value = 1;
420 op =
e ?
"jge" :
"jg";
422 op =
e ?
"jae" :
"ja";
428 op =
e ?
"jle" :
"jl";
430 op =
e ?
"jbe" :
"jb";
501 case '^':
op =
"xor";
break;
502 case '&':
op =
"and";
break;
503 case '|':
op =
"or";
break;
504 case '-':
op =
"sub";
break;
505 case '+':
op =
"add";
break;
506 case '*':
op =
"mul";
break;
507 case '/':
op =
"div";
break;
508 default:
op =
"mov";
break;
const lzma_allocator const uint8_t size_t uint8_t * out
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 static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
RZ_API void rz_egg_printf(RzEgg *egg, const char *fmt,...)
RZ_API char * rz_egg_mkvar(RzEgg *egg, char *out, const char *_str, int delta)
static void emit_comment(RzEgg *egg, const char *fmt,...)
static void emit_branch(RzEgg *egg, char *b, char *g, char *e, char *n, int sz, const char *dst)
static char * emit_syscall(RzEgg *egg, int nargs)
static void emit_string(RzEgg *egg, const char *dstvar, const char *str, int j)
static void emit_jmp(RzEgg *egg, const char *str, int atr)
static void emit_call(RzEgg *egg, const char *str, int atr)
static void emit_init(RzEgg *egg)
static const char * getreg(int i)
static void emit_frame_end(RzEgg *egg, int sz, int ctx)
static void emit_get_ar(RzEgg *egg, char *out, int idx)
static void emit_get_while_end(RzEgg *egg, char *str, const char *ctxpush, const char *label)
static void emit_trap(RzEgg *egg)
static void emit_restore_stack(RzEgg *egg, int size)
static void emit_while_end(RzEgg *egg, const char *labelback)
static void emit_get_var(RzEgg *egg, int type, char *out, int idx)
static void emit_load(RzEgg *egg, const char *dst, int sz)
static const char * emit_regs(RzEgg *egg, int idx)
static void emit_arg(RzEgg *egg, int xs, int num, const char *str)
static void emit_mathop(RzEgg *egg, int ch, int vs, int type, const char *eq, const char *p)
static void emit_syscall_args(RzEgg *egg, int nargs)
static void emit_get_result(RzEgg *egg, const char *ocn)
static void emit_frame(RzEgg *egg, int sz)
static void emit_load_ptr(RzEgg *egg, const char *dst)
static void emit_equ(RzEgg *egg, const char *key, const char *value)
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")