From fbed4ece2ccd40d9f6b70a67c81cdf1b3908db36 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Mon, 30 Sep 2024 11:11:01 +0800 Subject: [PATCH] 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 --- 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; }