summaryrefslogtreecommitdiff
path: root/x86_64
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-10 18:42:42 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-10 18:42:42 +0200
commitf895575c639e338474c7de6678ee8f3a0756c0d1 (patch)
tree9e29795a1d780f4bce7a5497f32f6817f7c7f43f /x86_64
parenteff4f7477b38b5b794ce1ede7766af1dcb6f8fde (diff)
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.
Diffstat (limited to 'x86_64')
-rw-r--r--x86_64/locore.S6
1 files changed, 4 insertions, 2 deletions
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.