/*1* Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 20092* The President and Fellows of Harvard College.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. Neither the name of the University nor the names of its contributors13* may be used to endorse or promote products derived from this software14* without specific prior written permission.15*16* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _MIPS_TRAPFRAME_H_30#define _MIPS_TRAPFRAME_H_3132/*33* Structure describing what is saved on the stack during entry to34* the exception handler.35*36* This must agree with the code in exception.S.37*/3839struct trapframe {40uint32_t tf_vaddr; /* coprocessor 0 vaddr register */41uint32_t tf_status; /* coprocessor 0 status register */42uint32_t tf_cause; /* coprocessor 0 cause register */43uint32_t tf_lo;44uint32_t tf_hi;45uint32_t tf_ra; /* Saved register 31 */46uint32_t tf_at; /* Saved register 1 (AT) */47uint32_t tf_v0; /* Saved register 2 (v0) */48uint32_t tf_v1; /* etc. */49uint32_t tf_a0;50uint32_t tf_a1;51uint32_t tf_a2;52uint32_t tf_a3;53uint32_t tf_t0;54uint32_t tf_t1;55uint32_t tf_t2;56uint32_t tf_t3;57uint32_t tf_t4;58uint32_t tf_t5;59uint32_t tf_t6;60uint32_t tf_t7;61uint32_t tf_s0;62uint32_t tf_s1;63uint32_t tf_s2;64uint32_t tf_s3;65uint32_t tf_s4;66uint32_t tf_s5;67uint32_t tf_s6;68uint32_t tf_s7;69uint32_t tf_t8;70uint32_t tf_t9;71uint32_t tf_k0; /* dummy (see exception.S comments) */72uint32_t tf_k1; /* dummy */73uint32_t tf_gp;74uint32_t tf_sp;75uint32_t tf_s8;76uint32_t tf_epc; /* coprocessor 0 epc register */77};7879/*80* MIPS exception codes.81*/82#define EX_IRQ 0 /* Interrupt */83#define EX_MOD 1 /* TLB Modify (write to read-only page) */84#define EX_TLBL 2 /* TLB miss on load */85#define EX_TLBS 3 /* TLB miss on store */86#define EX_ADEL 4 /* Address error on load */87#define EX_ADES 5 /* Address error on store */88#define EX_IBE 6 /* Bus error on instruction fetch */89#define EX_DBE 7 /* Bus error on data load *or* store */90#define EX_SYS 8 /* Syscall */91#define EX_BP 9 /* Breakpoint */92#define EX_RI 10 /* Reserved (illegal) instruction */93#define EX_CPU 11 /* Coprocessor unusable */94#define EX_OVF 12 /* Arithmetic overflow */9596/*97* Function to enter user mode. Does not return. The trapframe must98* be on the thread's own stack or bad things will happen.99*/100void mips_usermode(struct trapframe *tf);101102/*103* Arrays used to load the kernel stack and curthread on trap entry.104*/105extern vaddr_t cpustacks[];106extern vaddr_t cputhreads[];107108109#endif /* _MIPS_TRAPFRAME_H_ */110111112