Some trivial, cosmetic changes for irqlock branch
This commit is contained in:
parent
29cf2eb342
commit
f3d755c16f
@ -77,6 +77,7 @@ up_fullcontextrestore:
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARCH_FPU
|
||||
|
||||
/* First, restore the floating point registers. Lets do this before we
|
||||
* restore the ARM registers so that we have plenty of registers to
|
||||
* work with.
|
||||
@ -96,9 +97,11 @@ up_fullcontextrestore:
|
||||
|
||||
ldr r2, [r1], #4 /* Fetch the floating point control and status register */
|
||||
vmsr fpscr, r2 /* Restore the FPCSR */
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
|
||||
/* For the kernel build, we need to be able to transition gracefully
|
||||
* between kernel- and user-mode tasks. Here we do that with a system
|
||||
* call; the system call will execute in kernel mode and but can return
|
||||
@ -116,6 +119,7 @@ up_fullcontextrestore:
|
||||
bx lr /* Unnecessary ... will not return */
|
||||
|
||||
#else
|
||||
|
||||
/* For a flat build, we can do all of this here... Just think of this as
|
||||
* a longjmp() all on steriods.
|
||||
*/
|
||||
@ -129,11 +133,15 @@ up_fullcontextrestore:
|
||||
|
||||
sub sp, sp, #(3*4) /* Frame for three registers */
|
||||
ldr r1, [r0, #(4*REG_R0)] /* Fetch the stored r0 value */
|
||||
str r1, [sp] /* Save it at the top of the stack */
|
||||
str r1, [sp, #(4*0)] /* Save it at the top of the stack */
|
||||
ldr r1, [r0, #(4*REG_R1)] /* Fetch the stored r1 value */
|
||||
str r1, [sp, #4] /* Save it in the stack */
|
||||
str r1, [sp, #(4*1)] /* Save it in the stack */
|
||||
ldr r1, [r0, #(4*REG_PC)] /* Fetch the stored pc value */
|
||||
str r1, [sp, #8] /* Save it at the bottom of the frame */
|
||||
str r1, [sp, #(4*2)] /* Save it at the bottom of the frame */
|
||||
|
||||
/* Recover the saved CPSR value in r1 */
|
||||
|
||||
ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
|
||||
|
||||
/* Now we can restore the CPSR. We wait until we are completely
|
||||
* finished with the context save data to do this. Restore the CPSR
|
||||
@ -142,14 +150,13 @@ up_fullcontextrestore:
|
||||
* disabled.
|
||||
*/
|
||||
|
||||
ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
|
||||
msr cpsr, r1 /* Set the CPSR */
|
||||
|
||||
/* Now recover r0 and r1 */
|
||||
|
||||
ldr r0, [sp]
|
||||
ldr r1, [sp, #4]
|
||||
add sp, sp, #(2*4)
|
||||
add sp, sp, #(4*2)
|
||||
|
||||
/* Then return to the address at the stop of the stack,
|
||||
* destroying the stack frame
|
||||
|
@ -75,7 +75,7 @@
|
||||
* This function must be provided via the architecture-specific logoic.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lock - The address of spinlock object.
|
||||
* lock - The address of spinlock object (r0).
|
||||
*
|
||||
* Returned Value:
|
||||
* The spinlock is always locked upon return. The value of previous value
|
||||
@ -84,6 +84,8 @@
|
||||
* obtain the lock) or SP_UNLOCKED if the spinlock was previously unlocked
|
||||
* (meaning that we successfully obtained the lock)
|
||||
*
|
||||
* Modifies: r1, r2, and lr
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
.globl up_testset
|
||||
@ -98,7 +100,7 @@ up_testset:
|
||||
1:
|
||||
ldrexb r2, [r0] /* Test if spinlock is locked or not */
|
||||
cmp r2, r1 /* Already locked? */
|
||||
beq 2f /* If alrady locked, return SP_LOCKED */
|
||||
beq 2f /* If already locked, return SP_LOCKED */
|
||||
|
||||
/* Not locked ... attempt to lock it */
|
||||
|
||||
|
@ -50,22 +50,6 @@
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -111,11 +95,12 @@ uint32_t *up_doirq(int irq, uint32_t *regs)
|
||||
|
||||
/* Restore the previous value of CURRENT_REGS. NULL would indicate that
|
||||
* we are no longer in an interrupt handler. It will be non-NULL if we
|
||||
* are returning from a nested interrupt.
|
||||
* are returning from a nested interrupt (which are NOT fully supported).
|
||||
*/
|
||||
|
||||
CURRENT_REGS = savestate;
|
||||
#endif
|
||||
|
||||
board_autoled_off(LED_INIRQ);
|
||||
return regs;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Must match definitions in up_testset.c */
|
||||
|
||||
#define SP_UNLOCKED false /* The Un-locked state */
|
||||
|
@ -52,7 +52,7 @@
|
||||
# include <arch/irq.h>
|
||||
# ifdef CONFIG_SMP
|
||||
# include <nuttx/sched.h>
|
||||
# include <arch/spinlock.h>
|
||||
# include <nuttx/spinlock.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -570,4 +570,4 @@ void leave_critical_section(irqstate_t flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SMP || CONFIG_SCHED_INSTRUMENTATION_CSECTION*/
|
||||
#endif /* CONFIG_SMP || CONFIG_SCHED_INSTRUMENTATION_CSECTION */
|
||||
|
Loading…
Reference in New Issue
Block a user