diff mbox

[2/3] core/init: ensure the current thread is initialised

Message ID 1473053170-3065-2-git-send-email-oohall@gmail.com
State Accepted
Headers show

Commit Message

Oliver O'Halloran Sept. 5, 2016, 5:26 a.m. UTC
This patch adds a check when to verify that we have initialised the
cpu_thread structure for the called in thread.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/init.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/core/init.c b/core/init.c
index 79aa048e9e2c..5900950d6552 100644
--- a/core/init.c
+++ b/core/init.c
@@ -622,6 +622,16 @@  static void copy_exception_vectors(void)
 
 static void per_thread_sanity_checks(void)
 {
+	struct cpu_thread *cpu = this_cpu();
+
+	/**
+	 * @fwts-label UnknownSecondary
+	 * @fwts-advice The boot CPU attampted to call in a secondary thread
+	 * without initialising the corresponding cpu_thread structure. This may
+	 * happen if the HDAT or devicetree reports too few threads or cores for
+	 * this processor.
+	 */
+	assert(cpu->state != cpu_state_no_cpu);
 }
 
 /* Called from head.S, thus no prototype. */