From 658efaee172a8f6a12c6f597bf5d28ed76c7a66e Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Thu, 14 Mar 2013 17:03:35 +0100 Subject: [PATCH] FOC: Fix 'user_flags' on x86 Use carry bit in EFLAGS to pass thread state to ex_reg caller. Do not touch other bits, which might disable interrupts on kernel exit. Fixes ssumpf/foc#2. --- kernel/fiasco/src/kern/ia32/thread-ia32.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/fiasco/src/kern/ia32/thread-ia32.cpp b/kernel/fiasco/src/kern/ia32/thread-ia32.cpp index 1cb91dcf..5686f8d6 100644 --- a/kernel/fiasco/src/kern/ia32/thread-ia32.cpp +++ b/kernel/fiasco/src/kern/ia32/thread-ia32.cpp @@ -92,7 +92,10 @@ Thread::user_ip() const IMPLEMENT inline Mword Thread::user_flags() const -{ return state() & Thread_ready; } +{ + // pass thread-ready state in carry flag (Thread_ready is bit 0) + return (regs()->flags() & ~Thread_ready) | (state() & Thread_ready); +} /** Check if the pagefault occured at a special place: At some places in the kernel we want to ensure that a specific address is mapped. The regular