From: Benoît Canet <benoit.canet.cont...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
syscall: restore rflag once syscall was handled
the syscall assembly instruction save the X64 flag
register rflag into r11 so the sysret instruction
can restore it.
Since OSv syscall hander does not use sysret since
it switch to privilege level 3 we must restore rflag
before doing the final jump.
Does it by pushing r11 on the stack and using
popfq to restore rflags.
Fixes #798
Signed-off-by: Benoît Canet <ben...@scylladb.com>
Message-Id: <1477570022-14541-12-git-send-email-ben...@scylladb.com>
Signed-off-by: Nadav Har'El <n...@scylladb.com>
---
diff --git a/arch/x64/entry.S b/arch/x64/entry.S
--- a/arch/x64/entry.S
+++ b/arch/x64/entry.S
@@ -276,7 +276,15 @@ syscall_entry:
popq_cfi %rcx
movq 8(%rsp), %rsp # undo alignment (as explained above)
- addq $128, %rsp # undo red-zone skip
+
+ # restore rflags
+ # push the rflag state syscall saved in r11 to the stack
+ pushq %r11
+ # pop the stack value in flag register
+ popfq
+
+ #undo red-zone skip without altering restored flags
+ lea 128(%rsp), %rsp
# jump to rcx where the syscall instruction put rip
# (sysret would leave rxc cloberred so we have nothing to do to
restore it)
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.