frame.h revision 276190
186659Sjoe/*	$NetBSD: frame.h,v 1.5 2002/10/19 00:10:54 bjh21 Exp $	*/
286659Sjoe
386659Sjoe/*-
486659Sjoe * Copyright (c) 1994-1997 Mark Brinicombe.
586659Sjoe * Copyright (c) 1994 Brini.
686659Sjoe * All rights reserved.
786659Sjoe *
886659Sjoe * This code is derived from software written for Brini by Mark Brinicombe
986659Sjoe *
1086659Sjoe * Redistribution and use in source and binary forms, with or without
1186659Sjoe * modification, are permitted provided that the following conditions
1286659Sjoe * are met:
1386659Sjoe * 1. Redistributions of source code must retain the above copyright
1486659Sjoe *    notice, this list of conditions and the following disclaimer.
1586659Sjoe * 2. Redistributions in binary form must reproduce the above copyright
1686659Sjoe *    notice, this list of conditions and the following disclaimer in the
1786659Sjoe *    documentation and/or other materials provided with the distribution.
1886659Sjoe * 3. All advertising materials mentioning features or use of this software
1986659Sjoe *    must display the following acknowledgement:
2086659Sjoe *	This product includes software developed by Brini.
2186659Sjoe * 4. The name of the company nor the name of the author may be used to
2286659Sjoe *    endorse or promote products derived from this software without specific
2386659Sjoe *    prior written permission.
2486659Sjoe *
2586659Sjoe * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
2686659Sjoe * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2786659Sjoe * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2886659Sjoe * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
2986659Sjoe * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3086659Sjoe * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3186659Sjoe * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32266560Sgavin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3386659Sjoe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3486659Sjoe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3586659Sjoe * SUCH DAMAGE.
3686659Sjoe *
3786659Sjoe * RiscBSD kernel project
3886659Sjoe *
39238771Swblock * frame.h
40238771Swblock *
41238771Swblock * Stack frames structures
42238771Swblock *
4386659Sjoe * Created      : 30/09/94
4486659Sjoe *
4586659Sjoe * $FreeBSD: head/sys/arm/include/frame.h 276190 2014-12-24 18:54:31Z ian $
4686659Sjoe *
4786775Sru */
4886775Sru
4986659Sjoe#ifndef _MACHINE_FRAME_H_
5086659Sjoe#define _MACHINE_FRAME_H_
5186659Sjoe
5286775Sru#ifndef _LOCORE
5386775Sru
5486659Sjoe#include <sys/signal.h>
5586775Sru#include <sys/ucontext.h>
5686775Sru
5786775Sru
5886775Sru/*
59238771Swblock * Trap frame.  Pushed onto the kernel stack on a trap (synchronous exception).
60238771Swblock */
6186659Sjoe
62238771Swblockstruct trapframe {
6386659Sjoe	register_t tf_spsr; /* Zero on arm26 */
6486659Sjoe	register_t tf_r0;
65238771Swblock	register_t tf_r1;
6686659Sjoe	register_t tf_r2;
67238771Swblock	register_t tf_r3;
6886659Sjoe	register_t tf_r4;
6986659Sjoe	register_t tf_r5;
7086659Sjoe	register_t tf_r6;
7186775Sru	register_t tf_r7;
72238771Swblock	register_t tf_r8;
73238771Swblock	register_t tf_r9;
74238771Swblock	register_t tf_r10;
7586659Sjoe	register_t tf_r11;
7686659Sjoe	register_t tf_r12;
7786659Sjoe	register_t tf_usr_sp;
7886659Sjoe	register_t tf_usr_lr;
7986659Sjoe	register_t tf_svc_sp; /* Not used on arm26 */
8086775Sru	register_t tf_svc_lr; /* Not used on arm26 */
8186775Sru	register_t tf_pc;
8286659Sjoe	register_t tf_pad;
8386659Sjoe};
8486659Sjoe
8586659Sjoe/* Register numbers */
8686775Sru#define tf_r13 tf_usr_sp
8786775Sru#define tf_r14 tf_usr_lr
8886775Sru#define tf_r15 tf_pc
8986659Sjoe
9086659Sjoe/*
9186659Sjoe * Signal frame.  Pushed onto user stack before calling sigcode.
9286659Sjoe * The pointers are used in the trampoline code to locate the ucontext.
9386659Sjoe */
9486659Sjoestruct sigframe {
9586775Sru	siginfo_t       sf_si;          /* actual saved siginfo */
9686775Sru	ucontext_t      sf_uc;          /* actual saved ucontext */
9786659Sjoe};
9886659Sjoe
9986659Sjoe
10086659Sjoe/*
10186775Sru * Switch frame.
10286659Sjoe *
103111680Sjhay * It is important this is a multiple of 8 bytes so the stack is correctly
104111680Sjhay * aligned when we create new threads.
105111680Sjhay */
10686659Sjoestruct switchframe
107111680Sjhay{
108111680Sjhay        register_t sf_r4;
10986775Sru        register_t sf_r5;
11086775Sru        register_t sf_r6;
11186659Sjoe        register_t sf_r7;
11286659Sjoe        register_t sf_r8;
11386659Sjoe        register_t sf_r9;
11486659Sjoe        register_t sf_r10;
11586659Sjoe        register_t sf_r11;
11686775Sru        register_t sf_r12;
11786775Sru        register_t sf_sp;
11886775Sru        register_t sf_lr;
11986775Sru        register_t sf_pc;
12086659Sjoe};
12186659Sjoe
12286775Sru
123238771Swblock/*
124238771Swblock * Stack frame. Used during stack traces (db_trace.c)
12586775Sru */
12686659Sjoestruct frame {
12786659Sjoe	u_int	fr_fp;
12886659Sjoe	u_int	fr_sp;
12986659Sjoe	u_int	fr_lr;
13086659Sjoe	u_int	fr_pc;
13186659Sjoe};
13286775Sru
13386775Sru#endif /* !_LOCORE */
13486659Sjoe
13586775Sru#endif /* _MACHINE_FRAME_H_ */
13686659Sjoe