<commit_before>/******************************************************************************

    @file    StateOS: oscore.c
    @author  <NAME>
    @date    13.07.2017
    @brief   StateOS port file for ARM Cotrex-M uC.

 ******************************************************************************

    StateOS - Copyright (C) 2013 <NAME>.

    This file is part of StateOS distribution.

    StateOS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 3 of the License,
    or (at your option) any later version.

    StateOS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.

 ******************************************************************************/

#if defined(__CC_ARM)

#include <oskernel.h>

/* -------------------------------------------------------------------------- */

__asm void PendSV_Handler( void )
{
	PRESERVE8

#if __CORTEX_M < 3

	mrs   r0,    PSP
	mov   r3,    lr
	lsls  r3,  # 29
	bmi   priv_ctx_enter
	mov   r0,    sp
	sub   sp,  # 36
priv_ctx_enter
	subs  r0,  # 36
	stm   r0!, { r4  - r7 }
	mov   r3,    r8
	mov   r4,    r9
	mov   r5,    r10
	mov   r6,    r11
	mov   r7,    lr
	stm   r0!, { r3  - r7 }
	subs  r0,  # 36

#else //__CORTEX_M

	tst   lr,  # 4                      ; process stack used?
	itee  ne
	mrsne r0,    PSP
	moveq r0,    sp
#if __FPU_USED
	subeq sp,  # 100
	tst   lr,  # 16                     ; fpu used?
	it    eq
 vstmdbeq r0!, { s16 - s31 }
#else
	subeq sp,  # 36
#endif
	stmdb r0!, { r4  - r11, lr }

#endif//__CORTEX_M

	bl    __cpp(core_tsk_handler)

#if __CORTEX_M < 3

	adds  r0,  # 16
	ldm   r0!, { r3  - r7 }
	mov   r8,    r3
	mov   r9,    r4
	mov   r10,   r5
	mov   r11,   r6
	mov   lr,    r7
	subs  r0,  # 36
	ldm   r0!, { r4  - r7 }
	adds  r0,  # 20
	mov   r3,    lr
	lsls  r3,  # 29
	bmi   priv_ctx_exit
	mov   sp,    r0
	bx    lr
priv_ctx_exit
	msr   PSP,   r0
	bx    lr

#else //__CORTEX_M

	ldmia r0!, { r4  - r11, lr }<commit_msg>updated oscore for armcc compiler v5<commit_after>/******************************************************************************

    @file    StateOS: oscore.c
    @author  <NAME>
    @date    01.11.2017
    @brief   StateOS port file for ARM Cotrex-M uC.

 ******************************************************************************

    StateOS - Copyright (C) 2013 <NAME>.

    This file is part of StateOS distribution.

    StateOS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 3 of the License,
    or (at your option) any later version.

    StateOS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.

 ******************************************************************************/

#if defined(__CC_ARM)

#include <oskernel.h>

/* -------------------------------------------------------------------------- */

__asm void PendSV_Handler( void )
{
	PRESERVE8

#if __CORTEX_M < 3

	mrs   r0,    PSP
	mov   r3,    lr
	lsrs  r3,  # 3
	bcs   priv_ctx_enter
	mov   r0,    sp
	sub   sp,  # 36
priv_ctx_enter
	subs  r0,  # 36
	stm   r0!, { r4  - r7 }
	mov   r3,    r8
	mov   r4,    r9
	mov   r5,    r10
	mov   r6,    r11
	mov   r7,    lr
	stm   r0!, { r3  - r7 }
	subs  r0,  # 36

	bl    __cpp(core_tsk_handler)

	adds  r0,  # 16
	ldm   r0!, { r3  - r7 }
	mov   r8,    r3
	mov   r9,    r4
	mov   r10,   r5
	mov   r11,   r6
	mov   lr,    r7
	subs  r0,  # 36
	ldm   r0!, { r4  - r7 }
	adds  r0,  # 20
	mov   r3,    lr
	lsrs  r3,  # 3
	bcs   priv_ctx_exit
	mov   sp,    r0
	bx    lr
priv_ctx_exit
	msr   PSP,   r0
	bx    lr

#else //__CORTEX_M

	tst   lr,  # 4                      ; process stack used?
	itee  ne
	mrsne r0,    PSP
	moveq r0,    sp
#if __FPU_USED
	subeq sp,  # 100
	tst   lr,  # 16                     ; fpu used?
	it    eq
 vstmdbeq r0!, { s16 - s31 }
#else
	subeq sp,  # 36
#endif
	stmdb r0!, { r4  - r11, lr }

	bl    __cpp(core_tsk_handler)

	ldmia r0!, { r4  - r11, lr }
{'fraction_non_alphanumeric': 0.19834359736674453, 'fraction_numerical': 0.04289658101507751, 'mean_word_length': 2.0684039087947883, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '346760', 'n_tokens_mistral': 1859, 'n_tokens_neox': 1686, 'n_words': 581}