aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-09-04 22:10:44 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-09-04 22:10:44 +0200
commitccd0a1ca865d3b640f902945df84bb2be388a755 (patch)
tree11d54050ca403b50cc3e122428b8e8ce42a060b6 /arch/x86_64
parentc6d5c461ff8ec1d8361c477a4318491755a24235 (diff)
downloadkernel-ccd0a1ca865d3b640f902945df84bb2be388a755.tar.xz
kernel-ccd0a1ca865d3b640f902945df84bb2be388a755.zip
x86_64/cpu: fix asm input constraint
The "X" constraint tells GCC that any operand whatsoever is valid to be placed in the assembler template. This makes no sense in this case, since that would allow for the exact expression to be inserted. If that happens, which it does when `-Og` is active, GCC is unable to assemble that template. The correct constraint is forcing the value into a register.
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/arch/cpu/global_descriptor_table.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86_64/arch/cpu/global_descriptor_table.hpp b/arch/x86_64/arch/cpu/global_descriptor_table.hpp
index 986dd566..0bd7677d 100644
--- a/arch/x86_64/arch/cpu/global_descriptor_table.hpp
+++ b/arch/x86_64/arch/cpu/global_descriptor_table.hpp
@@ -73,8 +73,8 @@ namespace arch::cpu
"mov %%rax, %%fs\n"
"mov %%rax, %%gs\n"
:
- : "X"(code_segment_index * sizeof(segment_descriptor)),
- "X"(data_segment_index * sizeof(segment_descriptor))
+ : "r"(code_segment_index * sizeof(segment_descriptor)),
+ "r"(data_segment_index * sizeof(segment_descriptor))
: "rax");
}