This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fbed4ece2ccd40d9f6b70a67c81cdf1b3908db36
Author: hujun5 <[email protected]>
AuthorDate: Mon Sep 30 11:11:01 2024 +0800

    x86_64: we should call x86_64_restorestate/x86_64_savestate
    
    reason:
    In x86_64, g_current_regs is still used for context switching.
    
    This commit fixes the regression from 
https://github.com/apache/nuttx/pull/13616
    
    Signed-off-by: hujun5 <[email protected]>
---
 arch/x86_64/src/intel64/intel64_cpupause.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86_64/src/intel64/intel64_cpupause.c 
b/arch/x86_64/src/intel64/intel64_cpupause.c
index 7f6891d24c..9d95e8f08d 100644
--- a/arch/x86_64/src/intel64/intel64_cpupause.c
+++ b/arch/x86_64/src/intel64/intel64_cpupause.c
@@ -286,9 +286,16 @@ int up_pause_handler(int irq, void *c, void *arg)
 
 int up_pause_async_handler(int irq, void *c, void *arg)
 {
+  struct tcb_s *tcb;
   int cpu = this_cpu();
 
+  tcb = current_task(cpu);
+  nxsched_suspend_scheduler(tcb);
+  x86_64_savestate(tcb->xcp.regs);
   nxsched_process_delivered(cpu);
+  tcb = current_task(cpu);
+  nxsched_resume_scheduler(tcb);
+  x86_64_restorestate(tcb->xcp.regs);
 
   return OK;
 }

Reply via email to