frame.h revision 247864
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: head/sys/arm/include/frame.h 247864 2013-03-06 06:19:56Z andrew $ 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 62129198Scognettypedef struct trapframe { 63129198Scognet register_t tf_spsr; /* Zero on arm26 */ 64129198Scognet register_t tf_r0; 65129198Scognet 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 */ 81129198Scognet register_t tf_pc; 82129198Scognet} trapframe_t; 83129198Scognet 84129198Scognet/* Register numbers */ 85129198Scognet#define tf_r13 tf_usr_sp 86129198Scognet#define tf_r14 tf_usr_lr 87129198Scognet#define tf_r15 tf_pc 88129198Scognet/* 89129198Scognet * * Scheduler activations upcall frame. Pushed onto user stack before 90129198Scognet * * calling an SA upcall. 91129198Scognet * */ 92129198Scognet 93129198Scognetstruct saframe { 94129198Scognet#if 0 /* in registers on entry to upcall */ 95129198Scognet int sa_type; 96129198Scognet struct sa_t ** sa_sas; 97129198Scognet int sa_events; 98129198Scognet int sa_interrupted; 99129198Scognet#endif 100129198Scognet void * sa_arg; 101129198Scognet}; 102129198Scognet 103129198Scognet/* 104129198Scognet * * Signal frame. Pushed onto user stack before calling sigcode. 105129198Scognet * */ 106129198Scognet 107129198Scognet/* the pointers are use in the trampoline code to locate the ucontext */ 108129198Scognetstruct sigframe { 109129198Scognet siginfo_t sf_si; /* actual saved siginfo */ 110129198Scognet ucontext_t sf_uc; /* actual saved ucontext */ 111129198Scognet}; 112129198Scognet 113129198Scognet/* 114129198Scognet * System stack frames. 115129198Scognet */ 116129198Scognet 117129198Scognet 118129198Scognettypedef struct irqframe { 119129198Scognet unsigned int if_spsr; 120129198Scognet unsigned int if_r0; 121129198Scognet unsigned int if_r1; 122129198Scognet unsigned int if_r2; 123129198Scognet unsigned int if_r3; 124129198Scognet unsigned int if_r4; 125129198Scognet unsigned int if_r5; 126129198Scognet unsigned int if_r6; 127129198Scognet unsigned int if_r7; 128129198Scognet unsigned int if_r8; 129129198Scognet unsigned int if_r9; 130129198Scognet unsigned int if_r10; 131129198Scognet unsigned int if_r11; 132129198Scognet unsigned int if_r12; 133129198Scognet unsigned int if_usr_sp; 134129198Scognet unsigned int if_usr_lr; 135129198Scognet unsigned int if_svc_sp; 136129198Scognet unsigned int if_svc_lr; 137129198Scognet unsigned int if_pc; 138129198Scognet} irqframe_t; 139129198Scognet 140129198Scognet/* 141247864Sandrew * Switch frame. 142247864Sandrew * 143247864Sandrew * It is important this is a multiple of 8 bytes so the stack is correctly 144247864Sandrew * aligned when we create new threads. 145129198Scognet */ 146129198Scognet 147129198Scognetstruct switchframe { 148247864Sandrew u_int pad; /* Used to pad the struct to a multiple of 8-bytes */ 149129198Scognet u_int sf_r4; 150129198Scognet u_int sf_r5; 151129198Scognet u_int sf_r6; 152129198Scognet u_int sf_r7; 153129198Scognet u_int sf_pc; 154129198Scognet}; 155236992Simp 156129198Scognet/* 157129198Scognet * Stack frame. Used during stack traces (db_trace.c) 158129198Scognet */ 159129198Scognetstruct frame { 160129198Scognet u_int fr_fp; 161129198Scognet u_int fr_sp; 162129198Scognet u_int fr_lr; 163129198Scognet u_int fr_pc; 164129198Scognet}; 165129198Scognet 166129198Scognet#endif /* !_LOCORE */ 167129198Scognet 168129198Scognet#endif /* _MACHINE_FRAME_H_ */ 169