1/* 2 * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _ARCH_X86_64_SIGNAL_H_ 6#define _ARCH_X86_64_SIGNAL_H_ 7 8 9/* 10 * Architecture-specific structure passed to signal handlers 11 */ 12 13 14struct x86_64_fp_register { 15 unsigned char value[10]; 16 unsigned char reserved[6]; 17}; 18 19 20struct x86_64_xmm_register { 21 unsigned char value[16]; 22}; 23 24 25// The layout of this struct matches the one used by the FXSAVE instruction 26struct fpu_state { 27 unsigned short control; 28 unsigned short status; 29 unsigned short tag; 30 unsigned short opcode; 31 unsigned long rip; 32 unsigned long rdp; 33 unsigned int mxcsr; 34 unsigned int mscsr_mask; 35 36 union { 37 struct x86_64_fp_register fp[8]; 38 struct x86_64_fp_register mmx[8]; 39 }; 40 41 struct x86_64_xmm_register xmm[16]; 42 unsigned char _reserved_416_511[96]; 43}; 44 45 46struct xstate_hdr { 47 unsigned long bv; 48 unsigned long xcomp_bv; 49 unsigned char _reserved[48]; 50}; 51 52 53// The layout of this struct matches the one used by the FXSAVE instruction on 54// an AVX CPU 55struct savefpu { 56 struct fpu_state fp_fxsave; 57 struct xstate_hdr fp_xstate; 58 struct x86_64_xmm_register fp_ymm[16]; 59 // The high half of the YMM registers, to combine with the low half 60 // found in fp_fxsave.xmm 61}; 62 63 64#ifdef __x86_64__ 65 66 67struct vregs { 68 unsigned long rax; 69 unsigned long rbx; 70 unsigned long rcx; 71 unsigned long rdx; 72 unsigned long rdi; 73 unsigned long rsi; 74 unsigned long rbp; 75 unsigned long r8; 76 unsigned long r9; 77 unsigned long r10; 78 unsigned long r11; 79 unsigned long r12; 80 unsigned long r13; 81 unsigned long r14; 82 unsigned long r15; 83 84 unsigned long rsp; 85 unsigned long rip; 86 unsigned long rflags; 87 88 struct savefpu fpu; 89}; 90 91 92#endif 93 94 95#endif /* _ARCH_X86_64_SIGNAL_H_ */ 96