1 /* 2 * Copyright (c) 2009 Corey Tabaka 3 * Copyright (c) 2015-2018 Intel Corporation 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files 7 * (the "Software"), to deal in the Software without restriction, 8 * including without limitation the rights to use, copy, modify, merge, 9 * publish, distribute, sublicense, and/or sell copies of the Software, 10 * and to permit persons to whom the Software is furnished to do so, 11 * subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be 14 * included in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 #pragma once 25 26 #include <sys/types.h> 27 28 #define IF_MASK 0x0200 29 #define DF_MASK 0x0400 30 #define IOPL_MASK 0x3000 31 #define RSVD 0x0002 32 33 /* 0x3202 */ 34 #define USER_EFLAGS (IF_MASK|IOPL_MASK|RSVD) 35 36 /* SYSCALL Handling */ 37 #define SYSENTER_CS_MSR 0x174 38 #define SYSENTER_ESP_MSR 0x175 39 #define SYSENTER_EIP_MSR 0x176 40 41 #define STAR_MSR (0xC0000081) 42 #define LSTAR_MSR (0xC0000082) 43 #define CSTAR_MSR (0xC0000083) 44 #define SFMASK_MSR (0xC0000084) 45 46 struct arch_thread { 47 vaddr_t sp; 48 vaddr_t fs_base; 49 #if X86_WITH_FPU 50 vaddr_t *fpu_states; 51 uint8_t fpu_buffer[512 + 16]; 52 #endif 53 }; 54 55