From 1c6aea2b05853158ba621da87eae1e5de0a1667f Mon Sep 17 00:00:00 2001 From: tkchia Date: Sun, 11 Sep 2022 22:49:04 +0000 Subject: [PATCH] Bare metal: do not use push/pop in long mode until stack set up This patch fixes a random problem with text segment corruption that would crop up occasionally. --- ape/ape.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ape/ape.S b/ape/ape.S index 9ff9f4cd9..5934353c7 100644 --- a/ape/ape.S +++ b/ape/ape.S @@ -1425,8 +1425,8 @@ golong: cli // Long mode is long. .code64 -long: push $GDT_LONG_DATA - pop %rax +long: xor %eax,%eax + mov $GDT_LONG_DATA,%al mov %eax,%ds mov %eax,%ss mov %eax,%es