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$ 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 62259329Sianstruct 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; 83259329Sian}; 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 * * Scheduler activations upcall frame. Pushed onto user stack before 91129198Scognet * * calling an SA upcall. 92129198Scognet * */ 93129198Scognet 94129198Scognetstruct saframe { 95129198Scognet#if 0 /* in registers on entry to upcall */ 96129198Scognet int sa_type; 97129198Scognet struct sa_t ** sa_sas; 98129198Scognet int sa_events; 99129198Scognet int sa_interrupted; 100129198Scognet#endif 101129198Scognet void * sa_arg; 102129198Scognet}; 103129198Scognet 104129198Scognet/* 105129198Scognet * * Signal frame. Pushed onto user stack before calling sigcode. 106129198Scognet * */ 107129198Scognet 108129198Scognet/* the pointers are use in the trampoline code to locate the ucontext */ 109129198Scognetstruct sigframe { 110129198Scognet siginfo_t sf_si; /* actual saved siginfo */ 111129198Scognet ucontext_t sf_uc; /* actual saved ucontext */ 112129198Scognet}; 113129198Scognet 114129198Scognet/* 115129198Scognet * System stack frames. 116129198Scognet */ 117129198Scognet 118129198Scognet 119129198Scognettypedef struct irqframe { 120129198Scognet unsigned int if_spsr; 121129198Scognet unsigned int if_r0; 122129198Scognet unsigned int if_r1; 123129198Scognet unsigned int if_r2; 124129198Scognet unsigned int if_r3; 125129198Scognet unsigned int if_r4; 126129198Scognet unsigned int if_r5; 127129198Scognet unsigned int if_r6; 128129198Scognet unsigned int if_r7; 129129198Scognet unsigned int if_r8; 130129198Scognet unsigned int if_r9; 131129198Scognet unsigned int if_r10; 132129198Scognet unsigned int if_r11; 133129198Scognet unsigned int if_r12; 134129198Scognet unsigned int if_usr_sp; 135129198Scognet unsigned int if_usr_lr; 136129198Scognet unsigned int if_svc_sp; 137129198Scognet unsigned int if_svc_lr; 138129198Scognet unsigned int if_pc; 139129198Scognet} irqframe_t; 140129198Scognet 141129198Scognet/* 142247864Sandrew * Switch frame. 143247864Sandrew * 144247864Sandrew * It is important this is a multiple of 8 bytes so the stack is correctly 145247864Sandrew * aligned when we create new threads. 146129198Scognet */ 147129198Scognet 148129198Scognetstruct switchframe { 149247864Sandrew u_int pad; /* Used to pad the struct to a multiple of 8-bytes */ 150129198Scognet u_int sf_r4; 151129198Scognet u_int sf_r5; 152129198Scognet u_int sf_r6; 153129198Scognet u_int sf_r7; 154129198Scognet u_int sf_pc; 155129198Scognet}; 156236992Simp 157129198Scognet/* 158129198Scognet * Stack frame. Used during stack traces (db_trace.c) 159129198Scognet */ 160129198Scognetstruct frame { 161129198Scognet u_int fr_fp; 162129198Scognet u_int fr_sp; 163129198Scognet u_int fr_lr; 164129198Scognet u_int fr_pc; 165129198Scognet}; 166129198Scognet 167129198Scognet#endif /* !_LOCORE */ 168129198Scognet 169129198Scognet#endif /* _MACHINE_FRAME_H_ */ 170