aboutsummaryrefslogtreecommitdiff
path: root/executor/x86_64/asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'executor/x86_64/asm.c')
-rw-r--r--executor/x86_64/asm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/executor/x86_64/asm.c b/executor/x86_64/asm.c
index a400656..cf56b69 100644
--- a/executor/x86_64/asm.c
+++ b/executor/x86_64/asm.c
@@ -70,6 +70,7 @@ static void ins_end(Asm *self, const char *fmt, ...) {
va_list args;
va_start(args, fmt);
+ fprintf(stderr, "%06x | ", (unsigned int)ins_start_offset);
ins_end_offset = (u8*)self->code_it - (u8*)self->code;
for(i = ins_start_offset; i < ins_end_offset; ++i) {
fprintf(stderr, "%02x ", ((u8*)self->code)[i]);
@@ -145,6 +146,8 @@ static const char* asm_ptr_to_string(AsmPtr *self) {
return buf;
}
#else
+#include <stdarg.h>
+
static void ins_start(Asm *self) {
(void)self;
}
@@ -478,6 +481,14 @@ void asm_callr(Asm *self, Reg64 reg) {
ins_end(self, "call %s", reg64_to_str(reg));
}
+void asm_callm(Asm *self, AsmPtr *ptr) {
+ ins_start(self);
+ *self->code_it++ = rex_rm(ptr, 0);
+ *self->code_it++ = 0xFF;
+ asm_rm(self, ptr, 0x2);
+ ins_end(self, "call %s", asm_ptr_to_string(ptr));
+}
+
/*
Note: This is sometimes called with @relative 0 (will print call -5), in which case it's most likely a dummy call until the relative position
is later changed with @asm_overwrite_call_rel32. TODO: Update the ins_end debug print to take that into account somehow