1129198Scognet/*	$NetBSD: frame.h,v 1.5 2002/10/19 00:10:54 bjh21 Exp $	*/
2129198Scognet
3139735Simp/*-
4129198Scognet * Copyright (c) 1994-1997 Mark Brinicombe.
5129198Scognet * Copyright (c) 1994 Brini.
6129198Scognet * All rights reserved.
7129198Scognet *
8129198Scognet * This code is derived from software written for Brini by Mark Brinicombe
9129198Scognet *
10129198Scognet * Redistribution and use in source and binary forms, with or without
11129198Scognet * modification, are permitted provided that the following conditions
12129198Scognet * are met:
13129198Scognet * 1. Redistributions of source code must retain the above copyright
14129198Scognet *    notice, this list of conditions and the following disclaimer.
15129198Scognet * 2. Redistributions in binary form must reproduce the above copyright
16129198Scognet *    notice, this list of conditions and the following disclaimer in the
17129198Scognet *    documentation and/or other materials provided with the distribution.
18129198Scognet * 3. All advertising materials mentioning features or use of this software
19129198Scognet *    must display the following acknowledgement:
20129198Scognet *	This product includes software developed by Brini.
21129198Scognet * 4. The name of the company nor the name of the author may be used to
22129198Scognet *    endorse or promote products derived from this software without specific
23129198Scognet *    prior written permission.
24129198Scognet *
25129198Scognet * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
26129198Scognet * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27129198Scognet * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28129198Scognet * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29129198Scognet * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30129198Scognet * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31129198Scognet * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35129198Scognet * SUCH DAMAGE.
36129198Scognet *
37129198Scognet * RiscBSD kernel project
38129198Scognet *
39129198Scognet * frame.h
40129198Scognet *
41129198Scognet * Stack frames structures
42129198Scognet *
43129198Scognet * Created      : 30/09/94
44129198Scognet *
45129198Scognet * $FreeBSD: stable/11/sys/arm/include/frame.h 317005 2017-04-16 07:33:47Z mmel $
46129198Scognet *
47129198Scognet */
48129198Scognet
49129198Scognet#ifndef _MACHINE_FRAME_H_
50129198Scognet#define _MACHINE_FRAME_H_
51129198Scognet
52129198Scognet#ifndef _LOCORE
53129198Scognet
54129198Scognet#include <sys/signal.h>
55129198Scognet#include <sys/ucontext.h>
56129198Scognet
57129198Scognet
58129198Scognet/*
59129198Scognet * Trap frame.  Pushed onto the kernel stack on a trap (synchronous exception).
60129198Scognet */
61129198Scognet
62257217Sianstruct trapframe {
63129198Scognet	register_t tf_spsr; /* Zero on arm26 */
64129198Scognet	register_t tf_r0;
65253968Sandrew	register_t tf_r1;
66129198Scognet	register_t tf_r2;
67129198Scognet	register_t tf_r3;
68129198Scognet	register_t tf_r4;
69129198Scognet	register_t tf_r5;
70129198Scognet	register_t tf_r6;
71129198Scognet	register_t tf_r7;
72129198Scognet	register_t tf_r8;
73129198Scognet	register_t tf_r9;
74129198Scognet	register_t tf_r10;
75129198Scognet	register_t tf_r11;
76129198Scognet	register_t tf_r12;
77129198Scognet	register_t tf_usr_sp;
78129198Scognet	register_t tf_usr_lr;
79129198Scognet	register_t tf_svc_sp; /* Not used on arm26 */
80129198Scognet	register_t tf_svc_lr; /* Not used on arm26 */
81253968Sandrew	register_t tf_pc;
82253968Sandrew	register_t tf_pad;
83257217Sian};
84129198Scognet
85129198Scognet/* Register numbers */
86129198Scognet#define tf_r13 tf_usr_sp
87129198Scognet#define tf_r14 tf_usr_lr
88129198Scognet#define tf_r15 tf_pc
89129198Scognet
90129198Scognet/*
91276190Sian * Signal frame.  Pushed onto user stack before calling sigcode.
92276190Sian * The pointers are used in the trampoline code to locate the ucontext.
93276190Sian */
94129198Scognetstruct sigframe {
95276190Sian	siginfo_t       sf_si;          /* actual saved siginfo */
96129198Scognet	ucontext_t      sf_uc;          /* actual saved ucontext */
97317005Smmel	mcontext_vfp_t	sf_vfp;         /* actual saved VFP context */
98129198Scognet};
99129198Scognet
100129198Scognet
101129198Scognet/*
102247864Sandrew * Switch frame.
103247864Sandrew *
104247864Sandrew * It is important this is a multiple of 8 bytes so the stack is correctly
105247864Sandrew * aligned when we create new threads.
106129198Scognet */
107276190Sianstruct switchframe
108276190Sian{
109276190Sian        register_t sf_r4;
110276190Sian        register_t sf_r5;
111276190Sian        register_t sf_r6;
112276190Sian        register_t sf_r7;
113276190Sian        register_t sf_r8;
114276190Sian        register_t sf_r9;
115276190Sian        register_t sf_r10;
116276190Sian        register_t sf_r11;
117276190Sian        register_t sf_r12;
118276190Sian        register_t sf_sp;
119276190Sian        register_t sf_lr;
120276190Sian        register_t sf_pc;
121307136Sed#if __ARM_ARCH >= 6
122307136Sed        register_t sf_tpidrurw;
123307136Sed        register_t sf_spare0;
124307136Sed#endif
125129198Scognet};
126236992Simp
127276190Sian
128129198Scognet/*
129129198Scognet * Stack frame. Used during stack traces (db_trace.c)
130129198Scognet */
131129198Scognetstruct frame {
132129198Scognet	u_int	fr_fp;
133129198Scognet	u_int	fr_sp;
134129198Scognet	u_int	fr_lr;
135129198Scognet	u_int	fr_pc;
136129198Scognet};
137129198Scognet
138129198Scognet#endif /* !_LOCORE */
139129198Scognet
140129198Scognet#endif /* _MACHINE_FRAME_H_ */
141