2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2021-04-01 12:12:05 +02:00
|
|
|
* arch/arm/src/armv8-m/arm_fullcontextrestore.S
|
2020-04-22 04:09:50 +02: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
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2020-04-22 04:09:50 +02:00
|
|
|
* Included Files
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <arch/irq.h>
|
|
|
|
|
|
|
|
#include "nvic.h"
|
|
|
|
#include "svcall.h"
|
|
|
|
|
2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2020-04-22 04:09:50 +02:00
|
|
|
* Pre-processor Definitions
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2020-04-22 04:09:50 +02:00
|
|
|
* Public Symbols
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
|
|
|
.syntax unified
|
|
|
|
.thumb
|
2020-04-26 18:35:35 +02:00
|
|
|
.file "arm_fullcontextrestore.S"
|
2020-04-22 04:09:50 +02:00
|
|
|
|
2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2020-04-22 04:09:50 +02:00
|
|
|
* Macros
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2020-04-22 04:09:50 +02:00
|
|
|
* Public Functions
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
2021-03-24 09:14:53 +01:00
|
|
|
/****************************************************************************
|
2020-04-26 18:35:35 +02:00
|
|
|
* Name: arm_fullcontextrestore
|
2020-04-22 04:09:50 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Restore the current thread context. Full prototype is:
|
|
|
|
*
|
2020-04-26 18:35:35 +02:00
|
|
|
* void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function;
|
2020-04-22 04:09:50 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
2021-03-24 09:14:53 +01:00
|
|
|
****************************************************************************/
|
2020-04-22 04:09:50 +02:00
|
|
|
|
|
|
|
.thumb_func
|
2020-04-26 18:35:35 +02:00
|
|
|
.globl arm_fullcontextrestore
|
|
|
|
.type arm_fullcontextrestore, function
|
|
|
|
arm_fullcontextrestore:
|
2020-04-22 04:09:50 +02:00
|
|
|
|
|
|
|
/* Perform the System call with R0=1 and R1=regs */
|
|
|
|
|
2021-04-01 12:12:05 +02:00
|
|
|
mov r1, r0 /* R1: regs */
|
2020-04-22 04:09:50 +02:00
|
|
|
mov r0, #SYS_restore_context /* R0: restore context */
|
2021-04-01 12:12:05 +02:00
|
|
|
svc 0 /* Force synchronous SVCall (or Hard Fault) */
|
2020-04-22 04:09:50 +02:00
|
|
|
|
|
|
|
/* This call should not return */
|
|
|
|
|
2021-04-01 12:12:05 +02:00
|
|
|
bx lr /* Unnecessary ... will not return */
|
2020-04-26 18:35:35 +02:00
|
|
|
.size arm_fullcontextrestore, .-arm_fullcontextrestore
|
2020-04-22 04:09:50 +02:00
|
|
|
.end
|