		.file	"startup.S"
	
		.text
		.section .init,"ax"
		.extern _init
		.align	2
	
_start:
		.set	noreorder

		# set stack pointer 
		la	$sp, stack_ptr

		# Set Kernel mode
		li		$26, 0x1040000C
		mtc0	$26, $12
		li		$26, 0x00000000
		mtc0	$26, $13

		mfc0	$26, $15
		nop
		mtc0	$26, $31

		# Invalidate I-Cache
		cop0	32
		
		# Invalidate D-Cache
		cop0	34

		# jump init
		la $26, _init
		jalr $26
		nop

		la $26, main
		jalr $26
		nop
_terminate:
		nop
		j		_terminate
		nop
	
		.set	reorder
