From 0fa834d4332608374852575437d2714f820868c4 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 17 May 2009 17:18:19 +0000 Subject: Debug Cortex-M3 interrupts git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1787 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/common/up_copystate.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'nuttx/arch/arm/src/common/up_copystate.c') diff --git a/nuttx/arch/arm/src/common/up_copystate.c b/nuttx/arch/arm/src/common/up_copystate.c index 1c4cb42ec..b73c6c95c 100644 --- a/nuttx/arch/arm/src/common/up_copystate.c +++ b/nuttx/arch/arm/src/common/up_copystate.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_copystate.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -69,9 +69,22 @@ void up_copystate(uint32 *dest, uint32 *src) { int i; - for (i = 0; i < XCPTCONTEXT_REGS; i++) + + /* In the current ARM model, the state is always copied to and from the + * stack and TCB. In the Cortex-M3 model, the state is copied from the + * stack to the TCB, but only a referenced is passed to get the the state + * from the TCB. So the following check makes sense only for the Cortex-M3 + * model: + */ + +#ifdef __thumb2__ + if (src != dest) +#endif { - *dest++ = *src++; + for (i = 0; i < XCPTCONTEXT_REGS; i++) + { + *dest++ = *src++; + } } } -- cgit v1.2.3