160727d8bSWarner Losh /*- 2fb75554eSBenno Rice * Copyright (C) 1995, 1996 Wolfgang Solfrank. 3fb75554eSBenno Rice * Copyright (C) 1995, 1996 TooLs GmbH. 4fb75554eSBenno Rice * All rights reserved. 5fb75554eSBenno Rice * 6fb75554eSBenno Rice * Redistribution and use in source and binary forms, with or without 7fb75554eSBenno Rice * modification, are permitted provided that the following conditions 8fb75554eSBenno Rice * are met: 9fb75554eSBenno Rice * 1. Redistributions of source code must retain the above copyright 10fb75554eSBenno Rice * notice, this list of conditions and the following disclaimer. 11fb75554eSBenno Rice * 2. Redistributions in binary form must reproduce the above copyright 12fb75554eSBenno Rice * notice, this list of conditions and the following disclaimer in the 13fb75554eSBenno Rice * documentation and/or other materials provided with the distribution. 14fb75554eSBenno Rice * 3. All advertising materials mentioning features or use of this software 15fb75554eSBenno Rice * must display the following acknowledgement: 16fb75554eSBenno Rice * This product includes software developed by TooLs GmbH. 17fb75554eSBenno Rice * 4. The name of TooLs GmbH may not be used to endorse or promote products 18fb75554eSBenno Rice * derived from this software without specific prior written permission. 19fb75554eSBenno Rice * 20fb75554eSBenno Rice * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 21fb75554eSBenno Rice * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22fb75554eSBenno Rice * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23fb75554eSBenno Rice * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24fb75554eSBenno Rice * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25fb75554eSBenno Rice * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26fb75554eSBenno Rice * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27fb75554eSBenno Rice * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28fb75554eSBenno Rice * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29fb75554eSBenno Rice * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30dfeade78SDavid E. O'Brien * 31dfeade78SDavid E. O'Brien * $NetBSD: frame.h,v 1.2 1999/01/10 10:13:15 tsubai Exp $ 32dfeade78SDavid E. O'Brien * $FreeBSD$ 33fb75554eSBenno Rice */ 34dfeade78SDavid E. O'Brien 35fb75554eSBenno Rice #ifndef _MACHINE_FRAME_H_ 36fb75554eSBenno Rice #define _MACHINE_FRAME_H_ 37fb75554eSBenno Rice 38a379a142SPeter Grehan #include <sys/types.h> 39fb75554eSBenno Rice 40fb75554eSBenno Rice /* 41fb75554eSBenno Rice * We have to save all registers on every trap, because 42fb75554eSBenno Rice * 1. user could attach this process every time 43fb75554eSBenno Rice * 2. we must be able to restore all user registers in case of fork 44fb75554eSBenno Rice * Actually, we do not save the fp registers on trap, since 45fb75554eSBenno Rice * these are not used by the kernel. They are saved only when switching 46fb75554eSBenno Rice * between processes using the FPU. 47fb75554eSBenno Rice * 48fb75554eSBenno Rice * Change ordering to cluster together these register_t's. XXX 49fb75554eSBenno Rice */ 50fb75554eSBenno Rice struct trapframe { 51fb75554eSBenno Rice register_t fixreg[32]; 52fb75554eSBenno Rice register_t lr; 53fb75554eSBenno Rice int cr; 54fb75554eSBenno Rice int xer; 55fb75554eSBenno Rice register_t ctr; 56fb75554eSBenno Rice register_t srr0; 57fb75554eSBenno Rice register_t srr1; 58fb75554eSBenno Rice int exc; 59786e4a1bSRafal Jaworowski union { 60786e4a1bSRafal Jaworowski struct { 61786e4a1bSRafal Jaworowski /* dar & dsisr are only filled on a DSI trap */ 62786e4a1bSRafal Jaworowski register_t dar; 63786e4a1bSRafal Jaworowski int dsisr; 64786e4a1bSRafal Jaworowski } aim; 65786e4a1bSRafal Jaworowski struct { 66786e4a1bSRafal Jaworowski register_t dear; 67786e4a1bSRafal Jaworowski register_t esr; 680a35b40fSRafal Jaworowski register_t dbcr0; 69786e4a1bSRafal Jaworowski } booke; 70786e4a1bSRafal Jaworowski } cpu; 71fb75554eSBenno Rice }; 72786e4a1bSRafal Jaworowski 73fb75554eSBenno Rice /* 74fb75554eSBenno Rice * This is to ensure alignment of the stackpointer 75fb75554eSBenno Rice */ 76fb75554eSBenno Rice #define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16) 775fd2c51eSMark Peek #define trapframe(td) ((td)->td_frame) 78fb75554eSBenno Rice 79fb75554eSBenno Rice /* 80fb75554eSBenno Rice * Call frame for PowerPC used during fork. 81fb75554eSBenno Rice */ 82fb75554eSBenno Rice struct callframe { 83bddfaa89SPeter Grehan register_t cf_dummy_fp; /* dummy frame pointer */ 84bddfaa89SPeter Grehan register_t cf_lr; /* space for link register save */ 854eed0cf1SBenno Rice register_t cf_func; 864eed0cf1SBenno Rice register_t cf_arg0; 874eed0cf1SBenno Rice register_t cf_arg1; 88fb75554eSBenno Rice }; 89fb75554eSBenno Rice 9060ead00eSBenno Rice /* Definitions for syscalls */ 9160ead00eSBenno Rice #define FIRSTARG 3 /* first arg in reg 3 */ 9260ead00eSBenno Rice #define NARGREG 8 /* 8 args in regs */ 9360ead00eSBenno Rice #define MOREARGS(sp) ((caddr_t)((int)(sp) + 8)) /* more args go here */ 9460ead00eSBenno Rice 95fb75554eSBenno Rice #endif /* _MACHINE_FRAME_H_ */ 96