diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-08-24 20:54:30 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-08-24 20:54:30 +0000 |
commit | e45a6695ee8060924cf41f70b707690174a0b929 (patch) | |
tree | c68ea9b8c9bf4142d9ec0c3ae907e8a43b1d0da9 /sys/arch | |
parent | 1cfd14998d914c90a36c5e3456a9bd754bf60a2e (diff) |
Make sure do_xmem_* return the correct value. This fixes usage of fork()
in programs linked against libpthread on 88100 processors, where the parent
thread issueing fork() would spin.
Interestingly enough, this bug is not found in Mach, but has been introduced
by Nivas when porting to mvme88k, 18 years ago. DAE involving xmem are rare
enough for the issue to have survived so long (and once again, it was a
nightmare to track down).
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/m88k/m88100_machdep.c | 10 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/subr.S | 28 |
2 files changed, 22 insertions, 16 deletions
diff --git a/sys/arch/m88k/m88k/m88100_machdep.c b/sys/arch/m88k/m88k/m88100_machdep.c index 9abb9426686..55ed78ad7a4 100644 --- a/sys/arch/m88k/m88k/m88100_machdep.c +++ b/sys/arch/m88k/m88k/m88100_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88100_machdep.c,v 1.10 2013/08/18 22:17:26 miod Exp $ */ +/* $OpenBSD: m88100_machdep.c,v 1.11 2013/08/24 20:54:29 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -283,6 +283,12 @@ dae_process(struct trapframe *eframe, u_int x, } else { v = do_xmem_byte(dmax, dmdx, dmtx & DMT_DAS); } + DAE_DEBUG( + if (reg == 0) + printf("[no write to r0 done]\n"); + else + printf("[r%d <- %08x]\n", reg, v); + ); if (reg != 0) eframe->tf_r[reg] = v; } else { @@ -325,8 +331,6 @@ m88100_apply_patches() ((u_int32_t *)(do_store_word))[1] = 0xf400c401; ((u_int32_t *)(do_store_half))[1] = 0xf400c401; ((u_int32_t *)(do_store_byte))[1] = 0xf400c401; - ((u_int32_t *)(do_xmem_word))[1] = 0xf400c401; - ((u_int32_t *)(do_xmem_byte))[1] = 0xf400c401; } #endif } diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S index 5f38494651f..f87dcdaa035 100644 --- a/sys/arch/m88k/m88k/subr.S +++ b/sys/arch/m88k/m88k/subr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.S,v 1.22 2013/01/11 22:34:43 miod Exp $ */ +/* $OpenBSD: subr.S,v 1.23 2013/08/24 20:54:29 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -151,33 +151,35 @@ ENTRY(do_xmem_word) /* do_xmem_word(address, data, supervisor) */ bcnd ne0,%r4,1f #ifdef ERRATA__XXX_USR NOP +#endif xmem.usr %r3,%r2,%r0 +#ifdef ERRATA__XXX_USR NOP NOP NOP - jmp %r1 -#else - jmp.n %r1 - xmem.usr %r3,%r2,%r0 #endif -1: jmp.n %r1 - xmem %r3,%r2,%r0 + jmp.n %r1 + or %r2, %r3, %r0 +1: xmem %r3,%r2,%r0 + jmp.n %r1 + or %r2, %r3, %r0 ENTRY(do_xmem_byte) /* do_xmem_byte(address, data, supervisor) */ bcnd ne0,%r4,1f #ifdef ERRATA__XXX_USR NOP +#endif xmem.bu.usr %r3,%r2,%r0 +#ifdef ERRATA__XXX_USR NOP NOP NOP - jmp %r1 -#else - jmp.n %r1 - xmem.bu.usr %r3,%r2,%r0 #endif -1: jmp.n %r1 - xmem.bu %r3,%r2,%r0 + jmp.n %r1 + or %r2,%r3,%r0 +1: xmem.bu %r3,%r2,%r0 + jmp.n %r1 + or %r2,%r3,%r0 #endif /* M88100 */ |