Subject: port-next68k/16793: MMU activation fails because global jump is pc-relative
To: None <gnats-bugs@gnats.netbsd.org>
From: None <chris@Pin.LU>
List: netbsd-bugs
Date: 05/14/2002 01:00:11
>Number:         16793
>Category:       port-next68k
>Synopsis:       MMU activation fails because global jump is pc-relative
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-next68k-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 13 16:40:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christian Limpach
>Release:        current (as of May 14 2002)
>Organization:
	
>Environment:
	
System: NetBSD clapper 1.5ZC NetBSD 1.5ZC (CLAPPER) #46: Mon May 13 20:51:50 CEST 2002     root@marble:/devel/netbsd/src-current/sys/arch/next68k/compile/CLAPPER next68k


>Description:
	
	The global jump into mapped memory to finish MMU activation fails
	because recent gas versions generate pc-relative jumps.

>How-To-Repeat:
	
	boot a kernel built with gas from a recent toolchain

>Fix:
	
	The following patch forces non-pc-relative jumps.  Other m68k ports
	fix this the same way.

Index: arch/next68k/next68k/locore.s
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/next68k/next68k/locore.s,v
retrieving revision 1.33
diff -u -r1.33 locore.s
--- locore.s	2001/07/22 13:34:07	1.33
+++ locore.s	2002/05/13 23:33:31
@@ -378,7 +378,8 @@
 	movl	#0x80008000,%d0
 	movc	%d0,%cacr		| turn on both caches
 
-	jmp     Lturnoffttr		| global jump into mapped memory.
+	.word	0x4ef9     		| global jump into mapped memory.
+	.long	Lturnoffttr		| (forced not to be pc-relative)
 Lturnoffttr:
 	moveq	#0,%d0			| ensure TT regs are disabled
 	.long	0x4e7b0004		| movc %d0,%itt0
@@ -394,12 +395,14 @@
 	RELOC(prototc, %a2)
 	movl	#0x82c0aa00,%a2@	| value to load TC with
 	pmove	%a2@,%tc		| load it
-	jmp	Lenab1
+	.word	0x4ef9			| jmp Lenab1
+	.long	Lenab1			| (forced not be be pc-relative)
 #if defined(ENABLE_HP_CODE)
 Lhpmmu3:
 	movl	#0,INTIOBASE+MMUBASE+MMUCMD	| clear external cache
 	movl	#MMU_ENAB,INTIOBASE+MMUBASE+MMUCMD | turn on MMU
-	jmp	Lenab1				| jmp to mapped code
+	.word	0x4ef9			| jmp Lenab1 to mapped code
+	.long	Lenab1			| (forced not be be pc-relative)
 #endif
 #if defined(ENABLE_MAXADDR_TRAMPOLINE)
 Lehighcode:

>Release-Note:
>Audit-Trail:
>Unformatted: