forked from Imagelibrary/rtems
* rtems/score/cpu.h: Fix for inline asm in _CPU_Fatal_halt().
* rtems/asm.h: Added macro to define ARM functions. * cpu_asm.S, arm_exc_handler_low.S: Use macro from above.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2009-09-15 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
|
* rtems/score/cpu.h: Fix for inline asm in _CPU_Fatal_halt().
|
||||||
|
* rtems/asm.h: Added macro to define ARM functions.
|
||||||
|
* cpu_asm.S, arm_exc_handler_low.S: Use macro from above.
|
||||||
|
|
||||||
2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
|
2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||||
|
|
||||||
* rtems/score/cpu.h: Mark _CPU_Context_restore() as noreturn so the
|
* rtems/score/cpu.h: Mark _CPU_Context_restore() as noreturn so the
|
||||||
|
|||||||
@@ -27,28 +27,10 @@
|
|||||||
#include <rtems/asm.h>
|
#include <rtems/asm.h>
|
||||||
#include <rtems/score/cpu_asm.h>
|
#include <rtems/score/cpu_asm.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* function declaration macro (start body in ARM mode)
|
|
||||||
*/
|
|
||||||
#ifdef __thumb__
|
|
||||||
#define FUNC_START_ARM(_name_) \
|
|
||||||
.code 16 ;\
|
|
||||||
.thumb_func ;\
|
|
||||||
.globl _name_ ;\
|
|
||||||
_name_: ;\
|
|
||||||
bx pc ;\
|
|
||||||
.code 32 ;\
|
|
||||||
_name_ ## _ARM:
|
|
||||||
#else
|
|
||||||
#define FUNC_START_ARM(_name_) \
|
|
||||||
.globl _name_; \
|
|
||||||
_name_:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/* FIXME: _Exception_Handler_Undef_Swi is untested */
|
/* FIXME: _Exception_Handler_Undef_Swi is untested */
|
||||||
FUNC_START_ARM(_Exception_Handler_Undef_Swi)
|
DEFINE_FUNCTION_ARM(_Exception_Handler_Undef_Swi)
|
||||||
/* FIXME: This should use load and store multiple instructions */
|
/* FIXME: This should use load and store multiple instructions */
|
||||||
sub r13,r13,#SIZE_REGS
|
sub r13,r13,#SIZE_REGS
|
||||||
str r4, [r13, #REG_R4]
|
str r4, [r13, #REG_R4]
|
||||||
@@ -84,7 +66,7 @@ _go_back_1:
|
|||||||
movs pc,r14 /* return */
|
movs pc,r14 /* return */
|
||||||
|
|
||||||
/* FIXME: _Exception_Handler_Abort is untested */
|
/* FIXME: _Exception_Handler_Abort is untested */
|
||||||
FUNC_START_ARM(_Exception_Handler_Abort)
|
DEFINE_FUNCTION_ARM(_Exception_Handler_Abort)
|
||||||
/* FIXME: This should use load and store multiple instructions */
|
/* FIXME: This should use load and store multiple instructions */
|
||||||
sub r13,r13,#SIZE_REGS
|
sub r13,r13,#SIZE_REGS
|
||||||
str r4, [r13, #REG_R4]
|
str r4, [r13, #REG_R4]
|
||||||
@@ -127,7 +109,7 @@ _go_back_2:
|
|||||||
#define ABORT_REGS_OFFS 32-REG_R4
|
#define ABORT_REGS_OFFS 32-REG_R4
|
||||||
#define ABORT_SIZE_REGS SIZE_REGS+ABORT_REGS_OFFS
|
#define ABORT_SIZE_REGS SIZE_REGS+ABORT_REGS_OFFS
|
||||||
|
|
||||||
FUNC_START_ARM(_exc_data_abort)
|
DEFINE_FUNCTION_ARM(_exc_data_abort)
|
||||||
sub sp, sp, #ABORT_SIZE_REGS /* reserve register frame */
|
sub sp, sp, #ABORT_SIZE_REGS /* reserve register frame */
|
||||||
stmia sp, {r0-r11}
|
stmia sp, {r0-r11}
|
||||||
add sp, sp, #ABORT_REGS_OFFS /* the Context_Control structure starts by CPSR, R4, ... */
|
add sp, sp, #ABORT_REGS_OFFS /* the Context_Control structure starts by CPSR, R4, ... */
|
||||||
|
|||||||
@@ -22,24 +22,6 @@
|
|||||||
#include <rtems/asm.h>
|
#include <rtems/asm.h>
|
||||||
#include <rtems/score/cpu_asm.h>
|
#include <rtems/score/cpu_asm.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* function declaration macro (start body in ARM mode)
|
|
||||||
*/
|
|
||||||
#ifdef __thumb__
|
|
||||||
#define FUNC_START_ARM(_name_) \
|
|
||||||
.code 16 ;\
|
|
||||||
.thumb_func ;\
|
|
||||||
.globl _name_ ;\
|
|
||||||
_name_: ;\
|
|
||||||
bx pc ;\
|
|
||||||
.code 32 ;\
|
|
||||||
_name_ ## _ARM:
|
|
||||||
#else
|
|
||||||
#define FUNC_START_ARM(_name_) \
|
|
||||||
.globl _name_; \
|
|
||||||
_name_:
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -58,7 +40,7 @@ _name_:
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FUNC_START_ARM(_CPU_Context_switch)
|
DEFINE_FUNCTION_ARM(_CPU_Context_switch)
|
||||||
/* Start saving context */
|
/* Start saving context */
|
||||||
mrs r2, cpsr
|
mrs r2, cpsr
|
||||||
stmia r0, {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14}
|
stmia r0, {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14}
|
||||||
@@ -81,6 +63,6 @@ _restore:
|
|||||||
* It must match _CPU_Context_switch()
|
* It must match _CPU_Context_switch()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
FUNC_START_ARM(_CPU_Context_restore)
|
DEFINE_FUNCTION_ARM(_CPU_Context_restore)
|
||||||
mov r1, r0
|
mov r1, r0
|
||||||
b _restore
|
b _restore
|
||||||
|
|||||||
@@ -132,4 +132,13 @@
|
|||||||
#define PUBLIC(sym) .globl SYM (sym)
|
#define PUBLIC(sym) .globl SYM (sym)
|
||||||
#define EXTERN(sym) .globl SYM (sym)
|
#define EXTERN(sym) .globl SYM (sym)
|
||||||
|
|
||||||
|
#ifdef __thumb__
|
||||||
|
#define DEFINE_FUNCTION_ARM(name) \
|
||||||
|
.thumb_func ; .globl name ; name: ; bx pc ; \
|
||||||
|
.arm ; .globl name ## _arm ; name ## _arm:
|
||||||
|
#else
|
||||||
|
#define DEFINE_FUNCTION_ARM(name) \
|
||||||
|
.globl name ; name: ; .globl name ## _arm ; name ## _arm:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* _RTEMS_ASM_H */
|
||||||
|
|||||||
@@ -336,9 +336,10 @@ void _CPU_Context_Initialize(
|
|||||||
*(*(_destination)) = _CPU_Null_fp_context; \
|
*(*(_destination)) = _CPU_Null_fp_context; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define _CPU_Fatal_halt( _error ) \
|
#define _CPU_Fatal_halt( _err ) \
|
||||||
do { \
|
do { \
|
||||||
int _level; \
|
uint32_t _level; \
|
||||||
|
uint32_t _error = _err; \
|
||||||
_CPU_ISR_Disable( _level ); \
|
_CPU_ISR_Disable( _level ); \
|
||||||
asm volatile ("mov r0, %0\n" \
|
asm volatile ("mov r0, %0\n" \
|
||||||
: "=r" (_error) \
|
: "=r" (_error) \
|
||||||
|
|||||||
Reference in New Issue
Block a user