/*-1* SPDX-License-Identifier: BSD-4-Clause2*3* Copyright (C) 1995, 1996 Wolfgang Solfrank.4* Copyright (C) 1995, 1996 TooLs GmbH.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15* 3. All advertising materials mentioning features or use of this software16* must display the following acknowledgement:17* This product includes software developed by TooLs GmbH.18* 4. The name of TooLs GmbH may not be used to endorse or promote products19* derived from this software without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR22* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES23* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.24* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,25* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,26* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;27* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,28* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR29* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF30* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31*32* $NetBSD: frame.h,v 1.2 1999/01/10 10:13:15 tsubai Exp $33*/3435#ifndef _MACHINE_FRAME_H_36#define _MACHINE_FRAME_H_3738#include <sys/types.h>3940/*41* We have to save all registers on every trap, because42* 1. user could attach this process every time43* 2. we must be able to restore all user registers in case of fork44* Actually, we do not save the fp registers on trap, since45* these are not used by the kernel. They are saved only when switching46* between processes using the FPU.47*48* Change ordering to cluster together these register_t's. XXX49*/50struct trapframe {51register_t fixreg[32];52register_t lr;53register_t cr;54register_t xer;55register_t ctr;56register_t srr0;57register_t srr1;58register_t exc;59register_t dar; /* DAR/DEAR filled in on DSI traps */60union {61struct {62/* dsisr only filled on a DSI trap */63register_t dsisr;64} aim;65struct {66register_t esr;67register_t dbcr0;68} booke;69} cpu;70};7172/*73* FRAMELEN is the size of the stack region used by the low-level trap74* handler. It is the size of its data (trapframe) plus the callframe75* header (sizeof(struct callframe) - 3 register widths). It must also76* be 16-byte aligned.77*/78#define FRAMELEN roundup(sizeof(struct trapframe) + \79sizeof(struct callframe) - 3*sizeof(register_t), 16)80#define trapframe(td) ((td)->td_frame)8182/*83* Call frame for PowerPC used during fork.84*/85#ifdef __powerpc64__86struct callframe {87register_t cf_dummy_fp; /* dummy frame pointer */88register_t cf_cr;89register_t cf_lr;90register_t cf_compiler;91register_t cf_linkeditor;92register_t cf_toc;93register_t cf_func;94register_t cf_arg0;95register_t cf_arg1;96register_t _padding; /* Maintain 16-byte alignment */97};98#else99struct callframe {100register_t cf_dummy_fp; /* dummy frame pointer */101register_t cf_lr; /* space for link register save */102register_t cf_func;103register_t cf_arg0;104register_t cf_arg1;105register_t _padding; /* Maintain 16-byte alignment */106};107#endif108109/* Definitions for syscalls */110#define FIRSTARG 3 /* first arg in reg 3 */111#define NARGREG 8 /* 8 args in regs */112113#endif /* _MACHINE_FRAME_H_ */114115116