From 66dcd98e39b6cd93c49dcc2b8ca38495d30db075 Mon Sep 17 00:00:00 2001 From: Zihao Yu Date: Sun, 6 Dec 2020 23:19:05 +0800 Subject: [PATCH] native,platform: clear the FPU context in uc_example * This will fix the SIGSEGV sent by 4.19 kernel. It seems the cause is that a page fault is generated when restoring the FPU context with an fxrstor64 instruction. To work around, we just clear the FPU context in uc_example, so the kernel will not try to restore the FPU context. --- am/src/native/platform.c | 1 + 1 file changed, 1 insertion(+) diff --git a/am/src/native/platform.c b/am/src/native/platform.c index 61b0d53..0003aa6 100644 --- a/am/src/native/platform.c +++ b/am/src/native/platform.c @@ -137,6 +137,7 @@ static void init_platform() { // save the context template save_example_context(); + uc_example.uc_mcontext.fpregs = NULL; // clear the FPU context __am_get_intr_sigmask(&uc_example.uc_sigmask); // disable interrupts by default