From 1a1f9b1cf2b16c1bea77d133795c216b8c3e2c51 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 8 Mar 2024 22:12:33 +0200 Subject: [PATCH] Kernel: Fix {read,write}_gs_sized input operands to work always --- kernel/include/kernel/Processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/include/kernel/Processor.h b/kernel/include/kernel/Processor.h index ce1aaad85e..0faeaf4aa7 100644 --- a/kernel/include/kernel/Processor.h +++ b/kernel/include/kernel/Processor.h @@ -69,7 +69,7 @@ namespace Kernel template static T read_gs_sized(uintptr_t offset) requires(sizeof(T) <= 8) { -#define __ASM_INPUT(operation) operation " %%gs:(%[offset]), %[result]" : [result]"=rm"(result) : [offset]"rm"(offset) +#define __ASM_INPUT(operation) operation " %%gs:%a[offset], %[result]" : [result]"=r"(result) : [offset]"ir"(offset) T result; if constexpr(sizeof(T) == 8) asm volatile(__ASM_INPUT("movq")); @@ -86,7 +86,7 @@ namespace Kernel template static void write_gs_sized(uintptr_t offset, T value) requires(sizeof(T) <= 8) { -#define __ASM_INPUT(operation) operation " %[value], %%gs:(%[offset])" :: [value]"rm"(value), [offset]"rm"(offset) : "memory" +#define __ASM_INPUT(operation) operation " %[value], %%gs:%a[offset]" :: [value]"r"(value), [offset]"ir"(offset) : "memory" if constexpr(sizeof(T) == 8) asm volatile(__ASM_INPUT("movq")); if constexpr(sizeof(T) == 4)