9os

Experimental kernel using plan9 ideas for embedded device
git clone git://git.simple-cc.org/9os
Log | Files | Refs | README | LICENSE

crt.s (839B)


      1 	.FILE	"crt.s"
      2 
      3 	.INCLUDE	"defines.inc"
      4 
      5 	.TEXT
      6 	.GLOBL	_start,outsync
      7 _start:
      8 	MRS	X10,CURRENTEL
      9 	UBFX	X10,X10,#2,#2
     10 	CMP	X10,1
     11 	BEQ	EL1
     12 
     13 EL2:
     14 	MOV	X10,A | D | IRQ | FIQ | EL1h
     15 	MSR	SPSR_EL2,X10
     16 
     17 	LDR	W10,=SCTLR | SA0 | SA | A
     18 	MSR	SCTLR_EL1,X10
     19 
     20 	LDR	W10,=RW
     21 	MSR	HCR_EL2,X10
     22 
     23 	ADR	X10,EL1
     24 	MSR	ELR_EL2,X10
     25 	ERET
     26 
     27 EL1:
     28 	LDR	W10,=SCTLR | SA0 | SA | A
     29 	MSR	SCTLR_EL1,X10
     30 	ISB
     31 
     32 	MSR	SPSEL,#1
     33 	ISB
     34 
     35 	ADR	X10,vectbl
     36 	MSR	VBAR_EL1,X10
     37 	ISB
     38 
     39 	ADR	X0,mach
     40 	LDR	X9,[X0]
     41 	MOV	SP,X9
     42 	MOV	X29,0
     43 
     44 	ADR	X0,edata
     45 	MOV	X1,0
     46 	ADR	X2,end
     47 	SUB	X2,X2,X0
     48 	BL	memset
     49 
     50 	BL	imach
     51 	BL	immu
     52 	BL	initmap
     53 	BL	mmuon
     54 	BL	kernelmap
     55 	BL	hmem
     56 
     57 	ADR	X10,vectbl
     58 	MSR	VBAR_EL1,X10
     59 	ISB
     60 
     61 	BL	taskmap
     62 	BL	main
     63 
     64 outsync:
     65 	ADR	X0,OUTSYNCT
     66 	B	panic
     67 
     68 	.TEXT
     69 hmem:
     70 	ADR	X0,mach
     71 	LDR	X9,[X0,16]
     72 	ADD	X30,X30,X9
     73 	ADR	X9,inlowmem
     74 	STR	WZR,[X9]
     75 	RET
     76 
     77  OUTSYNCT:
     78 	.ASCIZ	"out of sync"