Index: kernel/arch/ia32/src/asm.S
===================================================================
--- kernel/arch/ia32/src/asm.S	(revision 1b6c05874474756edce83105d74f551c672b1cc9)
+++ kernel/arch/ia32/src/asm.S	(revision 0cd21bfad0d0069f0e62f66d7dcacb27d6a92623)
@@ -32,4 +32,5 @@
 
 #include <arch/pm.h>
+#include <arch/cpu.h>
 #include <arch/mm/page.h>
 
@@ -190,5 +191,4 @@
 .global sysenter_handler
 sysenter_handler:
-	sti
 	subl $(ISTATE_REAL_SIZE), %esp
 
@@ -231,5 +231,19 @@
 	movw %ax, %es
 	
-	cld
+	/*
+	 * Sanitize EFLAGS.
+	 *
+	 * SYSENTER does not clear the NT flag, which could thus proliferate
+	 * from here to the IRET instruction via a context switch and result
+	 * in crash.
+	 *
+	 * SYSENTER does not clear DF, which the ABI assumes to be cleared.
+	 *
+	 * SYSENTER clears IF, which we would like to be set for syscalls.
+	 *
+	 */
+	pushl $(EFLAGS_IF)  /* specify EFLAGS bits that we want to set */
+	popfl	            /* set bits from the mask, clear or ignore others */
+
 	call syscall_handler
 	
