From a57d22978c53bf0b8913eb9d3f075a15d31ab8ab Mon Sep 17 00:00:00 2001 From: schulz Date: Sat, 18 Apr 2015 16:15:29 +0000 Subject: [PATCH] execute SC_CAUSE only when system call will return to user mode. Without this fix, the Cause was executed unconditionaly from interrupts. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@50423 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/arm-native/kernel/syscall.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm-native/kernel/syscall.c b/arch/arm-native/kernel/syscall.c index 908f3ac42c..ab1b5a4778 100644 --- a/arch/arm-native/kernel/syscall.c +++ b/arch/arm-native/kernel/syscall.c @@ -48,7 +48,6 @@ asm ( " add r1, r0, #14*4 \n" // store lr^ in ctx_lr " stm r1, {lr}^ \n" " mov fp, #0 \n" // clear fp(??) - " bl handle_syscall \n" VECTCOMMON_END ); @@ -168,6 +167,16 @@ void handle_syscall(void *regs) break; } + + /* + * Execure core_SysCall only when we will go back to user mode. Default core_SysCall does + * not check this condition and could execute Cause() handler before IRQ is entirely handled. + */ + case SC_CAUSE: + if ((((uint32_t *)regs)[16] & 0x1f) == 0x10) + core_SysCall(swi_no, regs); + break; + default: core_SysCall(swi_no, regs); break; -- 2.11.4.GIT