From c8875d39f2dae7eaf215c835357ee0d09f4ff8d8 Mon Sep 17 00:00:00 2001 From: Lucas Schumacher Date: Mon, 14 Apr 2025 20:57:23 -0400 Subject: [PATCH] Add memory to clobber list for read syscalls --- arch/aarch64.c | 2 +- arch/mips.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/aarch64.c b/arch/aarch64.c index 6a953c4..4b5d9ba 100644 --- a/arch/aarch64.c +++ b/arch/aarch64.c @@ -48,7 +48,7 @@ intptr_t read(int32_t fd, const void* buf, intptr_t size){ // Input operands : "r"((int64_t)fd), "r" (buf), "r"(size) // Clobbered registers - : "x0", "x1", "x2", "x8" + : "x0", "x1", "x2", "x8", "memory" ); return n_read; } diff --git a/arch/mips.c b/arch/mips.c index 0fdcf8c..1fc42dd 100644 --- a/arch/mips.c +++ b/arch/mips.c @@ -39,7 +39,7 @@ intptr_t read(int32_t fd, const void* buf, intptr_t size){ "move %0, $v0\n" : "=r"(n_read) : "r"(fd), "r"(buf), "r"(size) - : "a0", "a1", "a2", "v0" //TODO: temp registers clobbered by syscall should probably also be listed but this fn returns right away so it should be fine? + : "a0", "a1", "a2", "v0", "memory" //TODO: temp registers clobbered by syscall should probably also be listed but this fn returns right away so it should be fine? ); return n_read; }