2019-11-15 09:14:48 +00:00
|
|
|
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
|
|
|
//
|
|
|
|
// Licensed 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.
|
2019-11-15 08:07:57 +00:00
|
|
|
|
2019-11-27 16:52:27 +00:00
|
|
|
#include <freertos/xtensa_context.h>
|
|
|
|
|
2020-04-01 15:10:13 +00:00
|
|
|
.extern xtensa_shared_stack
|
|
|
|
.extern xtensa_shared_stack_callback
|
|
|
|
.extern xtensa_shared_stack_function_done
|
|
|
|
.extern xtensa_shared_stack_env
|
2020-03-12 05:59:53 +00:00
|
|
|
.extern longjmp
|
2019-11-15 08:07:57 +00:00
|
|
|
.text
|
2019-11-27 16:52:27 +00:00
|
|
|
|
2019-11-15 09:14:48 +00:00
|
|
|
|
2020-03-12 05:59:53 +00:00
|
|
|
/* extern void esp_shared_stack_invoke_function(void) */
|
2019-11-15 08:07:57 +00:00
|
|
|
|
2020-03-12 05:59:53 +00:00
|
|
|
.globl esp_shared_stack_invoke_function
|
|
|
|
.type esp_shared_stack_invoke_function,@function
|
|
|
|
.align 4
|
|
|
|
esp_shared_stack_invoke_function:
|
2019-11-15 09:14:48 +00:00
|
|
|
|
|
|
|
#ifndef __XTENSA_CALL0_ABI__
|
2020-04-01 15:10:13 +00:00
|
|
|
movi a0, 0 /* must not rotate the window here, */
|
|
|
|
/* the state of execution for shared stack */
|
|
|
|
/* functions will be completely destroyed at end */
|
|
|
|
movi a6, xtensa_shared_stack
|
2020-03-12 05:59:53 +00:00
|
|
|
l32i sp, a6, 0 /* load shared stack pointer */
|
2020-04-01 15:10:13 +00:00
|
|
|
movi a12, xtensa_shared_stack_callback
|
2020-03-12 05:59:53 +00:00
|
|
|
l32i a12, a12, 0
|
|
|
|
callx4 a12 /* call user function */
|
2020-04-01 15:10:13 +00:00
|
|
|
movi a6, xtensa_shared_stack_function_done
|
2020-03-12 05:59:53 +00:00
|
|
|
movi a7, 1
|
|
|
|
s32i a7, a6, 0 /* hint the function was finished */
|
2020-04-01 15:10:13 +00:00
|
|
|
movi a6, xtensa_shared_stack_env
|
2020-03-31 16:58:02 +00:00
|
|
|
movi a7, 0
|
|
|
|
movi a12, longjmp
|
|
|
|
callx4 a12 /* jump to last clean state previously saved */
|
2020-03-12 05:59:53 +00:00
|
|
|
ret
|
2019-11-15 09:14:48 +00:00
|
|
|
#else
|
2020-02-06 19:24:39 +00:00
|
|
|
#error "this code is written for Window ABI"
|
2019-11-15 09:14:48 +00:00
|
|
|
#endif
|