xref: /netbsd-src/sys/arch/emips/stand/common/start.h (revision 5f7e80a8347a06224e3d98023e437667ed7b47d5)
1*5f7e80a8Spooka /*	$NetBSD: start.h,v 1.1 2011/01/26 01:18:54 pooka Exp $	*/
2*5f7e80a8Spooka 
3*5f7e80a8Spooka /*-
4*5f7e80a8Spooka  * Copyright (c) 2010 The NetBSD Foundation, Inc.
5*5f7e80a8Spooka  * All rights reserved.
6*5f7e80a8Spooka  *
7*5f7e80a8Spooka  * This code was written by Alessandro Forin and Neil Pittman
8*5f7e80a8Spooka  * at Microsoft Research and contributed to The NetBSD Foundation
9*5f7e80a8Spooka  * by Microsoft Corporation.
10*5f7e80a8Spooka  *
11*5f7e80a8Spooka  * Redistribution and use in source and binary forms, with or without
12*5f7e80a8Spooka  * modification, are permitted provided that the following conditions
13*5f7e80a8Spooka  * are met:
14*5f7e80a8Spooka  * 1. Redistributions of source code must retain the above copyright
15*5f7e80a8Spooka  *    notice, this list of conditions and the following disclaimer.
16*5f7e80a8Spooka  * 2. Redistributions in binary form must reproduce the above copyright
17*5f7e80a8Spooka  *    notice, this list of conditions and the following disclaimer in the
18*5f7e80a8Spooka  *    documentation and/or other materials provided with the distribution.
19*5f7e80a8Spooka  *
20*5f7e80a8Spooka  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21*5f7e80a8Spooka  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22*5f7e80a8Spooka  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23*5f7e80a8Spooka  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24*5f7e80a8Spooka  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25*5f7e80a8Spooka  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26*5f7e80a8Spooka  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27*5f7e80a8Spooka  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28*5f7e80a8Spooka  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29*5f7e80a8Spooka  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30*5f7e80a8Spooka  * POSSIBILITY OF SUCH DAMAGE.
31*5f7e80a8Spooka  */
32*5f7e80a8Spooka 
33*5f7e80a8Spooka extern int PutWord(uint32_t Word);
34*5f7e80a8Spooka extern int Puts(char *String);
35*5f7e80a8Spooka extern int GetChar(void);
36*5f7e80a8Spooka extern  int PutChar(uint8_t v);
37*5f7e80a8Spooka extern void Delay(uint32_t count);
38*5f7e80a8Spooka extern uint32_t GetPsr(void);
39*5f7e80a8Spooka extern void SetPsr(uint32_t Psr);
40*5f7e80a8Spooka extern uint32_t GetCause(void);
41*5f7e80a8Spooka extern uint32_t GetEpc(void);
42*5f7e80a8Spooka extern volatile void Stop(void);
43*5f7e80a8Spooka extern void switch_stack_and_call(void *arg, void (*function)(void *));
44*5f7e80a8Spooka 
45*5f7e80a8Spooka typedef struct  _CXTINFO {
46*5f7e80a8Spooka     /* Structure must match with mips_asm.h etc. */
47*5f7e80a8Spooka     uint32_t gpr[32];
48*5f7e80a8Spooka     uint32_t pc;
49*5f7e80a8Spooka     uint32_t sr;           /* c0_status */
50*5f7e80a8Spooka     uint32_t hi;
51*5f7e80a8Spooka     uint32_t lo;
52*5f7e80a8Spooka } CXTINFO, *PCXTINFO;
53*5f7e80a8Spooka 
54*5f7e80a8Spooka typedef PCXTINFO (*USER_EXCEPTION_HANDLER)(PCXTINFO pContext);
55*5f7e80a8Spooka extern char ExceptionHandler[];
56*5f7e80a8Spooka extern char ExceptionHandlerEnd[];
57*5f7e80a8Spooka extern USER_EXCEPTION_HANDLER *UserInterruptHandler;
58*5f7e80a8Spooka 
59*5f7e80a8Spooka extern char start[];
60*5f7e80a8Spooka extern char _end[]; /* ..and beginning of free memory */
61