summaryrefslogtreecommitdiff
path: root/ports/risc-v64/gnu/src/tx_thread_interrupt_control.S
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-03-06 19:27:49 +0100
committerGitHub <[email protected]>2026-03-06 19:27:49 +0100
commit3726d7906b4808bfec7855fc088e073199df9120 (patch)
tree8789bfd03d1d49e1967e80d04aa4ff606fda43eb /ports/risc-v64/gnu/src/tx_thread_interrupt_control.S
parent4b6e8100d932a3a67b34c6eb17f84f3bffb9e2ae (diff)
parentc3259a216026372e3833dd8996a68f77e8595fbd (diff)
Merge pull request #510 from eclipse-threadx/devv6.5.0.202601_rel
Merge changes ahead of the v6.5.0.202601 release
Diffstat (limited to 'ports/risc-v64/gnu/src/tx_thread_interrupt_control.S')
-rw-r--r--ports/risc-v64/gnu/src/tx_thread_interrupt_control.S29
1 files changed, 13 insertions, 16 deletions
diff --git a/ports/risc-v64/gnu/src/tx_thread_interrupt_control.S b/ports/risc-v64/gnu/src/tx_thread_interrupt_control.S
index c75c7c47..dfcb6b47 100644
--- a/ports/risc-v64/gnu/src/tx_thread_interrupt_control.S
+++ b/ports/risc-v64/gnu/src/tx_thread_interrupt_control.S
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * Copyright (c) 2024 Microsoft Corporation
+ * Copyright (c) 2026-present 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.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -19,8 +20,6 @@
/**************************************************************************/
/**************************************************************************/
- RETURN_MASK = 0x000000000000000F
- SET_SR_MASK = 0xFFFFFFFFFFFFFFF0
.section .text
/**************************************************************************/
@@ -54,28 +53,26 @@
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 03-08-2023 Scott Larson Initial Version 6.2.1 */
-/* */
/**************************************************************************/
/* UINT _tx_thread_interrupt_control(UINT new_posture)
{ */
.global _tx_thread_interrupt_control
_tx_thread_interrupt_control:
/* Pickup current interrupt lockout posture. */
+ /* old_mstatus = mstatus; */
csrr t0, mstatus
mv t1, t0 // Save original mstatus for return
- /* Apply the new interrupt posture. */
+ /* Apply the new interrupt posture while preserving unrelated mstatus bits. */
+ /* Only modify the MIE bit (bit 3) */
+ /* mstatus = (mstatus & ~MIE) | (new_posture & MIE); */
- li t2, SET_SR_MASK // Build set SR mask
- and t0, t0, t2 // Isolate interrupt lockout bits
- or t0, t0, a0 // Put new lockout bits in
+ li t2, ~0x08 // Build mask to clear MIE
+ and t0, t0, t2 // Clear MIE bit
+ and a0, a0, 0x08 // Mask incoming to only MIE bit
+ or t0, t0, a0 // Set requested MIE state
csrw mstatus, t0
- andi a0, t1, RETURN_MASK // Return original mstatus.
+ andi a0, t1, 0x08 // Return original MIE bit
ret
/* } */