Need to flush the I-cache before jumping into just-loaded code.

Without this, boot programs fail with some PROM versions...
This commit is contained in:
gwr 1997-09-18 01:47:08 +00:00
parent 9ce899230a
commit 8b680f206c
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
| $NetBSD: SRT0.S,v 1.2 1995/08/12 18:38:55 gwr Exp $
| $NetBSD: SRT0.S,v 1.3 1997/09/18 01:47:08 gwr Exp $
| Copyright (c) 1995 Gordon W. Ross
| All rights reserved.
@ -30,6 +30,8 @@
| SRT0.S - Stand-alone Run-Time startup code, part 0
.file "SRT0.S"
.set IC_CLEAR,0x9
.text
.globl __estack
__estack:
@ -51,6 +53,9 @@ Lcp:
movl a0@+, a1@+
dbra d0, Lcp
| Clear the I-cache in case the copied code was cached.
movl #IC_CLEAR, d0
movc d0, cacr
| Force a long jump to the relocated code (not pc-relative)
lea restart:l, a0
jmp a0@
@ -84,4 +89,11 @@ _getvbr:
movc vbr, d0
rts
| function to clear the I-cache
.globl _ICIA
_ICIA:
movl #IC_CLEAR, d0
movc d0, cacr
rts
| The end.

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_sun.c,v 1.6 1996/06/20 03:59:41 gwr Exp $ */
/* $NetBSD: exec_sun.c,v 1.7 1997/09/18 01:47:10 gwr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
@ -41,6 +41,7 @@
#include "stand.h"
extern void ICIA();
extern int debug;
int errno;
@ -166,6 +167,7 @@ exec_sun(file, loadaddr)
printf("Starting program at 0x%x\n", (int)entry);
asm("_exec_sun_call_entry:");
ICIA();
(*entry)();
panic("exec returned");