14Srgrimes/*- 2122296Speter * Copyright (c) 2003 Peter Wemm. 34Srgrimes * Copyright (c) 1990 The Regents of the University of California. 44Srgrimes * All rights reserved. 54Srgrimes * 64Srgrimes * This code is derived from software contributed to Berkeley by 74Srgrimes * William Jolitz. 84Srgrimes * 94Srgrimes * Redistribution and use in source and binary forms, with or without 104Srgrimes * modification, are permitted provided that the following conditions 114Srgrimes * are met: 124Srgrimes * 1. Redistributions of source code must retain the above copyright 134Srgrimes * notice, this list of conditions and the following disclaimer. 144Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 154Srgrimes * notice, this list of conditions and the following disclaimer in the 164Srgrimes * documentation and/or other materials provided with the distribution. 174Srgrimes * 4. Neither the name of the University nor the names of its contributors 184Srgrimes * may be used to endorse or promote products derived from this software 194Srgrimes * without specific prior written permission. 204Srgrimes * 214Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 224Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 234Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 244Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 254Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 264Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 274Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 284Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 294Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 304Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 314Srgrimes * SUCH DAMAGE. 324Srgrimes * 33557Srgrimes * from: @(#)frame.h 5.2 (Berkeley) 1/18/91 3450477Speter * $FreeBSD$ 354Srgrimes */ 364Srgrimes 37719Swollman#ifndef _MACHINE_FRAME_H_ 38719Swollman#define _MACHINE_FRAME_H_ 1 39719Swollman 404Srgrimes/* 414Srgrimes * System stack frames. 424Srgrimes */ 434Srgrimes 44247047Skib#ifdef __i386__ 454Srgrimes/* 464Srgrimes * Exception/Trap Stack Frame 47247047Skib */ 48247047Skib 49247047Skibstruct trapframe { 50247047Skib int tf_fs; 51247047Skib int tf_es; 52247047Skib int tf_ds; 53247047Skib int tf_edi; 54247047Skib int tf_esi; 55247047Skib int tf_ebp; 56247047Skib int tf_isp; 57247047Skib int tf_ebx; 58247047Skib int tf_edx; 59247047Skib int tf_ecx; 60247047Skib int tf_eax; 61247047Skib int tf_trapno; 62247047Skib /* below portion defined in 386 hardware */ 63247047Skib int tf_err; 64247047Skib int tf_eip; 65247047Skib int tf_cs; 66247047Skib int tf_eflags; 67247047Skib /* below only when crossing rings (e.g. user to kernel) */ 68247047Skib int tf_esp; 69247047Skib int tf_ss; 70247047Skib}; 71247047Skib 72247047Skib/* Superset of trap frame, for traps from virtual-8086 mode */ 73247047Skib 74247047Skibstruct trapframe_vm86 { 75247047Skib int tf_fs; 76247047Skib int tf_es; 77247047Skib int tf_ds; 78247047Skib int tf_edi; 79247047Skib int tf_esi; 80247047Skib int tf_ebp; 81247047Skib int tf_isp; 82247047Skib int tf_ebx; 83247047Skib int tf_edx; 84247047Skib int tf_ecx; 85247047Skib int tf_eax; 86247047Skib int tf_trapno; 87247047Skib /* below portion defined in 386 hardware */ 88247047Skib int tf_err; 89247047Skib int tf_eip; 90247047Skib int tf_cs; 91247047Skib int tf_eflags; 92247047Skib /* below only when crossing rings (e.g. user to kernel) */ 93247047Skib int tf_esp; 94247047Skib int tf_ss; 95247047Skib /* below only when switching out of VM86 mode */ 96247047Skib int tf_vm86_es; 97247047Skib int tf_vm86_ds; 98247047Skib int tf_vm86_fs; 99247047Skib int tf_vm86_gs; 100247047Skib}; 101247047Skib#endif /* __i386__ */ 102247047Skib 103247047Skib#ifdef __amd64__ 104247047Skib/* 105247047Skib * Exception/Trap Stack Frame 106114349Speter * 107114349Speter * The ordering of this is specifically so that we can take first 6 108114349Speter * the syscall arguments directly from the beginning of the frame. 1094Srgrimes */ 1104Srgrimes 1114Srgrimesstruct trapframe { 112114349Speter register_t tf_rdi; 113114349Speter register_t tf_rsi; 114114349Speter register_t tf_rdx; 115114349Speter register_t tf_rcx; 116114349Speter register_t tf_r8; 117114349Speter register_t tf_r9; 118114349Speter register_t tf_rax; 119114349Speter register_t tf_rbx; 120114349Speter register_t tf_rbp; 121114349Speter register_t tf_r10; 122114349Speter register_t tf_r11; 123114349Speter register_t tf_r12; 124114349Speter register_t tf_r13; 125114349Speter register_t tf_r14; 126114349Speter register_t tf_r15; 127190620Skib uint32_t tf_trapno; 128190620Skib uint16_t tf_fs; 129190620Skib uint16_t tf_gs; 130114952Speter register_t tf_addr; 131190620Skib uint32_t tf_flags; 132190620Skib uint16_t tf_es; 133190620Skib uint16_t tf_ds; 134114349Speter /* below portion defined in hardware */ 135114349Speter register_t tf_err; 136114349Speter register_t tf_rip; 137114349Speter register_t tf_cs; 138114349Speter register_t tf_rflags; 139114349Speter register_t tf_rsp; 140114349Speter register_t tf_ss; 1414Srgrimes}; 1424Srgrimes 143190620Skib#define TF_HASSEGS 0x1 144230426Skib#define TF_HASBASES 0x2 145230426Skib#define TF_HASFPXSTATE 0x4 146247047Skib#endif /* __amd64__ */ 147190620Skib 148719Swollman#endif /* _MACHINE_FRAME_H_ */ 149