aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2019-09-25 11:01:34 +1000
committerOliver O'Halloran <oohall@gmail.com>2019-10-03 09:55:58 +1000
commit9ddc1a6bfaef8669efd00b36fa1b699c04f6488d (patch)
tree1e3b1585813e5db510f0b7e31914afed040e45b9 /include
parentb70e8afdb09f56e3c7db643862cd3d2fd15a4544 (diff)
downloadskiboot-9ddc1a6bfaef8669efd00b36fa1b699c04f6488d.zip
skiboot-9ddc1a6bfaef8669efd00b36fa1b699c04f6488d.tar.gz
skiboot-9ddc1a6bfaef8669efd00b36fa1b699c04f6488d.tar.bz2
core/util: trap based assertions
Using traps for assertions like Linux does gives a few advantages: - The asm code leading to the failure condition is nicer. - The interrupt gives a clean snapshot of machine state to dump. The difficulty with using traps for this in OPAL is that the runtime component will not deal well with the OS taking the 0x700 interrupt caused by a trap in OPAL. The long term goal is to improve the ability of the OS to inspect and debug OPAL at runtime. For now though, the traps are patched out before passing control to the OS, and the assert falls through to in-line failure handling. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [oliver: commit prefix, added and renamed the FWTS label, fix tests] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/processor.h3
-rw-r--r--include/skiboot.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/include/processor.h b/include/processor.h
index 352fd1e..a0c2864 100644
--- a/include/processor.h
+++ b/include/processor.h
@@ -206,6 +206,9 @@
#include <stdbool.h>
#include <stdint.h>
+#define PPC_INST_NOP 0x60000000UL
+#define PPC_INST_TRAP 0x7fe00008UL
+
#define RB(b) (((b) & 0x1f) << 11)
#define MSGSND(b) stringify(.long 0x7c00019c | RB(b))
#define MSGCLR(b) stringify(.long 0x7c0001dc | RB(b))
diff --git a/include/skiboot.h b/include/skiboot.h
index 96d25b8..686ba9d 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -192,6 +192,7 @@ extern bool start_preload_kernel(void);
extern void copy_exception_vectors(void);
extern void copy_sreset_vector(void);
extern void copy_sreset_vector_fast_reboot(void);
+extern void patch_traps(bool enable);
/* Various probe routines, to replace with an initcall system */
extern void probe_phb3(void);