]> git.ameliathe1st.gay Git - voyage-au-centre-des-fichiers.git/commitdiff
Changed the instruction that jumps to ring 3 from sysretq to iretq
authorAmelia Coutard <eliottulio.coutard@gmail.com>
Mon, 13 Mar 2023 22:43:45 +0000 (23:43 +0100)
committerAmelia Coutard <eliottulio.coutard@gmail.com>
Mon, 13 Mar 2023 22:43:45 +0000 (23:43 +0100)
kernel/src/ring3.S

index 2b6a7831feb55319dbdf2bc27c754113d7cf0fce..6d9b55fa59bde24bd5776dde7148d6576f2b3ed3 100644 (file)
 
 .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: