Select Git revision
Forked from
card10 / firmware
Source project has a limited visibility.
-
rahix authored
Signed-off-by:
Rahix <rahix@rahix.de>
rahix authoredSigned-off-by:
Rahix <rahix@rahix.de>
nlrthumb.S 6.09 KiB
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2015 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#if (!defined(MICROPY_NLR_SETJMP) || !MICROPY_NLR_SETJMP) && (defined(__thumb2__) || defined(__thumb__) || defined(__arm__))
// We only need the functions here if we are on arm/thumb, and we are not
// using setjmp/longjmp.
//
// For reference, arm/thumb callee save regs are:
// r4-r11, r13=sp
// the offset of nlr_top within mp_state_ctx_t
#define NLR_TOP_OFFSET (2 * 4)
.syntax unified
/*.cpu cortex-m4*/
/*.thumb*/
.text
.align 2
/**************************************/
// mp_uint_t nlr_push(r0=nlr_buf_t *nlr)
.global nlr_push
#if defined(__thumb2__)
.thumb
.thumb_func
#endif
.type nlr_push, %function
nlr_push:
str r4, [r0, #12] @ store r4 into nlr_buf
str r5, [r0, #16] @ store r5 into nlr_buf
str r6, [r0, #20] @ store r6 into nlr_buf
str r7, [r0, #24] @ store r7 into nlr_buf
#if defined(__ARM_ARCH_6M__)
mov r1, r8
str r1, [r0, #28] @ store r8 into nlr_buf
mov r1, r9
str r1, [r0, #32] @ store r9 into nlr_buf
mov r1, r10
str r1, [r0, #36] @ store r10 into nlr_buf
mov r1, r11
str r1, [r0, #40] @ store r11 into nlr_buf
mov r1, r13
str r1, [r0, #44] @ store r13=sp into nlr_buf
mov r1, lr