kickstart.S revision 1.1.2.1       1  1.1.2.1  wrstuden /*	$NetBSD: kickstart.S,v 1.1.2.1 1999/12/27 18:31:37 wrstuden Exp $	*/
      2      1.1        is 
      3      1.1        is /*
      4      1.1        is  * Copyright (C) 1998 Ignatios Souvatzis. All rights reserved.
      5      1.1        is  */
      6      1.1        is 
      7      1.1        is #define PPC_CACHESIZE 16384
      8      1.1        is #define PPC_LINESIZE 32
      9      1.1        is 
     10      1.1        is /*
     11      1.1        is Memst:	.long	0x08000000
     12      1.1        is Krnst:	.long	0x082f3400
     13      1.1        is Krnsz:	.long	0x00100000
     14      1.1        is  */
     15      1.1        is 	.globl _start
     16      1.1        is _start:
     17      1.1        is 	bl	L2	/* we start with this address @ 0xfff00100 */
     18      1.1        is L2:
     19      1.1        is 	lis	13,0xf60000@ha
     20      1.1        is 	li	14,0x08
     21      1.1        is 	stb	14,0xf60000@l(13)
     22      1.1        is #ifdef DEBUG
     23      1.1        is 	lis	13,0xdff180@h
     24      1.1        is 	ori	13,13,0xdff180@l
     25      1.1        is 
     26      1.1        is 	lis	12,1000000@h
     27      1.1        is 	ori	12,12,1000000@l
     28      1.1        is 	mtctr	12
     29      1.1        is L2a:
     30      1.1        is 	li	14,0x00f
     31      1.1        is 	sth	14,0(13)
     32      1.1        is 	sync
     33      1.1        is 	li	14,0xf0f
     34      1.1        is 	sth	14,0(13)
     35      1.1        is 	sync
     36      1.1        is 	bdnz	L2a
     37      1.1        is #endif
     38      1.1        is 	mflr	3
     39      1.1        is 	lwz	4,-16(3)
     40      1.1        is 	lwz	5,-12(3)
     41      1.1        is 	lwz	6,-8(3)
     42      1.1        is 	li	7,3
     43      1.1        is 	addi	8,6,3
     44      1.1        is 	cmplw	4,5
     45      1.1        is 	andc	8,8,7
     46      1.1        is 	srwi	9,8,2
     47      1.1        is 	mtctr	9
     48      1.1        is 	bgt	Lb0
     49      1.1        is /* here: copying downwards and forwards */
     50      1.1        is 	lwz	9,0(5)
     51      1.1        is 	stw	9,0(4)
     52      1.1        is 	bdz	Lflush
     53      1.1        is Lf1:	lwzu	7,4(5)
     54      1.1        is 	stwu	7,4(4)
     55      1.1        is 	bdnz	Lf1
     56      1.1        is 	b	Lflush
     57      1.1        is 
     58      1.1        is Lb0:	add	4,4,8	/* add the rounded up length */
     59      1.1        is 	add	5,5,8	/* add the rounded up length */
     60      1.1        is Lb1:	lwzu	7,-4(5)
     61      1.1        is 	stwu	7,-4(4)
     62      1.1        is 	bdnz	Lb1
     63      1.1        is 
     64      1.1        is Lflush:
     65      1.1        is #ifdef DEBUG
     66      1.1        is 	li	14,0xff0
     67      1.1        is 	sth	14,0(13)
     68      1.1        is 	sync
     69      1.1        is #endif
     70      1.1        is 	li	10,PPC_CACHESIZE/PPC_LINESIZE
     71      1.1        is 	li	11,PPC_LINESIZE
     72      1.1        is /* dcbst loop */
     73      1.1        is 	mtctr	10
     74      1.1        is 	lwz	12,-8(3)
     75      1.1        is Lfl1:	dcbst	0,12
     76      1.1        is 	add	12,12,11
     77      1.1        is 	bdnz	Lfl1
     78      1.1        is 	sync		/* and wait for past instructions to finish */
     79      1.1        is /* icbi loop */
     80      1.1        is 	mtctr	10
     81      1.1        is 	lwz	12,-8(3)
     82      1.1        is Lfl2:	icbi	0,12
     83      1.1        is 	add	12,12,11
     84      1.1        is 	bdnz	Lfl2
     85      1.1        is 	sync		/* and wait for past instructions to finish */
     86      1.1        is 	isync		/* and flush instruction queue */
     87      1.1        is Ljump:
     88      1.1        is #ifdef DEBUG
     89      1.1        is 	li	14,0x0f0
     90      1.1        is 	sth	14,0(13)
     91      1.1        is 	sync
     92      1.1        is #endif
     93      1.1        is 	lwz	3,-16(3)
     94      1.1        is 	mtlr	3
     95      1.1        is 	blr
     96      1.1        is /* NOTREACHED */
     97