From f895575c639e338474c7de6678ee8f3a0756c0d1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 10 Aug 2023 18:42:42 +0200 Subject: x86_64: fix recursive disabling of interrupts In case interrupts were already disabled before TIME_TRAP_[US]ENTRY are called, we don't want to execute sti. --- x86_64/locore.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'x86_64') diff --git a/x86_64/locore.S b/x86_64/locore.S index 271a9071..42049cbe 100644 --- a/x86_64/locore.S +++ b/x86_64/locore.S @@ -225,6 +225,7 @@ LEXT(retry_table_end) ;\ * Uses %eax, %ebx, %ecx. */ #define TIME_TRAP_UENTRY \ + pushf /* Save flags */ ;\ cli /* block interrupts */ ;\ movl VA_ETC,%ebx /* get timer value */ ;\ movl CX(EXT(current_tstamp),%edx),%ecx /* get old time stamp */;\ @@ -237,7 +238,7 @@ LEXT(retry_table_end) ;\ 0: addl $(TH_SYSTEM_TIMER-TH_USER_TIMER),%ecx ;\ /* switch to sys timer */;\ movl %ecx,CX(EXT(current_timer),%edx) /* make it current */ ;\ - sti /* allow interrupts */ + popf /* allow interrupts */ /* * Update time on system call entry. @@ -247,6 +248,7 @@ LEXT(retry_table_end) ;\ * Same as TIME_TRAP_UENTRY, but preserves %eax. */ #define TIME_TRAP_SENTRY \ + pushf /* Save flags */ ;\ cli /* block interrupts */ ;\ movl VA_ETC,%ebx /* get timer value */ ;\ movl CX(EXT(current_tstamp),%edx),%ecx /* get old time stamp */;\ @@ -261,7 +263,7 @@ LEXT(retry_table_end) ;\ 0: addl $(TH_SYSTEM_TIMER-TH_USER_TIMER),%ecx ;\ /* switch to sys timer */;\ movl %ecx,CX(EXT(current_timer),%edx) /* make it current */ ;\ - sti /* allow interrupts */ + popf /* allow interrupts */ /* * update time on user trap exit. -- cgit v1.2.3