summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2022-08-02 20:15:29 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2022-08-02 20:15:29 +0000
commit2d6c73c55745fd2113b0c1f480ea0ed24095b184 (patch)
tree6f04b433b9b37ade841e286924b3732e6111d8d4 /sys/arch
parent5c8f2e2e540f99f91ac3b8eb8d2091262e7570bd (diff)
Correctly detect xmem operations faulting on missing pages on 88110.
These must be handled as write faults rather than read faults, since xmem performs both a read and a write, and unlike on 88100, we don't have an easy bit to check. This solves libcrypto spinning on its locks on 88110.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/m88k/m88k/trap.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index 28cdc6be601..ee542f34ba7 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.120 2021/12/09 00:26:11 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.121 2022/08/02 20:15:28 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -868,7 +868,17 @@ m88110_user_fault:
#endif
} else {
fault_addr = frame->tf_dlar;
- if (frame->tf_dsr & CMMU_DSR_RW) {
+ /*
+ * Unlike the 88100, there is no specific bit telling
+ * us this is the read part of an xmem operation.
+ * However, if the WE (Write Exception) bit is set,
+ * then obviously this is not a read fault.
+ * But the value of this bit can not be relied upon
+ * if either PI or SI are set...
+ */
+ if ((frame->tf_dsr & CMMU_DSR_RW) != 0 &&
+ ((frame->tf_dsr & (CMMU_DSR_PI|CMMU_DSR_SI)) != 0 ||
+ (frame->tf_dsr & CMMU_DSR_WE) == 0)) {
access_type = PROT_READ;
fault_code = PROT_READ;
} else {