Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/stand Workaround for issues seen on VIA C3-bas...
details: https://anonhg.NetBSD.org/src/rev/70b7f7d139b8
branches: trunk
changeset: 581135:70b7f7d139b8
user: gavan <gavan%NetBSD.org@localhost>
date: Fri May 27 21:40:09 2005 +0000
description:
Workaround for issues seen on VIA C3-based systems. PR port-i386/26007
Tested on ML5000 board. This may not fix the problem on all variations of the
hardware, but it's likely that variations on the theme will. This workaround
is non-intrusive and should not affect any other CPUs.
diffstat:
sys/arch/i386/stand/boot/Makefile.boot | 3 +-
sys/arch/i386/stand/lib/realprot.S | 45 +++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 2 deletions(-)
diffs (91 lines):
diff -r 37f4857bfc23 -r 70b7f7d139b8 sys/arch/i386/stand/boot/Makefile.boot
--- a/sys/arch/i386/stand/boot/Makefile.boot Fri May 27 15:46:23 2005 +0000
+++ b/sys/arch/i386/stand/boot/Makefile.boot Fri May 27 21:40:09 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.boot,v 1.20 2005/05/05 18:03:04 christos Exp $
+# $NetBSD: Makefile.boot,v 1.21 2005/05/27 21:40:09 gavan Exp $
S= ${.CURDIR}/../../../../../
@@ -67,6 +67,7 @@
CPPFLAGS+= -DPASS_BIOSGEOM
CPPFLAGS+= -DPASS_MEMMAP
#CPPFLAGS+= -DBOOTPASSWD
+CPPFLAGS+= -DEPIA_HACK
# The biosboot code is linked to 'virtual' address of zero and is
# loaded at physical address 0x10000.
diff -r 37f4857bfc23 -r 70b7f7d139b8 sys/arch/i386/stand/lib/realprot.S
--- a/sys/arch/i386/stand/lib/realprot.S Fri May 27 15:46:23 2005 +0000
+++ b/sys/arch/i386/stand/lib/realprot.S Fri May 27 21:40:09 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: realprot.S,v 1.3 2004/02/13 11:36:14 wiz Exp $ */
+/* $NetBSD: realprot.S,v 1.4 2005/05/27 21:40:09 gavan Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -188,7 +188,34 @@
* Based on the descripton in section 14.5 of the 80386 Programmer's
* reference book.
*/
+/*
+ * EPIA_HACK
+ *
+ * VIA C3 processors don't seem to correctly switch back to executing
+ * 16 bit code after the switch to real mode and subsequent jump.
+ *
+ * It is speculated that the CPU is prefetching and decoding branch
+ * targets and not invalidating this buffer on the long jump.
+ *
+ * The precise reason for this hack working is still unknown, but
+ * it was determined experimentally on two theories:
+ * 1) Flush the pipeline with NOPs
+ * 2) call/ret after the return from prot_to_real seems to improve matters,
+ * perhaps by making more work for the branch prediction/prefetch logic.
+ *
+ * Neither of these individually are effective, but this combination is
+ * determined experimentally to be sufficient.
+ */
ENTRY(prot_to_real)
+#ifdef EPIA_HACK
+ .code32
+ call prot_to_real_main
+ .code16
+ call epia_nops
+ retl
+
+prot_to_real_main:
+#endif
.code32
pushl %eax
@@ -240,6 +267,10 @@
jne 1f
pop %bp
+#ifdef EPIA_HACK
+ call epia_nops
+#endif
+
sti
popl %eax
retl
@@ -258,6 +289,18 @@
dump_eax_buff:
. = . + 16
+#ifdef EPIA_HACK
+epia_nops:
+ .code16
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ ret
+#endif
+
/* vtophys(void *)
* convert boot time 'linear' address to a physical one
*/
Home |
Main Index |
Thread Index |
Old Index