summaryrefslogtreecommitdiff
path: root/lib/cpus/aarch64
diff options
context:
space:
mode:
authorThaddeus Serna <Thaddeus.Gonzalez-Serna@arm.com>2023-07-19 13:59:24 -0500
committerThaddeus Gonzalez-Serna <Thaddeus.Gonzalez-Serna@arm.com>2023-08-10 16:38:42 +0200
commit3f721c6edd20cef11c241a3ef84d94c06f5bebb4 (patch)
treebbe5e7b68fecc67963211e2372b15acab7fe11b4 /lib/cpus/aarch64
parent38d1679db2c466d553b3d6a0db9698e754317906 (diff)
fix(cpus): assert invalid cpu_ops obtained
Not including the proper CPU file can halt execution at the reset_handler since the cpu_ops obtained will be invalid and therefore the cpu reset function will be invalid too, unless SUPPORT_UNKNOWN_MPID is enabled. This patch adds an assert to check for the validity of the obtained cpu_ops object and will display an error if the object is invalid. Change-Id: I0e1661745e4a692aab5e910e110c2de0caf64f46 Signed-off-by: Thaddeus Serna <Thaddeus.Gonzalez-Serna@arm.com>
Diffstat (limited to 'lib/cpus/aarch64')
-rw-r--r--lib/cpus/aarch64/cpu_helpers.S9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/cpus/aarch64/cpu_helpers.S b/lib/cpus/aarch64/cpu_helpers.S
index a4285eda5..1ae31803e 100644
--- a/lib/cpus/aarch64/cpu_helpers.S
+++ b/lib/cpus/aarch64/cpu_helpers.S
@@ -33,6 +33,15 @@ func reset_handler
/* Get the matching cpu_ops pointer */
bl get_cpu_ops_ptr
+#if ENABLE_ASSERTIONS
+ /*
+ * Assert if invalid cpu_ops obtained. If this is not valid, it may
+ * suggest that the proper CPU file hasn't been included.
+ */
+ cmp x0, #0
+ ASM_ASSERT(ne)
+#endif
+
/* Get the cpu_ops reset handler */
ldr x2, [x0, #CPU_RESET_FUNC]
mov x30, x19