frame.h revision 189100
1139825Simp/*- 268549Sbenno * Copyright (C) 1995, 1996 Wolfgang Solfrank. 368549Sbenno * Copyright (C) 1995, 1996 TooLs GmbH. 468549Sbenno * All rights reserved. 568549Sbenno * 668549Sbenno * Redistribution and use in source and binary forms, with or without 768549Sbenno * modification, are permitted provided that the following conditions 868549Sbenno * are met: 968549Sbenno * 1. Redistributions of source code must retain the above copyright 1068549Sbenno * notice, this list of conditions and the following disclaimer. 1168549Sbenno * 2. Redistributions in binary form must reproduce the above copyright 1268549Sbenno * notice, this list of conditions and the following disclaimer in the 1368549Sbenno * documentation and/or other materials provided with the distribution. 1468549Sbenno * 3. All advertising materials mentioning features or use of this software 1568549Sbenno * must display the following acknowledgement: 1668549Sbenno * This product includes software developed by TooLs GmbH. 1768549Sbenno * 4. The name of TooLs GmbH may not be used to endorse or promote products 1868549Sbenno * derived from this software without specific prior written permission. 1968549Sbenno * 2068549Sbenno * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 2168549Sbenno * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2268549Sbenno * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2368549Sbenno * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2468549Sbenno * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2568549Sbenno * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2668549Sbenno * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2768549Sbenno * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2868549Sbenno * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 2968549Sbenno * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3070585Sobrien * 3177944Sobrien * $NetBSD: frame.h,v 1.2 1999/01/10 10:13:15 tsubai Exp $ 3270585Sobrien * $FreeBSD: head/sys/powerpc/include/frame.h 189100 2009-02-27 12:08:24Z raj $ 3368549Sbenno */ 3470585Sobrien 3568549Sbenno#ifndef _MACHINE_FRAME_H_ 3668549Sbenno#define _MACHINE_FRAME_H_ 3768549Sbenno 38103614Sgrehan#include <sys/types.h> 3968549Sbenno 4068549Sbenno/* 4168549Sbenno * We have to save all registers on every trap, because 4268549Sbenno * 1. user could attach this process every time 4368549Sbenno * 2. we must be able to restore all user registers in case of fork 4468549Sbenno * Actually, we do not save the fp registers on trap, since 4568549Sbenno * these are not used by the kernel. They are saved only when switching 4668549Sbenno * between processes using the FPU. 4768549Sbenno * 4868549Sbenno * Change ordering to cluster together these register_t's. XXX 4968549Sbenno */ 5068549Sbennostruct trapframe { 5168549Sbenno register_t fixreg[32]; 5268549Sbenno register_t lr; 53176742Sraj int cr; 54176742Sraj int xer; 5568549Sbenno register_t ctr; 5668549Sbenno register_t srr0; 5768549Sbenno register_t srr1; 58176742Sraj int exc; 59176742Sraj union { 60176742Sraj struct { 61176742Sraj /* dar & dsisr are only filled on a DSI trap */ 62176742Sraj register_t dar; 63176742Sraj int dsisr; 64176742Sraj } aim; 65176742Sraj struct { 66176742Sraj register_t dear; 67176742Sraj register_t esr; 68189100Sraj register_t dbcr0; 69176742Sraj } booke; 70176742Sraj } cpu; 7168549Sbenno}; 72176742Sraj 7368549Sbenno/* 7468549Sbenno * This is to ensure alignment of the stackpointer 7568549Sbenno */ 7668549Sbenno#define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16) 7783682Smp#define trapframe(td) ((td)->td_frame) 7868549Sbenno 7968549Sbenno/* 8068549Sbenno * Call frame for PowerPC used during fork. 8168549Sbenno */ 8268549Sbennostruct callframe { 83132520Sgrehan register_t cf_dummy_fp; /* dummy frame pointer */ 84132520Sgrehan register_t cf_lr; /* space for link register save */ 8591467Sbenno register_t cf_func; 8691467Sbenno register_t cf_arg0; 8791467Sbenno register_t cf_arg1; 8868549Sbenno}; 8968549Sbenno 9097397Sbenno/* Definitions for syscalls */ 9197397Sbenno#define FIRSTARG 3 /* first arg in reg 3 */ 9297397Sbenno#define NARGREG 8 /* 8 args in regs */ 9397397Sbenno#define MOREARGS(sp) ((caddr_t)((int)(sp) + 8)) /* more args go here */ 9497397Sbenno 9568549Sbenno#endif /* _MACHINE_FRAME_H_ */ 96