ucontext.h revision e61d106008f7d77fa1c0de43ac27311320225135
1e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin/* 2e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * Copyright (C) 2014 The Android Open Source Project 3e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * All rights reserved. 4e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * 5e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * Redistribution and use in source and binary forms, with or without 6e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * modification, are permitted provided that the following conditions 7e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * are met: 8e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * * Redistributions of source code must retain the above copyright 9e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * notice, this list of conditions and the following disclaimer. 10e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * * Redistributions in binary form must reproduce the above copyright 11e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * notice, this list of conditions and the following disclaimer in 12e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * the documentation and/or other materials provided with the 13e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * distribution. 14e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * 15e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin * SUCH DAMAGE. 27e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin */ 28e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 29e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#ifndef _SYS_UCONTEXT_H_ 30e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#define _SYS_UCONTEXT_H_ 31e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 32e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#include <signal.h> 33e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#include <sys/user.h> 34e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 35e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin__BEGIN_DECLS 36e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 37e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#if defined(__x86_64__) 38e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 39e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupinenum { 40e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R8 = 0, 41e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R9, 42e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R10, 43e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R11, 44e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R12, 45e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R13, 46e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R14, 47e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_R15, 48e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RDI, 49e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RSI, 50e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RBP, 51e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RBX, 52e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RDX, 53e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RAX, 54e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RCX, 55e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RSP, 56e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_RIP, 57e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_EFL, 58e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_CSGSFS, 59e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_ERR, 60e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_TRAPNO, 61e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_OLDMASK, 62e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin REG_CR2, 63e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin NGREG 64e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin}; 65e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 66e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupintypedef long greg_t; 67e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupintypedef greg_t gregset_t[NGREG]; 68e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 69e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupintypedef struct user_i387_struct* fpregset_t; 70e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 71e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupintypedef struct { 72e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin gregset_t gregs; 73e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin fpregset_t fpregs; 74e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin /* TODO: reserved space? */ 75e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin} mcontext_t; 76e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 77e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupintypedef struct ucontext { 78e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin unsigned long uc_flags; 79e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin struct ucontext* uc_link; 80e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin stack_t uc_stack; 81e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin mcontext_t uc_mcontext; 82e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin sigset_t uc_sigmask; 83e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin /* TODO: __fpregs_mem? */ 84e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin} ucontext_t; 85e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 86e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#endif /* x86_64 */ 87e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 88e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin__END_DECLS 89e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin 90e61d106008f7d77fa1c0de43ac27311320225135Pavel Chupin#endif /* _SYS_UCONTEXT_H_ */ 91