/*
    start.S, Copyright  (c) by George Fankhauser,
    Swiss Federal Institute of Technology,
    Computer Engineering and Networks Laboratory.

    TOPSY -- A Teachable Operating System.
             Implementation of a tiny and simple
             micro kernel for teaching purposes.

    For further information, please visit http://www.tik.ee.ethz.ch/~topsy

    This software is provided under the terms of the GNU General Public Licence.

    A full copy of the GNU GPL is provided in the file COPYING found in the 
    development root of Topsy.
*/
/*
	
	File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/Startup/mips/start.S,v $
 	Author(s):             George Fankhauser
 	Affiliation:           ETH Zuerich, TIK
 	Version:               $Revision: 2922 $
 	Creation Date:         
 	Last Date of Change:   $Date: 2007-03-19 17:48:52 +0100 (Mon, 19 Mär 2007) $      by: $Author: baderma $
	
	
*/

#include "asm.h"
#include "cpu.h"
#include "MemoryLayout.h"

	.text
	.align  2

/* __start: the starting point, the address where the EPROM loader or
 * the simulator jumps to 
 */

LABEL(__start)

	j			__start2
	.org 0x10
LABEL(__segmap)
	.asciz  "TOPSYmips"     // MARKER for PATCHING
	.org 0x20
	
	nop	
	nop
	nop
	nop				
			/* make sure there is enough room for information storage
				 the Topsy Header is 128 bytes long
			 */
	.org    0x90    

__start2:
	la		gp, 0x80000000 	    /*_gp, value of global pointer */
	la		sp, BOOTSTACKTOP    /* prepare bootstack */
	move	fp, sp
	subu	sp, sp, 32					/* make space for arg0 - arg3 */
	sw		ra, 28(sp)
	sw		fp, 24(sp)


	mtc0	zero, C0_STATUS	 /* disable interrupts, kernel mode */
	jal		StartMeFirst
	nop

