2008-09-30 14:26:46 +02:00
|
|
|
/****************************************************************************
|
2013-07-24 01:52:06 +02:00
|
|
|
* arch/arm/src/armv7-a/arm_copyarmstate.c
|
2007-04-28 21:39:18 +02:00
|
|
|
*
|
2021-03-24 09:12:29 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-04-28 21:39:18 +02:00
|
|
|
*
|
2021-03-24 09:12:29 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-04-28 21:39:18 +02:00
|
|
|
*
|
2021-03-24 09:12:29 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-04-28 21:39:18 +02:00
|
|
|
*
|
2008-09-30 14:26:46 +02:00
|
|
|
****************************************************************************/
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2008-09-30 14:26:46 +02:00
|
|
|
/****************************************************************************
|
2007-04-28 21:39:18 +02:00
|
|
|
* Included Files
|
2008-09-30 14:26:46 +02:00
|
|
|
****************************************************************************/
|
2007-04-28 21:39:18 +02:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2008-09-30 14:26:46 +02:00
|
|
|
|
2009-12-16 21:05:51 +01:00
|
|
|
#include <stdint.h>
|
2008-09-30 14:26:46 +02:00
|
|
|
|
2014-08-09 02:39:28 +02:00
|
|
|
#include <arch/irq.h>
|
|
|
|
|
2020-05-01 03:20:29 +02:00
|
|
|
#include "arm_internal.h"
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2013-07-24 01:52:06 +02:00
|
|
|
#ifdef CONFIG_ARCH_FPU
|
|
|
|
|
2008-09-30 14:26:46 +02:00
|
|
|
/****************************************************************************
|
2008-11-06 19:15:35 +01:00
|
|
|
* Public Functions
|
2008-09-30 14:26:46 +02:00
|
|
|
****************************************************************************/
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2008-09-30 14:26:46 +02:00
|
|
|
/****************************************************************************
|
2020-04-30 20:26:30 +02:00
|
|
|
* Name: arm_copyarmstate
|
2013-07-24 03:09:17 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Copy the ARM portion of the register save area (omitting the floating
|
|
|
|
* point registers) and save the floating pointer register directly.
|
|
|
|
*
|
2008-09-30 14:26:46 +02:00
|
|
|
****************************************************************************/
|
2007-04-28 21:39:18 +02:00
|
|
|
|
2020-04-30 20:26:30 +02:00
|
|
|
void arm_copyarmstate(uint32_t *dest, uint32_t *src)
|
2007-04-28 21:39:18 +02:00
|
|
|
{
|
|
|
|
int i;
|
2009-05-17 19:18:19 +02:00
|
|
|
|
2015-12-14 18:56:02 +01:00
|
|
|
/* In the Cortex-A model, the state is copied from the stack to the TCB,
|
2009-05-19 19:16:17 +02:00
|
|
|
* but only a reference is passed to get the state from the TCB. So the
|
|
|
|
* following check avoids copying the TCB save area onto itself:
|
2009-05-17 19:18:19 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
if (src != dest)
|
2007-04-28 21:39:18 +02:00
|
|
|
{
|
2013-07-24 03:09:17 +02:00
|
|
|
/* Save the floating point registers: This will initialize the floating
|
|
|
|
* registers at indices ARM_CONTEXT_REGS through (XCPTCONTEXT_REGS-1)
|
|
|
|
*/
|
|
|
|
|
2020-05-01 16:50:23 +02:00
|
|
|
arm_savefpu(dest);
|
2013-07-24 03:09:17 +02:00
|
|
|
|
2014-09-11 20:35:23 +02:00
|
|
|
/* Then copy all of the ARM registers (omitting the floating point
|
2013-07-24 03:09:17 +02:00
|
|
|
* registers). Indices: 0 through (ARM_CONTEXT_REGS-1).
|
|
|
|
*/
|
|
|
|
|
2013-07-24 01:52:06 +02:00
|
|
|
for (i = 0; i < ARM_CONTEXT_REGS; i++)
|
2009-05-17 19:18:19 +02:00
|
|
|
{
|
|
|
|
*dest++ = *src++;
|
|
|
|
}
|
2007-04-28 21:39:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-24 01:52:06 +02:00
|
|
|
#endif /* CONFIG_ARCH_FPU */
|