16fc729afSOlivier Houchard /* $NetBSD: frame.h,v 1.5 2002/10/19 00:10:54 bjh21 Exp $ */ 26fc729afSOlivier Houchard 3d8315c79SWarner Losh /*- 4af3dc4a7SPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 5af3dc4a7SPedro F. Giffuni * 66fc729afSOlivier Houchard * Copyright (c) 1994-1997 Mark Brinicombe. 76fc729afSOlivier Houchard * Copyright (c) 1994 Brini. 86fc729afSOlivier Houchard * All rights reserved. 96fc729afSOlivier Houchard * 106fc729afSOlivier Houchard * This code is derived from software written for Brini by Mark Brinicombe 116fc729afSOlivier Houchard * 126fc729afSOlivier Houchard * Redistribution and use in source and binary forms, with or without 136fc729afSOlivier Houchard * modification, are permitted provided that the following conditions 146fc729afSOlivier Houchard * are met: 156fc729afSOlivier Houchard * 1. Redistributions of source code must retain the above copyright 166fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer. 176fc729afSOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright 186fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer in the 196fc729afSOlivier Houchard * documentation and/or other materials provided with the distribution. 206fc729afSOlivier Houchard * 3. All advertising materials mentioning features or use of this software 216fc729afSOlivier Houchard * must display the following acknowledgement: 226fc729afSOlivier Houchard * This product includes software developed by Brini. 236fc729afSOlivier Houchard * 4. The name of the company nor the name of the author may be used to 246fc729afSOlivier Houchard * endorse or promote products derived from this software without specific 256fc729afSOlivier Houchard * prior written permission. 266fc729afSOlivier Houchard * 276fc729afSOlivier Houchard * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 286fc729afSOlivier Houchard * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 296fc729afSOlivier Houchard * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 306fc729afSOlivier Houchard * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 316fc729afSOlivier Houchard * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 326fc729afSOlivier Houchard * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 336fc729afSOlivier Houchard * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 346fc729afSOlivier Houchard * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 356fc729afSOlivier Houchard * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 366fc729afSOlivier Houchard * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 376fc729afSOlivier Houchard * SUCH DAMAGE. 386fc729afSOlivier Houchard * 396fc729afSOlivier Houchard * RiscBSD kernel project 406fc729afSOlivier Houchard * 416fc729afSOlivier Houchard * frame.h 426fc729afSOlivier Houchard * 436fc729afSOlivier Houchard * Stack frames structures 446fc729afSOlivier Houchard * 456fc729afSOlivier Houchard * Created : 30/09/94 466fc729afSOlivier Houchard * 476fc729afSOlivier Houchard */ 486fc729afSOlivier Houchard 496fc729afSOlivier Houchard #ifndef _MACHINE_FRAME_H_ 506fc729afSOlivier Houchard #define _MACHINE_FRAME_H_ 516fc729afSOlivier Houchard 526fc729afSOlivier Houchard #ifndef _LOCORE 536fc729afSOlivier Houchard 546fc729afSOlivier Houchard #include <sys/signal.h> 556fc729afSOlivier Houchard #include <sys/ucontext.h> 566fc729afSOlivier Houchard 576fc729afSOlivier Houchard /* 586fc729afSOlivier Houchard * Trap frame. Pushed onto the kernel stack on a trap (synchronous exception). 596fc729afSOlivier Houchard */ 606fc729afSOlivier Houchard 61123fe396SIan Lepore struct trapframe { 62*aa15f7dfSWarner Losh register_t tf_spsr; 636fc729afSOlivier Houchard register_t tf_r0; 646fc729afSOlivier Houchard register_t tf_r1; 656fc729afSOlivier Houchard register_t tf_r2; 666fc729afSOlivier Houchard register_t tf_r3; 676fc729afSOlivier Houchard register_t tf_r4; 686fc729afSOlivier Houchard register_t tf_r5; 696fc729afSOlivier Houchard register_t tf_r6; 706fc729afSOlivier Houchard register_t tf_r7; 716fc729afSOlivier Houchard register_t tf_r8; 726fc729afSOlivier Houchard register_t tf_r9; 736fc729afSOlivier Houchard register_t tf_r10; 746fc729afSOlivier Houchard register_t tf_r11; 756fc729afSOlivier Houchard register_t tf_r12; 766fc729afSOlivier Houchard register_t tf_usr_sp; 776fc729afSOlivier Houchard register_t tf_usr_lr; 78*aa15f7dfSWarner Losh register_t tf_svc_sp; 79*aa15f7dfSWarner Losh register_t tf_svc_lr; 806fc729afSOlivier Houchard register_t tf_pc; 81d8e3f572SAndrew Turner register_t tf_pad; 82123fe396SIan Lepore }; 836fc729afSOlivier Houchard 846fc729afSOlivier Houchard /* Register numbers */ 856fc729afSOlivier Houchard #define tf_r13 tf_usr_sp 866fc729afSOlivier Houchard #define tf_r14 tf_usr_lr 876fc729afSOlivier Houchard #define tf_r15 tf_pc 886fc729afSOlivier Houchard 896fc729afSOlivier Houchard /* 90c4c27bc9SIan Lepore * Signal frame. Pushed onto user stack before calling sigcode. 91c4c27bc9SIan Lepore * The pointers are used in the trampoline code to locate the ucontext. 92c4c27bc9SIan Lepore */ 936fc729afSOlivier Houchard struct sigframe { 946fc729afSOlivier Houchard siginfo_t sf_si; /* actual saved siginfo */ 956fc729afSOlivier Houchard ucontext_t sf_uc; /* actual saved ucontext */ 966fc9f4dbSMichal Meloun mcontext_vfp_t sf_vfp; /* actual saved VFP context */ 976fc729afSOlivier Houchard }; 986fc729afSOlivier Houchard 996fc729afSOlivier Houchard /* 100078996e0SAndrew Turner * Switch frame. 101078996e0SAndrew Turner * 102078996e0SAndrew Turner * It is important this is a multiple of 8 bytes so the stack is correctly 103078996e0SAndrew Turner * aligned when we create new threads. 1046fc729afSOlivier Houchard */ 105c4c27bc9SIan Lepore struct switchframe 106c4c27bc9SIan Lepore { 107c4c27bc9SIan Lepore register_t sf_r4; 108c4c27bc9SIan Lepore register_t sf_r5; 109c4c27bc9SIan Lepore register_t sf_r6; 110c4c27bc9SIan Lepore register_t sf_r7; 111c4c27bc9SIan Lepore register_t sf_r8; 112c4c27bc9SIan Lepore register_t sf_r9; 113c4c27bc9SIan Lepore register_t sf_r10; 114c4c27bc9SIan Lepore register_t sf_r11; 115c4c27bc9SIan Lepore register_t sf_r12; 116c4c27bc9SIan Lepore register_t sf_sp; 117c4c27bc9SIan Lepore register_t sf_lr; 118c4c27bc9SIan Lepore register_t sf_pc; 119fa878ec3SEd Schouten register_t sf_tpidrurw; 120fa878ec3SEd Schouten register_t sf_spare0; 1216fc729afSOlivier Houchard }; 1226fc729afSOlivier Houchard 1236fc729afSOlivier Houchard /* 1246fc729afSOlivier Houchard * Stack frame. Used during stack traces (db_trace.c) 1256fc729afSOlivier Houchard */ 1266fc729afSOlivier Houchard struct frame { 1276fc729afSOlivier Houchard u_int fr_fp; 1286fc729afSOlivier Houchard u_int fr_sp; 1296fc729afSOlivier Houchard u_int fr_lr; 1306fc729afSOlivier Houchard u_int fr_pc; 1316fc729afSOlivier Houchard }; 1326fc729afSOlivier Houchard 1336fc729afSOlivier Houchard #endif /* !_LOCORE */ 1346fc729afSOlivier Houchard 1356fc729afSOlivier Houchard #endif /* _MACHINE_FRAME_H_ */ 136