From f1a5b91cd897a4f8a9628ec3c3df859393ca1e1b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 16 Dec 2016 09:21:44 -0600 Subject: [PATCH] Use r6, not r2 when passing paramters with call4 --- arch/xtensa/src/common/xtensa_int_handlers.S | 9 ++++++--- arch/xtensa/src/common/xtensa_panic.S | 10 ++++++++-- arch/xtensa/src/common/xtensa_user_handler.S | 14 +++++++++----- arch/xtensa/src/esp32/esp32_cpuhead.S | 4 ++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/arch/xtensa/src/common/xtensa_int_handlers.S b/arch/xtensa/src/common/xtensa_int_handlers.S index f20e1568c9..bf83f0cb09 100644 --- a/arch/xtensa/src/common/xtensa_int_handlers.S +++ b/arch/xtensa/src/common/xtensa_int_handlers.S @@ -158,10 +158,11 @@ * area as a parameter (A2). */ - mov a2, a12 /* Argument: Top of stack = register save area */ #ifdef __XTENSA_CALL0_ABI__ + mov a2, a12 /* Argument: Top of stack = register save area */ call0 xtensa_int_decode /* Call xtensa_int_decode */ #else + mov a6, a12 /* Argument: Top of stack = register save area */ call4 xtensa_int_decode /* Call xtensa_int_decode */ #endif @@ -193,14 +194,16 @@ * * REVISIT: Here we explicitly assume that the INTERRUPT XT_TIMER_INTEN * corresponds to TIMER0. That is probably that case, but not necessarily - * so. + * so. xtensa_timer.h should probably select the IRQ number as well. */ +#ifdef __XTENSA_CALL0_ABI__ movi a2, XTENSA_IRQ_TIMER0 /* Argument 1: Timer0 IRQ number */ mov a3, a12 /* Argument 2: Top of stack = register save area */ -#ifdef __XTENSA_CALL0_ABI__ call0 xtensa_irq_dispatch /* Call xtensa_int_decode */ #else + movi a6, XTENSA_IRQ_TIMER0 /* Argument 1: Timer0 IRQ number */ + mov a7, a12 /* Argument 2: Top of stack = register save area */ call4 xtensa_irq_dispatch /* Call xtensa_int_decode */ #endif diff --git a/arch/xtensa/src/common/xtensa_panic.S b/arch/xtensa/src/common/xtensa_panic.S index 9e300190a1..c526eab6d4 100644 --- a/arch/xtensa/src/common/xtensa_panic.S +++ b/arch/xtensa/src/common/xtensa_panic.S @@ -98,6 +98,10 @@ .align 4 _xtensa_panic: + /* Save the exception code */ + + wsr a2, EXCSAVE_1 + /* Save rest of interrupt context (A2=address of state save area on * stack. */ @@ -126,11 +130,13 @@ _xtensa_panic: * of the register save area. */ - mov a3, sp - #ifdef __XTENSA_CALL0_ABI__ + rsr a2, EXCSAVE_1 + mov a3, sp call0 xtensa_panic /* Call xtensa_panic. Should not return */ #else + rsr a6, EXCSAVE_1 + mov a7, sp call4 xtensa_panic /* Call xtensa_panic. Should not return */ #endif diff --git a/arch/xtensa/src/common/xtensa_user_handler.S b/arch/xtensa/src/common/xtensa_user_handler.S index 9c9c80bc59..924cb2554a 100644 --- a/arch/xtensa/src/common/xtensa_user_handler.S +++ b/arch/xtensa/src/common/xtensa_user_handler.S @@ -229,12 +229,13 @@ _xtensa_user_handler: * beginning of the register save area. */ +#ifdef __XTENSA_CALL0_ABI__ rsr a2, EXCCAUSE /* Argument 1 (a2) = EXCCAUSE */ mov a3, sp /* Argument 2 (a2) = pointer to register save area */ - -#ifdef __XTENSA_CALL0_ABI__ calx0 xtensa_user /* Call xtensa_user */ #else + rsr a6, EXCCAUSE /* Argument 1 (a2) = EXCCAUSE */ + mov a7, sp /* Argument 2 (a2) = pointer to register save area */ call4 xtensa_user /* Call xtensa_user */ #endif @@ -333,11 +334,13 @@ _xtensa_syscall_handler: */ mov a12, sp /* a12 = address of register save area */ +#ifdef __XTENSA_CALL0_ABI__ movi a2, XTENSA_IRQ_SYSCALL /* Argument 1: IRQ number */ mov a3, a12 /* Argument 2: Top of stack = register save area */ -#ifdef __XTENSA_CALL0_ABI__ call0 xtensa_irq_dispatch /* Call xtensa_int_decode */ #else + movi a6, XTENSA_IRQ_SYSCALL /* Argument 1: IRQ number */ + mov a7, a12 /* Argument 2: Top of stack = register save area */ call4 xtensa_irq_dispatch /* Call xtensa_int_decode */ #endif @@ -468,12 +471,13 @@ _xtensa_coproc_handler: * beginning of the register save area. */ +#ifdef __XTENSA_CALL0_ABI__ rsr a2, EXCCAUSE /* Argument 1 (a2) = EXCCAUSE */ mov a3, sp /* Argument 2 (a2) = pointer to register save area */ - -#ifdef __XTENSA_CALL0_ABI__ calx0 xtensa_user /* Call xtensa_user */ #else + rsr a6, EXCCAUSE /* Argument 1 (a2) = EXCCAUSE */ + mov a7, sp /* Argument 2 (a2) = pointer to register save area */ call4 xtensa_user /* Call xtensa_user */ #endif diff --git a/arch/xtensa/src/esp32/esp32_cpuhead.S b/arch/xtensa/src/esp32/esp32_cpuhead.S index a33a8a05ac..03132fd8b1 100644 --- a/arch/xtensa/src/esp32/esp32_cpuhead.S +++ b/arch/xtensa/src/esp32/esp32_cpuhead.S @@ -138,11 +138,11 @@ __cpu1_start: /* Finish initialization in C */ - movi a2, 1 /* Argument 1: CPU ID */ - #ifdef __XTENSA_CALL0_ABI__ + movi a2, 1 /* Argument 1: CPU ID */ call0 xtensa_start_handler #else + movi a6, 1 /* Argument 1: CPU ID */ call4 xtensa_start_handler #endif