From: Amelia Coutard <eliottulio.coutard@gmail.com>
Date: Mon, 13 Mar 2023 22:43:45 +0000 (+0100)
Subject: Changed the instruction that jumps to ring 3 from sysretq to iretq
X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=166fed6ea0ff1a5e990f20bae708aa619d669db8;p=voyage-au-centre-des-fichiers.git

Changed the instruction that jumps to ring 3 from sysretq to iretq
---

diff --git a/kernel/src/ring3.S b/kernel/src/ring3.S
index 2b6a783..6d9b55f 100644
--- a/kernel/src/ring3.S
+++ b/kernel/src/ring3.S
@@ -15,10 +15,19 @@
 
 .globl ftl_to_userspace
 ftl_to_userspace:
-	mov %rdi, %rcx
-	mov %rsi, %rsp
-	mov $0x202, %r11 # EFLAGS
-	sysretq
+	mov $(8 * 3) | 3, %ax
+	mov %ax, %ds
+	mov %ax, %es
+	mov %ax, %fs
+	mov %ax, %gs
+	# iretq handles cs and ss
+
+	pushq $(8 * 3) | 3
+	pushq %rsi
+	pushfq
+	pushq $(8 * 4) | 3
+	pushq %rdi
+	iretq
 
 .globl load_tss
 load_tss: