aboutsummaryrefslogtreecommitdiff
path: root/executor/x86_64
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-11 17:41:33 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-11 17:41:33 +0100
commit6cad09ec9c801e90d41f53ebcd673ef89050cc86 (patch)
treea57b30c824c663ed7730a6df6f2478a4a5b500e8 /executor/x86_64
parent8d1532abb6f7441e00ffbc7ed4d0231e5023e19a (diff)
Check if file to read is really a fileHEADmaster
Diffstat (limited to 'executor/x86_64')
-rw-r--r--executor/x86_64/asm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/executor/x86_64/asm.c b/executor/x86_64/asm.c
index f57f117..718ebef 100644
--- a/executor/x86_64/asm.c
+++ b/executor/x86_64/asm.c
@@ -206,7 +206,7 @@ int asm_init(Asm *self) {
amal_log_debug("asm: page size: %u", self->allocated_size);
self->code = mmap(NULL, self->allocated_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if(self->code == MAP_FAILED)
- return -errno;
+ return -1;
self->code_it = self->code;
return 0;
}
@@ -253,7 +253,7 @@ typedef union {
int asm_execute(Asm *self, u32 offset) {
RawFuncCallPtr raw_func_ptr;
if(mprotect(self->code, self->allocated_size, PROT_READ | PROT_EXEC) != 0)
- return -errno;
+ return -1;
/*asm_print_code_hex(self);*/
@@ -270,7 +270,7 @@ int asm_ensure_capacity(Asm *self, usize size) {
usize new_size = self->allocated_size + am_pagesize();
void *new_mem = mmap(NULL, new_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if(new_mem == MAP_FAILED)
- return -errno;
+ return -1;
am_memcpy(new_mem, self->code, self->allocated_size);
munmap(self->code, self->allocated_size);