changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/9/bcm64/rebootcode.s

revision 7235: b1dc95374307
     1.1new file mode 100644
     1.2--- /dev/null
     1.3+++ b/sys/src/9/bcm64/rebootcode.s
     1.4@@ -0,0 +1,51 @@
     1.5+#include "mem.h"
     1.6+#include "sysreg.h"
     1.7+
     1.8+#undef	SYSREG
     1.9+#define	SYSREG(op0,op1,Cn,Cm,op2)	SPR(((op0)<<19|(op1)<<16|(Cn)<<12|(Cm)<<8|(op2)<<5))
    1.10+
    1.11+TEXT _start(SB), 1, $-4
    1.12+	MOV	$setSB(SB), R28
    1.13+
    1.14+	MRS	MPIDR_EL1, R27
    1.15+	ANDW	$(MAXMACH-1), R27
    1.16+	LSL	$3, R27
    1.17+	ADD	$(SPINTABLE-KZERO), R27
    1.18+
    1.19+	CBZ	R0, _mmuoff
    1.20+	MOV	R0, (R27)
    1.21+	MOV	code+8(FP), R1
    1.22+	MOVWU	size+16(FP), R2
    1.23+	BIC	$3, R2
    1.24+	ADD	R1, R2, R3
    1.25+
    1.26+_copy:
    1.27+	MOVW	(R1)4!, R4
    1.28+	MOVW	R4, (R0)4!
    1.29+	CMP	R1, R3
    1.30+	BNE	_copy
    1.31+
    1.32+	BL	cachedwbinv(SB)
    1.33+	BL	l2cacheuwbinv(SB)
    1.34+	SEVL
    1.35+
    1.36+_mmuoff:
    1.37+	ISB	$SY
    1.38+	MRS	SCTLR_EL1, R0
    1.39+	BIC	$(1<<0 | 1<<2 | 1<<12), R0
    1.40+	ISB	$SY
    1.41+	MSR	R0, SCTLR_EL1
    1.42+	ISB	$SY
    1.43+
    1.44+	DSB	$NSHST
    1.45+	TLBI	R0, 0,8,7,0	/* VMALLE1 */
    1.46+	DSB	$NSH
    1.47+	ISB	$SY
    1.48+
    1.49+	BL	cachedwbinv(SB)
    1.50+	BL	cacheiinv(SB)
    1.51+_wait:
    1.52+	WFE
    1.53+	MOV	(R27), LR
    1.54+	CBZ	LR, _wait
    1.55+	RETURN