aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2021-10-12 20:55:18 +1000
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-10-13 16:08:00 +0530
commitebef02621dedc111c9c75c98971fcb869b492052 (patch)
treef46c7f42332b598e7cd0a9d50c0f475ebf60ed29 /include
parent7dbda0377dbc0044f8087eab662ae952039cece9 (diff)
downloadskiboot-ebef02621dedc111c9c75c98971fcb869b492052.zip
skiboot-ebef02621dedc111c9c75c98971fcb869b492052.tar.gz
skiboot-ebef02621dedc111c9c75c98971fcb869b492052.tar.bz2
HBRT: fix clobbered r16 when host services handlers are called
Skiboot is using r16 as a fixed register containing this CPU pointer, but we can be called back into from hostboot via the host services interface, where r16 may have been set by hostboot. Switch this back to skiboot's CPU pointer before running host services handlers, and then restore it to the hostboot value before returning. Fixes: 11ce9612b3aa ("move the __this_cpu register to r16, reserve r13-r15") Reported-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Tested-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/skiboot.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/skiboot.h b/include/skiboot.h
index df11934..4f4a005 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -163,6 +163,11 @@ extern void start_kernel32(uint64_t entry, void* fdt,
uint64_t mem_top) __noreturn;
extern void start_kernel_secondary(uint64_t entry) __noreturn;
+/* Re-set r16 register with CPU pointer, based on stack (r1) value */
+extern void restore_cpu_ptr_r16(void);
+/* Set r16 register with value in 'r16' parameter */
+extern void set_cpu_ptr_r16(uint64_t r16);
+
/* Get description of machine from HDAT and create device-tree */
extern int parse_hdat(bool is_opal);