summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/include/rtems/score/isr.h12
-rw-r--r--cpukit/include/rtems/score/isrlevel.h11
-rw-r--r--cpukit/include/rtems/score/percpu.h10
-rw-r--r--cpukit/score/src/threadrestart.c2
4 files changed, 22 insertions, 13 deletions
diff --git a/cpukit/include/rtems/score/isr.h b/cpukit/include/rtems/score/isr.h
index 3c6a9f1e2c..47c24f3a72 100644
--- a/cpukit/include/rtems/score/isr.h
+++ b/cpukit/include/rtems/score/isr.h
@@ -147,18 +147,6 @@ void _ISR_Handler_initialization ( void );
*/
void _ISR_Handler( void );
-/**
- * @brief Checks if an ISR in progress.
- *
- * This function returns true if the processor is currently servicing
- * and interrupt and false otherwise. A return value of true indicates
- * that the caller is an interrupt service routine, NOT a thread.
- *
- * @retval true Returns true when called from an ISR.
- * @retval false Returns false when not called from an ISR.
- */
-bool _ISR_Is_in_progress( void );
-
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/include/rtems/score/isrlevel.h b/cpukit/include/rtems/score/isrlevel.h
index 3981f2c688..d578a32c48 100644
--- a/cpukit/include/rtems/score/isrlevel.h
+++ b/cpukit/include/rtems/score/isrlevel.h
@@ -144,6 +144,17 @@ typedef uint32_t ISR_Level;
RTEMS_COMPILER_MEMORY_BARRIER(); \
} while (0)
+/**
+ * @brief Checks if an ISR in progress.
+ *
+ * This function returns true, if the processor is currently servicing
+ * and interrupt, and false otherwise. A return value of true indicates
+ * that the caller is an interrupt service routine, **not** a thread.
+ *
+ * @return true Returns true, if called from within an ISR, otherwise false.
+ */
+bool _ISR_Is_in_progress( void );
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/include/rtems/score/percpu.h b/cpukit/include/rtems/score/percpu.h
index 58a89ec7a9..1aed17ab19 100644
--- a/cpukit/include/rtems/score/percpu.h
+++ b/cpukit/include/rtems/score/percpu.h
@@ -683,6 +683,16 @@ static inline struct _Thread_Control *_Per_CPU_Get_executing(
return cpu->executing;
}
+static inline bool _Per_CPU_Is_ISR_in_progress( const Per_CPU_Control *cpu )
+{
+#if CPU_PROVIDES_ISR_IS_IN_PROGRESS == TRUE
+ (void) cpu;
+ return _ISR_Is_in_progress();
+#else
+ return cpu->isr_nest_level != 0;
+#endif
+}
+
static inline bool _Per_CPU_Is_processor_online(
const Per_CPU_Control *cpu
)
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 7a1c8e4635..c8f7f7b6b1 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -538,7 +538,7 @@ Status_Control _Thread_Restart(
if (
the_thread == _Per_CPU_Get_executing( cpu_self ) &&
- !_ISR_Is_in_progress()
+ !_Per_CPU_Is_ISR_in_progress( cpu_self )
) {
ignored_life_states = THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED;
} else {