Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
717 changes: 717 additions & 0 deletions ports_module/cortex_m85/gnu/inc/tx_port.h

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions ports_module/cortex_m85/gnu/inc/tx_secure_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/


/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread */
/** */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_secure_interface.h PORTABLE C */
/* 6.1 */
/* AUTHOR */
/* */
/* Scott Larson, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the ThreadX secure thread stack components, */
/* including data types and external references. */
/* It is assumed that tx_api.h and tx_port.h have already been */
/* included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 09-30-2020 Scott Larson Initial Version 6.1 */
/* */
/**************************************************************************/

#ifndef TX_SECURE_INTERFACE_H
#define TX_SECURE_INTERFACE_H

/* Define internal secure thread stack function prototypes. */

extern UINT _tx_thread_secure_mode_stack_initialize(void);
extern UINT _tx_thread_secure_mode_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size);
extern UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr);
extern void _tx_thread_secure_stack_initialize(void);
extern void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr);
extern void _tx_thread_secure_stack_context_restore(TX_THREAD *thread_ptr);

#endif
30 changes: 30 additions & 0 deletions ports_module/cortex_m85/gnu/inc/tx_thread_secure_stack_registers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/***************************************************************************
* Copyright (c) 2026 Eclipse ThreadX contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* AI Disclosure: This file was largely AI-generated by Codex (GPT-6.2-Sol).
* The AI-generated portions may be considered public domain (CC0-1.0)
* and not subject to the project's licence. The human contributor has
* reviewed and verified that the code is correct.
*
* SPDX-License-Identifier: MIT and CC0-1.0
**************************************************************************/

#ifndef TX_THREAD_SECURE_STACK_REGISTERS_H
#define TX_THREAD_SECURE_STACK_REGISTERS_H

/* MISRA C:2023 Rule 1.2 and Directive 4.3. GNU assembly accesses the
Cortex-M85 special registers. */
#define TX_SECURE_REGISTER_READ(reg, value) \
__asm__ volatile("MRS %0, " #reg : "=r" (value))
#define TX_SECURE_REGISTER_WRITE(reg, value) \
__asm__ volatile("MSR " #reg ", %0" :: "r" (value))

/* Keep both active stack registers clear before the allocator can reuse the stack. */
#define TX_SECURE_STACK_CLEAR_BEFORE_FREE() \
__asm__ volatile("MSR PSPLIM, %0\n\tMSR PSP, %0" :: "r" (0UL) : "memory")

#endif
Loading