summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/include
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-03-21 13:09:54 +0000
committermarius <marius@FreeBSD.org>2010-03-21 13:09:54 +0000
commit86c825f19119322dafe0fca5ac8e8dcd696a7cb7 (patch)
treefa160a459cd4eadcaad9a774c47e753d1b1ca2a3 /sys/sparc64/include
parent61e6b421515198b4a2dce0197c39619417afbdd4 (diff)
downloadFreeBSD-src-86c825f19119322dafe0fca5ac8e8dcd696a7cb7.zip
FreeBSD-src-86c825f19119322dafe0fca5ac8e8dcd696a7cb7.tar.gz
- The firmware of Sun Fire V1280 has a misfeature of setting %wstate to
7 which corresponds to WSTATE_KMIX in OpenSolaris whenever calling into it which totally screws us even when restoring %wstate afterwards as spill/fill traps can happen while in OFW. The rather hackish OpenBSD approach of just setting the equivalent of WSTATE_KERNEL to 7 also is no option as we treat %wstate as a bit field. So in order to deal with this problem actually implement spill/fill handlers for %wstate 7 which just act as the WSTATE_KERNEL ones except of theoretically also handling 32-bit, turn off interrupts completely so we don't even take IPIs while in OFW which should ensure we only take spill/fill traps at most and restore %wstate after calling into OFW once we have taken over the trap table. While at it, actually set WSTATE_{,PROM}_KMIX before calling into OFW just like OpenSolaris does, which should at least help testing this change on non-V1280. - Remove comments referring to the %wstate usage in BSD/OS. - Remove the no longer used RSF_ALIGN_RETRY macro. - Correct some trap table addresses in comments. - Ensure %wstate is set to WSTATE_KERNEL when taking over the trap table. - Ensure PSTATE_AM is off when entering or exiting to OFW as well as that interrupts are also completely off when exiting to OFW as the firmware trap table shouldn't be used to handle our interrupts.
Diffstat (limited to 'sys/sparc64/include')
-rw-r--r--sys/sparc64/include/wstate.h35
1 files changed, 5 insertions, 30 deletions
diff --git a/sys/sparc64/include/wstate.h b/sys/sparc64/include/wstate.h
index 7ce0a49..aae2fda 100644
--- a/sys/sparc64/include/wstate.h
+++ b/sys/sparc64/include/wstate.h
@@ -33,7 +33,7 @@
#define _MACHINE_WSTATE_H_
/*
- * Window state register bits.
+ * Window state register bits
*
* There really are no bits per se, just the two fields WSTATE.NORMAL
* and WSTATE.OTHER. The rest is up to software.
@@ -42,37 +42,8 @@
* (whichever is currently in effect) and WSTATE_OTHER to represent
* user mode saves (only).
*
- * We use the low bit to suggest 32-bit mode, with the next bit set
- * once we succeed in saving in some mode. That is, if the WSTATE_ASSUME
- * bit is set, the spill or fill handler we use will be one that makes
- * an assumption about the proper window-save mode. If the spill or
- * fill fails with an alignment fault, the spill or fill op should
- * take the `assume' bit away retry the instruction that caused the
- * spill or fill. This will use the new %wstate, which will test for
- * which mode to use. The alignment fault code helps us out here by
- * resuming the spill vector at offset +70, where we are allowed to
- * execute two instructions (i.e., write to %wstate and RETRY).
- *
- * If the ASSUME bit is not set when the alignment fault occurs, the
- * given stack pointer is hopelessly wrong (and the spill, if it is a
- * spill, should be done as a sort of "panic spill") -- so those two
- * instructions will be a branch sequence.
- *
* Note that locore.s assumes this same bit layout (since the translation
* from "bits" to "{spill,fill}_N_{normal,other}" is done in hardware).
- *
- * The value 0 is preferred for unknown to make it easy to start in
- * unknown state and continue in whichever state unknown succeeds in --
- * a successful "other" save, for instance, can just set %wstate to
- * ASSUMExx << USERSHIFT and thus leave the kernel state "unknown".
- *
- * We also need values for managing the somewhat tricky transition from
- * user to kernel and back, so we use the one remaining free bit to mean
- * "although this looks like kernel mode, the window(s) involved are
- * user windows and should be saved ASI_AIUP". Everything else is
- * otherwise the same, but we need not bother with assumptions in this
- * mode (we expect it to apply to at most one window spill or fill),
- * i.e., WSTATE_TRANSITION can ignore WSTATE_ASSUME if it likes.
*/
#define WSTATE_NORMAL_MASK 1 /* wstate normal minus transition */
@@ -88,4 +59,8 @@
#define WSTATE_NESTED /* if set, spill must not fault */ \
(WSTATE_TRANSITION << WSTATE_OTHER_SHIFT)
+/* Values used by the PROM and (Open)Solaris */
+#define WSTATE_PROM_KMIX 7
+#define WSTATE_PROM_MASK 7
+
#endif /* !_MACHINE_WSTATE_H_ */
OpenPOWER on IntegriCloud