Convert machine/elf.h, machine/frame.h, machine/sigframe.h,
machine/signal.h and machine/ucontext.h into common x86 includes, copying from amd64 and merging with i386. Kernel-only compat definitions are kept in the i386/include/sigframe.h and i386/include/signal.h, to reduce amd64 kernel namespace pollution. The amd64 compat uses its own definitions so far. The _MACHINE_ELF_WANT_32BIT definition is to allow the sys/boot/userboot/userboot/elf32_freebsd.c to use i386 ELF definitions on the amd64 compile host. The same hack could be usefully abused by other code too.
This commit is contained in:
parent
5c9f7b1a91
commit
31a53cd036
@ -1,124 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 1996-1997 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_ELF_H_
|
||||
#define _MACHINE_ELF_H_ 1
|
||||
|
||||
/*
|
||||
* ELF definitions for the AMD64 architecture.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __ELF_WORD_SIZE
|
||||
#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */
|
||||
#endif
|
||||
#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
|
||||
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
|
||||
#include <sys/elf_generic.h>
|
||||
|
||||
#define ELF_ARCH EM_X86_64
|
||||
#define ELF_ARCH32 EM_386
|
||||
|
||||
#define ELF_MACHINE_OK(x) ((x) == EM_X86_64)
|
||||
|
||||
/*
|
||||
* Auxiliary vector entries for passing information to the interpreter.
|
||||
*
|
||||
* The i386 supplement to the SVR4 ABI specification names this "auxv_t",
|
||||
* but POSIX lays claim to all symbols ending with "_t".
|
||||
*/
|
||||
typedef struct { /* Auxiliary vector entry on initial stack */
|
||||
int a_type; /* Entry type. */
|
||||
union {
|
||||
int a_val; /* Integer value. */
|
||||
} a_un;
|
||||
} Elf32_Auxinfo;
|
||||
|
||||
|
||||
typedef struct { /* Auxiliary vector entry on initial stack */
|
||||
long a_type; /* Entry type. */
|
||||
union {
|
||||
long a_val; /* Integer value. */
|
||||
void *a_ptr; /* Address. */
|
||||
void (*a_fcn)(void); /* Function pointer (not used). */
|
||||
} a_un;
|
||||
} Elf64_Auxinfo;
|
||||
|
||||
__ElfType(Auxinfo);
|
||||
|
||||
/* Values for a_type. */
|
||||
#define AT_NULL 0 /* Terminates the vector. */
|
||||
#define AT_IGNORE 1 /* Ignored entry. */
|
||||
#define AT_EXECFD 2 /* File descriptor of program to load. */
|
||||
#define AT_PHDR 3 /* Program header of program already loaded. */
|
||||
#define AT_PHENT 4 /* Size of each program header entry. */
|
||||
#define AT_PHNUM 5 /* Number of program header entries. */
|
||||
#define AT_PAGESZ 6 /* Page size in bytes. */
|
||||
#define AT_BASE 7 /* Interpreter's base address. */
|
||||
#define AT_FLAGS 8 /* Flags (unused for i386). */
|
||||
#define AT_ENTRY 9 /* Where interpreter should transfer control. */
|
||||
#define AT_NOTELF 10 /* Program is not ELF ?? */
|
||||
#define AT_UID 11 /* Real uid. */
|
||||
#define AT_EUID 12 /* Effective uid. */
|
||||
#define AT_GID 13 /* Real gid. */
|
||||
#define AT_EGID 14 /* Effective gid. */
|
||||
#define AT_EXECPATH 15 /* Path to the executable. */
|
||||
#define AT_CANARY 16 /* Canary for SSP */
|
||||
#define AT_CANARYLEN 17 /* Length of the canary. */
|
||||
#define AT_OSRELDATE 18 /* OSRELDATE. */
|
||||
#define AT_NCPUS 19 /* Number of CPUs. */
|
||||
#define AT_PAGESIZES 20 /* Pagesizes. */
|
||||
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
|
||||
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
|
||||
#define AT_STACKPROT 23 /* Initial stack protection. */
|
||||
|
||||
#define AT_COUNT 24 /* Count of defined aux entry types. */
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
*/
|
||||
|
||||
#define R_X86_64_COUNT 24 /* Count of defined relocation types. */
|
||||
|
||||
/* Define "machine" characteristics */
|
||||
#if __ELF_WORD_SIZE == 32
|
||||
#define ELF_TARG_CLASS ELFCLASS32
|
||||
#else
|
||||
#define ELF_TARG_CLASS ELFCLASS64
|
||||
#endif
|
||||
#define ELF_TARG_DATA ELFDATA2LSB
|
||||
#define ELF_TARG_MACH EM_X86_64
|
||||
#define ELF_TARG_VER 1
|
||||
|
||||
#if __ELF_WORD_SIZE == 32
|
||||
#define ET_DYN_LOAD_ADDR 0x01001000
|
||||
#else
|
||||
#define ET_DYN_LOAD_ADDR 0x01021000
|
||||
#endif
|
||||
|
||||
#endif /* !_MACHINE_ELF_H_ */
|
||||
#include <x86/elf.h>
|
||||
|
@ -1,87 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2003 Peter Wemm.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)frame.h 5.2 (Berkeley) 1/18/91
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_FRAME_H_
|
||||
#define _MACHINE_FRAME_H_ 1
|
||||
|
||||
/*
|
||||
* System stack frames.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Exception/Trap Stack Frame
|
||||
*
|
||||
* The ordering of this is specifically so that we can take first 6
|
||||
* the syscall arguments directly from the beginning of the frame.
|
||||
*/
|
||||
|
||||
struct trapframe {
|
||||
register_t tf_rdi;
|
||||
register_t tf_rsi;
|
||||
register_t tf_rdx;
|
||||
register_t tf_rcx;
|
||||
register_t tf_r8;
|
||||
register_t tf_r9;
|
||||
register_t tf_rax;
|
||||
register_t tf_rbx;
|
||||
register_t tf_rbp;
|
||||
register_t tf_r10;
|
||||
register_t tf_r11;
|
||||
register_t tf_r12;
|
||||
register_t tf_r13;
|
||||
register_t tf_r14;
|
||||
register_t tf_r15;
|
||||
uint32_t tf_trapno;
|
||||
uint16_t tf_fs;
|
||||
uint16_t tf_gs;
|
||||
register_t tf_addr;
|
||||
uint32_t tf_flags;
|
||||
uint16_t tf_es;
|
||||
uint16_t tf_ds;
|
||||
/* below portion defined in hardware */
|
||||
register_t tf_err;
|
||||
register_t tf_rip;
|
||||
register_t tf_cs;
|
||||
register_t tf_rflags;
|
||||
register_t tf_rsp;
|
||||
register_t tf_ss;
|
||||
};
|
||||
|
||||
#define TF_HASSEGS 0x1
|
||||
#define TF_HASBASES 0x2
|
||||
#define TF_HASFPXSTATE 0x4
|
||||
|
||||
#endif /* _MACHINE_FRAME_H_ */
|
||||
#include <x86/frame.h>
|
||||
|
@ -1,46 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Marcel Moolenaar
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer
|
||||
* in this position and unchanged.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_SIGFRAME_H_
|
||||
#define _MACHINE_SIGFRAME_H_
|
||||
|
||||
/*
|
||||
* Signal frames, arguments passed to application signal handlers.
|
||||
*/
|
||||
struct sigframe {
|
||||
union {
|
||||
__siginfohandler_t *sf_action;
|
||||
__sighandler_t *sf_handler;
|
||||
} sf_ahu;
|
||||
ucontext_t sf_uc; /* = *sf_ucontext */
|
||||
siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
|
||||
};
|
||||
|
||||
#endif /* !_MACHINE_SIGFRAME_H_ */
|
||||
#include <x86/sigframe.h>
|
||||
|
@ -1,109 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2003 Peter Wemm.
|
||||
* Copyright (c) 1986, 1989, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)signal.h 8.1 (Berkeley) 6/11/93
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_SIGNAL_H_
|
||||
#define _MACHINE_SIGNAL_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_sigset.h>
|
||||
|
||||
/*
|
||||
* Machine-dependent signal definitions
|
||||
*/
|
||||
|
||||
typedef long sig_atomic_t;
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
|
||||
|
||||
/*
|
||||
* Information pushed on stack when a signal is delivered.
|
||||
* This is used by the kernel to restore state following
|
||||
* execution of the signal handler. It is also made available
|
||||
* to the handler to allow it to restore state properly if
|
||||
* a non-standard exit is performed.
|
||||
*
|
||||
* The sequence of the fields/registers after sc_mask in struct
|
||||
* sigcontext must match those in mcontext_t and struct trapframe.
|
||||
*/
|
||||
struct sigcontext {
|
||||
struct __sigset sc_mask; /* signal mask to restore */
|
||||
long sc_onstack; /* sigstack state to restore */
|
||||
long sc_rdi; /* machine state (struct trapframe) */
|
||||
long sc_rsi;
|
||||
long sc_rdx;
|
||||
long sc_rcx;
|
||||
long sc_r8;
|
||||
long sc_r9;
|
||||
long sc_rax;
|
||||
long sc_rbx;
|
||||
long sc_rbp;
|
||||
long sc_r10;
|
||||
long sc_r11;
|
||||
long sc_r12;
|
||||
long sc_r13;
|
||||
long sc_r14;
|
||||
long sc_r15;
|
||||
int sc_trapno;
|
||||
short sc_fs;
|
||||
short sc_gs;
|
||||
long sc_addr;
|
||||
int sc_flags;
|
||||
short sc_es;
|
||||
short sc_ds;
|
||||
long sc_err;
|
||||
long sc_rip;
|
||||
long sc_cs;
|
||||
long sc_rflags;
|
||||
long sc_rsp;
|
||||
long sc_ss;
|
||||
long sc_len; /* sizeof(mcontext_t) */
|
||||
/*
|
||||
* See <machine/ucontext.h> and <machine/fpu.h> for the following
|
||||
* fields.
|
||||
*/
|
||||
long sc_fpformat;
|
||||
long sc_ownedfp;
|
||||
long sc_fpstate[64] __aligned(16);
|
||||
|
||||
long sc_fsbase;
|
||||
long sc_gsbase;
|
||||
|
||||
long sc_xfpustate;
|
||||
long sc_xfpustate_len;
|
||||
|
||||
long sc_spare[4];
|
||||
};
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
#endif /* !_MACHINE_SIGNAL_H_ */
|
||||
#include <x86/signal.h>
|
||||
|
@ -1,103 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2003 Peter Wemm
|
||||
* Copyright (c) 1999 Marcel Moolenaar
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer
|
||||
* in this position and unchanged.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_UCONTEXT_H_
|
||||
#define _MACHINE_UCONTEXT_H_
|
||||
|
||||
/*
|
||||
* mc_trapno bits. Shall be in sync with TF_XXX.
|
||||
*/
|
||||
#define _MC_HASSEGS 0x1
|
||||
#define _MC_HASBASES 0x2
|
||||
#define _MC_HASFPXSTATE 0x4
|
||||
#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE)
|
||||
|
||||
typedef struct __mcontext {
|
||||
/*
|
||||
* The definition of mcontext_t must match the layout of
|
||||
* struct sigcontext after the sc_mask member. This is so
|
||||
* that we can support sigcontext and ucontext_t at the same
|
||||
* time.
|
||||
*/
|
||||
__register_t mc_onstack; /* XXX - sigcontext compat. */
|
||||
__register_t mc_rdi; /* machine state (struct trapframe) */
|
||||
__register_t mc_rsi;
|
||||
__register_t mc_rdx;
|
||||
__register_t mc_rcx;
|
||||
__register_t mc_r8;
|
||||
__register_t mc_r9;
|
||||
__register_t mc_rax;
|
||||
__register_t mc_rbx;
|
||||
__register_t mc_rbp;
|
||||
__register_t mc_r10;
|
||||
__register_t mc_r11;
|
||||
__register_t mc_r12;
|
||||
__register_t mc_r13;
|
||||
__register_t mc_r14;
|
||||
__register_t mc_r15;
|
||||
__uint32_t mc_trapno;
|
||||
__uint16_t mc_fs;
|
||||
__uint16_t mc_gs;
|
||||
__register_t mc_addr;
|
||||
__uint32_t mc_flags;
|
||||
__uint16_t mc_es;
|
||||
__uint16_t mc_ds;
|
||||
__register_t mc_err;
|
||||
__register_t mc_rip;
|
||||
__register_t mc_cs;
|
||||
__register_t mc_rflags;
|
||||
__register_t mc_rsp;
|
||||
__register_t mc_ss;
|
||||
|
||||
long mc_len; /* sizeof(mcontext_t) */
|
||||
|
||||
#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */
|
||||
#define _MC_FPFMT_XMM 0x10002
|
||||
long mc_fpformat;
|
||||
#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */
|
||||
#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */
|
||||
#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */
|
||||
long mc_ownedfp;
|
||||
/*
|
||||
* See <machine/fpu.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
long mc_fpstate[64] __aligned(16);
|
||||
|
||||
__register_t mc_fsbase;
|
||||
__register_t mc_gsbase;
|
||||
|
||||
__register_t mc_xfpustate;
|
||||
__register_t mc_xfpustate_len;
|
||||
|
||||
long mc_spare[4];
|
||||
} mcontext_t;
|
||||
|
||||
#endif /* !_MACHINE_UCONTEXT_H_ */
|
||||
#include <x86/ucontext.h>
|
||||
|
@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/exec.h>
|
||||
#include <sys/linker.h>
|
||||
#include <string.h>
|
||||
#define _MACHINE_ELF_WANT_32BIT
|
||||
#include <i386/include/bootinfo.h>
|
||||
#include <i386/include/elf.h>
|
||||
#include <stand.h>
|
||||
|
@ -1,118 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 1996-1997 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_ELF_H_
|
||||
#define _MACHINE_ELF_H_ 1
|
||||
|
||||
/*
|
||||
* ELF definitions for the i386 architecture.
|
||||
*/
|
||||
|
||||
#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
|
||||
#if defined(__ELF_WORD_SIZE) && __ELF_WORD_SIZE == 64
|
||||
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
|
||||
#endif
|
||||
|
||||
#ifndef __ELF_WORD_SIZE
|
||||
#define __ELF_WORD_SIZE 32 /* Used by <sys/elf_generic.h> */
|
||||
#endif
|
||||
|
||||
#include <sys/elf_generic.h>
|
||||
|
||||
#define ELF_ARCH EM_386
|
||||
|
||||
#define ELF_MACHINE_OK(x) ((x) == EM_386 || (x) == EM_486)
|
||||
|
||||
/*
|
||||
* Auxiliary vector entries for passing information to the interpreter.
|
||||
*
|
||||
* The i386 supplement to the SVR4 ABI specification names this "auxv_t",
|
||||
* but POSIX lays claim to all symbols ending with "_t".
|
||||
*/
|
||||
|
||||
typedef struct { /* Auxiliary vector entry on initial stack */
|
||||
int a_type; /* Entry type. */
|
||||
union {
|
||||
long a_val; /* Integer value. */
|
||||
void *a_ptr; /* Address. */
|
||||
void (*a_fcn)(void); /* Function pointer (not used). */
|
||||
} a_un;
|
||||
} Elf32_Auxinfo;
|
||||
|
||||
#if __ELF_WORD_SIZE == 64
|
||||
/* Fake for amd64 loader support */
|
||||
typedef struct {
|
||||
int fake;
|
||||
} Elf64_Auxinfo;
|
||||
#endif
|
||||
|
||||
__ElfType(Auxinfo);
|
||||
|
||||
/* Values for a_type. */
|
||||
#define AT_NULL 0 /* Terminates the vector. */
|
||||
#define AT_IGNORE 1 /* Ignored entry. */
|
||||
#define AT_EXECFD 2 /* File descriptor of program to load. */
|
||||
#define AT_PHDR 3 /* Program header of program already loaded. */
|
||||
#define AT_PHENT 4 /* Size of each program header entry. */
|
||||
#define AT_PHNUM 5 /* Number of program header entries. */
|
||||
#define AT_PAGESZ 6 /* Page size in bytes. */
|
||||
#define AT_BASE 7 /* Interpreter's base address. */
|
||||
#define AT_FLAGS 8 /* Flags (unused for i386). */
|
||||
#define AT_ENTRY 9 /* Where interpreter should transfer control. */
|
||||
#define AT_NOTELF 10 /* Program is not ELF ?? */
|
||||
#define AT_UID 11 /* Real uid. */
|
||||
#define AT_EUID 12 /* Effective uid. */
|
||||
#define AT_GID 13 /* Real gid. */
|
||||
#define AT_EGID 14 /* Effective gid. */
|
||||
#define AT_EXECPATH 15 /* Path to the executable. */
|
||||
#define AT_CANARY 16 /* Canary for SSP. */
|
||||
#define AT_CANARYLEN 17 /* Length of the canary. */
|
||||
#define AT_OSRELDATE 18 /* OSRELDATE. */
|
||||
#define AT_NCPUS 19 /* Number of CPUs. */
|
||||
#define AT_PAGESIZES 20 /* Pagesizes. */
|
||||
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
|
||||
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
|
||||
#define AT_STACKPROT 23 /* Initial stack protection. */
|
||||
|
||||
#define AT_COUNT 24 /* Count of defined aux entry types. */
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
*/
|
||||
|
||||
#define R_386_COUNT 38 /* Count of defined relocation types. */
|
||||
|
||||
/* Define "machine" characteristics */
|
||||
#define ELF_TARG_CLASS ELFCLASS32
|
||||
#define ELF_TARG_DATA ELFDATA2LSB
|
||||
#define ELF_TARG_MACH EM_386
|
||||
#define ELF_TARG_VER 1
|
||||
|
||||
#define ET_DYN_LOAD_ADDR 0x01001000
|
||||
|
||||
#endif /* !_MACHINE_ELF_H_ */
|
||||
#include <x86/elf.h>
|
||||
|
@ -1,100 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)frame.h 5.2 (Berkeley) 1/18/91
|
||||
* $FreeBSD$
|
||||
* This file is in the public domain.
|
||||
*/
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#ifndef _MACHINE_FRAME_H_
|
||||
#define _MACHINE_FRAME_H_ 1
|
||||
|
||||
/*
|
||||
* System stack frames.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Exception/Trap Stack Frame
|
||||
*/
|
||||
|
||||
struct trapframe {
|
||||
int tf_fs;
|
||||
int tf_es;
|
||||
int tf_ds;
|
||||
int tf_edi;
|
||||
int tf_esi;
|
||||
int tf_ebp;
|
||||
int tf_isp;
|
||||
int tf_ebx;
|
||||
int tf_edx;
|
||||
int tf_ecx;
|
||||
int tf_eax;
|
||||
int tf_trapno;
|
||||
/* below portion defined in 386 hardware */
|
||||
int tf_err;
|
||||
int tf_eip;
|
||||
int tf_cs;
|
||||
int tf_eflags;
|
||||
/* below only when crossing rings (e.g. user to kernel) */
|
||||
int tf_esp;
|
||||
int tf_ss;
|
||||
};
|
||||
|
||||
/* Superset of trap frame, for traps from virtual-8086 mode */
|
||||
|
||||
struct trapframe_vm86 {
|
||||
int tf_fs;
|
||||
int tf_es;
|
||||
int tf_ds;
|
||||
int tf_edi;
|
||||
int tf_esi;
|
||||
int tf_ebp;
|
||||
int tf_isp;
|
||||
int tf_ebx;
|
||||
int tf_edx;
|
||||
int tf_ecx;
|
||||
int tf_eax;
|
||||
int tf_trapno;
|
||||
/* below portion defined in 386 hardware */
|
||||
int tf_err;
|
||||
int tf_eip;
|
||||
int tf_cs;
|
||||
int tf_eflags;
|
||||
/* below only when crossing rings (e.g. user to kernel) */
|
||||
int tf_esp;
|
||||
int tf_ss;
|
||||
/* below only when switching out of VM86 mode */
|
||||
int tf_vm86_es;
|
||||
int tf_vm86_ds;
|
||||
int tf_vm86_fs;
|
||||
int tf_vm86_gs;
|
||||
};
|
||||
|
||||
#endif /* _MACHINE_FRAME_H_ */
|
||||
#include <x86/frame.h>
|
||||
|
@ -89,25 +89,6 @@ struct sigframe4 {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct sigframe {
|
||||
/*
|
||||
* The first four members may be used by applications.
|
||||
*
|
||||
* NOTE: The 4th argument is undocumented, ill commented
|
||||
* on and seems to be somewhat BSD "standard". Handlers
|
||||
* installed with sigvec may be using it.
|
||||
*/
|
||||
register_t sf_signum;
|
||||
register_t sf_siginfo; /* code or pointer to sf_si */
|
||||
register_t sf_ucontext; /* points to sf_uc */
|
||||
register_t sf_addr; /* undocumented 4th arg */
|
||||
|
||||
union {
|
||||
__siginfohandler_t *sf_action;
|
||||
__sighandler_t *sf_handler;
|
||||
} sf_ahu;
|
||||
ucontext_t sf_uc; /* = *sf_ucontext */
|
||||
siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
|
||||
};
|
||||
#include <x86/sigframe.h>
|
||||
|
||||
#endif /* !_MACHINE_SIGFRAME_H_ */
|
||||
|
@ -33,25 +33,7 @@
|
||||
#ifndef _MACHINE_SIGNAL_H_
|
||||
#define _MACHINE_SIGNAL_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_sigset.h>
|
||||
|
||||
/*
|
||||
* Machine-dependent signal definitions
|
||||
*/
|
||||
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
|
||||
|
||||
/*
|
||||
* Information pushed on stack when a signal is delivered.
|
||||
* This is used by the kernel to restore state following
|
||||
* execution of the signal handler. It is also made available
|
||||
* to the handler to allow it to restore state properly if
|
||||
* a non-standard exit is performed.
|
||||
*/
|
||||
#include <x86/signal.h>
|
||||
|
||||
#if defined(_KERNEL) && defined(COMPAT_43)
|
||||
/*
|
||||
@ -82,57 +64,4 @@ struct osigcontext {
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The sequence of the fields/registers in struct sigcontext should match
|
||||
* those in mcontext_t and struct trapframe.
|
||||
*/
|
||||
struct sigcontext {
|
||||
struct __sigset sc_mask; /* signal mask to restore */
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int sc_gs; /* machine state (struct trapframe) */
|
||||
int sc_fs;
|
||||
int sc_es;
|
||||
int sc_ds;
|
||||
int sc_edi;
|
||||
int sc_esi;
|
||||
int sc_ebp;
|
||||
int sc_isp;
|
||||
int sc_ebx;
|
||||
int sc_edx;
|
||||
int sc_ecx;
|
||||
int sc_eax;
|
||||
int sc_trapno;
|
||||
int sc_err;
|
||||
int sc_eip;
|
||||
int sc_cs;
|
||||
int sc_efl;
|
||||
int sc_esp;
|
||||
int sc_ss;
|
||||
int sc_len; /* sizeof(mcontext_t) */
|
||||
/*
|
||||
* See <machine/ucontext.h> and <machine/npx.h> for
|
||||
* the following fields.
|
||||
*/
|
||||
int sc_fpformat;
|
||||
int sc_ownedfp;
|
||||
int sc_flags;
|
||||
int sc_fpstate[128] __aligned(16);
|
||||
|
||||
int sc_fsbase;
|
||||
int sc_gsbase;
|
||||
|
||||
int sc_xfpustate;
|
||||
int sc_xfpustate_len;
|
||||
|
||||
int sc_spare2[4];
|
||||
};
|
||||
|
||||
#define sc_sp sc_esp
|
||||
#define sc_fp sc_ebp
|
||||
#define sc_pc sc_eip
|
||||
#define sc_ps sc_efl
|
||||
#define sc_eflags sc_efl
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
#endif /* !_MACHINE_SIGNAL_H_ */
|
||||
|
@ -31,64 +31,6 @@
|
||||
#ifndef _MACHINE_UCONTEXT_H_
|
||||
#define _MACHINE_UCONTEXT_H_
|
||||
|
||||
/* Keep _MC_* values similar to amd64 */
|
||||
#define _MC_HASSEGS 0x1
|
||||
#define _MC_HASBASES 0x2
|
||||
#define _MC_HASFPXSTATE 0x4
|
||||
#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE)
|
||||
|
||||
typedef struct __mcontext {
|
||||
/*
|
||||
* The definition of mcontext_t must match the layout of
|
||||
* struct sigcontext after the sc_mask member. This is so
|
||||
* that we can support sigcontext and ucontext_t at the same
|
||||
* time.
|
||||
*/
|
||||
__register_t mc_onstack; /* XXX - sigcontext compat. */
|
||||
__register_t mc_gs; /* machine state (struct trapframe) */
|
||||
__register_t mc_fs;
|
||||
__register_t mc_es;
|
||||
__register_t mc_ds;
|
||||
__register_t mc_edi;
|
||||
__register_t mc_esi;
|
||||
__register_t mc_ebp;
|
||||
__register_t mc_isp;
|
||||
__register_t mc_ebx;
|
||||
__register_t mc_edx;
|
||||
__register_t mc_ecx;
|
||||
__register_t mc_eax;
|
||||
__register_t mc_trapno;
|
||||
__register_t mc_err;
|
||||
__register_t mc_eip;
|
||||
__register_t mc_cs;
|
||||
__register_t mc_eflags;
|
||||
__register_t mc_esp;
|
||||
__register_t mc_ss;
|
||||
|
||||
int mc_len; /* sizeof(mcontext_t) */
|
||||
#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */
|
||||
#define _MC_FPFMT_387 0x10001
|
||||
#define _MC_FPFMT_XMM 0x10002
|
||||
int mc_fpformat;
|
||||
#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */
|
||||
#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */
|
||||
#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */
|
||||
int mc_ownedfp;
|
||||
__register_t mc_flags;
|
||||
/*
|
||||
* See <machine/npx.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
int mc_fpstate[128] __aligned(16);
|
||||
|
||||
__register_t mc_fsbase;
|
||||
__register_t mc_gsbase;
|
||||
|
||||
__register_t mc_xfpustate;
|
||||
__register_t mc_xfpustate_len;
|
||||
|
||||
int mc_spare2[4];
|
||||
} mcontext_t;
|
||||
|
||||
#if defined(_KERNEL) && defined(COMPAT_FREEBSD4)
|
||||
struct mcontext4 {
|
||||
__register_t mc_onstack; /* XXX - sigcontext compat. */
|
||||
@ -116,4 +58,6 @@ struct mcontext4 {
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <x86/ucontext.h>
|
||||
|
||||
#endif /* !_MACHINE_UCONTEXT_H_ */
|
||||
|
215
sys/x86/include/elf.h
Normal file
215
sys/x86/include/elf.h
Normal file
@ -0,0 +1,215 @@
|
||||
/*-
|
||||
* Copyright (c) 1996-1997 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_ELF_H_
|
||||
#define _MACHINE_ELF_H_ 1
|
||||
|
||||
#if defined(__i386__) || defined(_MACHINE_ELF_WANT_32BIT)
|
||||
|
||||
/*
|
||||
* ELF definitions for the i386 architecture.
|
||||
*/
|
||||
|
||||
#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
|
||||
#if defined(__ELF_WORD_SIZE) && __ELF_WORD_SIZE == 64
|
||||
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
|
||||
#endif
|
||||
|
||||
#ifndef __ELF_WORD_SIZE
|
||||
#define __ELF_WORD_SIZE 32 /* Used by <sys/elf_generic.h> */
|
||||
#endif
|
||||
|
||||
#include <sys/elf_generic.h>
|
||||
|
||||
#define ELF_ARCH EM_386
|
||||
|
||||
#define ELF_MACHINE_OK(x) ((x) == EM_386 || (x) == EM_486)
|
||||
|
||||
/*
|
||||
* Auxiliary vector entries for passing information to the interpreter.
|
||||
*
|
||||
* The i386 supplement to the SVR4 ABI specification names this "auxv_t",
|
||||
* but POSIX lays claim to all symbols ending with "_t".
|
||||
*/
|
||||
|
||||
typedef struct { /* Auxiliary vector entry on initial stack */
|
||||
int a_type; /* Entry type. */
|
||||
union {
|
||||
long a_val; /* Integer value. */
|
||||
void *a_ptr; /* Address. */
|
||||
void (*a_fcn)(void); /* Function pointer (not used). */
|
||||
} a_un;
|
||||
} Elf32_Auxinfo;
|
||||
|
||||
#if __ELF_WORD_SIZE == 64
|
||||
/* Fake for amd64 loader support */
|
||||
typedef struct {
|
||||
int fake;
|
||||
} Elf64_Auxinfo;
|
||||
#endif
|
||||
|
||||
__ElfType(Auxinfo);
|
||||
|
||||
/* Values for a_type. */
|
||||
#define AT_NULL 0 /* Terminates the vector. */
|
||||
#define AT_IGNORE 1 /* Ignored entry. */
|
||||
#define AT_EXECFD 2 /* File descriptor of program to load. */
|
||||
#define AT_PHDR 3 /* Program header of program already loaded. */
|
||||
#define AT_PHENT 4 /* Size of each program header entry. */
|
||||
#define AT_PHNUM 5 /* Number of program header entries. */
|
||||
#define AT_PAGESZ 6 /* Page size in bytes. */
|
||||
#define AT_BASE 7 /* Interpreter's base address. */
|
||||
#define AT_FLAGS 8 /* Flags (unused for i386). */
|
||||
#define AT_ENTRY 9 /* Where interpreter should transfer control. */
|
||||
#define AT_NOTELF 10 /* Program is not ELF ?? */
|
||||
#define AT_UID 11 /* Real uid. */
|
||||
#define AT_EUID 12 /* Effective uid. */
|
||||
#define AT_GID 13 /* Real gid. */
|
||||
#define AT_EGID 14 /* Effective gid. */
|
||||
#define AT_EXECPATH 15 /* Path to the executable. */
|
||||
#define AT_CANARY 16 /* Canary for SSP. */
|
||||
#define AT_CANARYLEN 17 /* Length of the canary. */
|
||||
#define AT_OSRELDATE 18 /* OSRELDATE. */
|
||||
#define AT_NCPUS 19 /* Number of CPUs. */
|
||||
#define AT_PAGESIZES 20 /* Pagesizes. */
|
||||
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
|
||||
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
|
||||
#define AT_STACKPROT 23 /* Initial stack protection. */
|
||||
|
||||
#define AT_COUNT 24 /* Count of defined aux entry types. */
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
*/
|
||||
|
||||
#define R_386_COUNT 38 /* Count of defined relocation types. */
|
||||
|
||||
/* Define "machine" characteristics */
|
||||
#define ELF_TARG_CLASS ELFCLASS32
|
||||
#define ELF_TARG_DATA ELFDATA2LSB
|
||||
#define ELF_TARG_MACH EM_386
|
||||
#define ELF_TARG_VER 1
|
||||
|
||||
#define ET_DYN_LOAD_ADDR 0x01001000
|
||||
|
||||
#elif defined(__amd64__)
|
||||
|
||||
/*
|
||||
* ELF definitions for the AMD64 architecture.
|
||||
*/
|
||||
|
||||
#ifndef __ELF_WORD_SIZE
|
||||
#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */
|
||||
#endif
|
||||
#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
|
||||
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
|
||||
#include <sys/elf_generic.h>
|
||||
|
||||
#define ELF_ARCH EM_X86_64
|
||||
#define ELF_ARCH32 EM_386
|
||||
|
||||
#define ELF_MACHINE_OK(x) ((x) == EM_X86_64)
|
||||
|
||||
/*
|
||||
* Auxiliary vector entries for passing information to the interpreter.
|
||||
*
|
||||
* The i386 supplement to the SVR4 ABI specification names this "auxv_t",
|
||||
* but POSIX lays claim to all symbols ending with "_t".
|
||||
*/
|
||||
typedef struct { /* Auxiliary vector entry on initial stack */
|
||||
int a_type; /* Entry type. */
|
||||
union {
|
||||
int a_val; /* Integer value. */
|
||||
} a_un;
|
||||
} Elf32_Auxinfo;
|
||||
|
||||
|
||||
typedef struct { /* Auxiliary vector entry on initial stack */
|
||||
long a_type; /* Entry type. */
|
||||
union {
|
||||
long a_val; /* Integer value. */
|
||||
void *a_ptr; /* Address. */
|
||||
void (*a_fcn)(void); /* Function pointer (not used). */
|
||||
} a_un;
|
||||
} Elf64_Auxinfo;
|
||||
|
||||
__ElfType(Auxinfo);
|
||||
|
||||
/* Values for a_type. */
|
||||
#define AT_NULL 0 /* Terminates the vector. */
|
||||
#define AT_IGNORE 1 /* Ignored entry. */
|
||||
#define AT_EXECFD 2 /* File descriptor of program to load. */
|
||||
#define AT_PHDR 3 /* Program header of program already loaded. */
|
||||
#define AT_PHENT 4 /* Size of each program header entry. */
|
||||
#define AT_PHNUM 5 /* Number of program header entries. */
|
||||
#define AT_PAGESZ 6 /* Page size in bytes. */
|
||||
#define AT_BASE 7 /* Interpreter's base address. */
|
||||
#define AT_FLAGS 8 /* Flags (unused for i386). */
|
||||
#define AT_ENTRY 9 /* Where interpreter should transfer control. */
|
||||
#define AT_NOTELF 10 /* Program is not ELF ?? */
|
||||
#define AT_UID 11 /* Real uid. */
|
||||
#define AT_EUID 12 /* Effective uid. */
|
||||
#define AT_GID 13 /* Real gid. */
|
||||
#define AT_EGID 14 /* Effective gid. */
|
||||
#define AT_EXECPATH 15 /* Path to the executable. */
|
||||
#define AT_CANARY 16 /* Canary for SSP */
|
||||
#define AT_CANARYLEN 17 /* Length of the canary. */
|
||||
#define AT_OSRELDATE 18 /* OSRELDATE. */
|
||||
#define AT_NCPUS 19 /* Number of CPUs. */
|
||||
#define AT_PAGESIZES 20 /* Pagesizes. */
|
||||
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
|
||||
#define AT_TIMEKEEP 22 /* Pointer to timehands. */
|
||||
#define AT_STACKPROT 23 /* Initial stack protection. */
|
||||
|
||||
#define AT_COUNT 24 /* Count of defined aux entry types. */
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
*/
|
||||
|
||||
#define R_X86_64_COUNT 24 /* Count of defined relocation types. */
|
||||
|
||||
/* Define "machine" characteristics */
|
||||
#if __ELF_WORD_SIZE == 32
|
||||
#define ELF_TARG_CLASS ELFCLASS32
|
||||
#else
|
||||
#define ELF_TARG_CLASS ELFCLASS64
|
||||
#endif
|
||||
#define ELF_TARG_DATA ELFDATA2LSB
|
||||
#define ELF_TARG_MACH EM_X86_64
|
||||
#define ELF_TARG_VER 1
|
||||
|
||||
#if __ELF_WORD_SIZE == 32
|
||||
#define ET_DYN_LOAD_ADDR 0x01001000
|
||||
#else
|
||||
#define ET_DYN_LOAD_ADDR 0x01021000
|
||||
#endif
|
||||
|
||||
#endif /* __i386__, __amd64__ */
|
||||
|
||||
#endif /* !_MACHINE_ELF_H_ */
|
148
sys/x86/include/frame.h
Normal file
148
sys/x86/include/frame.h
Normal file
@ -0,0 +1,148 @@
|
||||
/*-
|
||||
* Copyright (c) 2003 Peter Wemm.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)frame.h 5.2 (Berkeley) 1/18/91
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_FRAME_H_
|
||||
#define _MACHINE_FRAME_H_ 1
|
||||
|
||||
/*
|
||||
* System stack frames.
|
||||
*/
|
||||
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* Exception/Trap Stack Frame
|
||||
*/
|
||||
|
||||
struct trapframe {
|
||||
int tf_fs;
|
||||
int tf_es;
|
||||
int tf_ds;
|
||||
int tf_edi;
|
||||
int tf_esi;
|
||||
int tf_ebp;
|
||||
int tf_isp;
|
||||
int tf_ebx;
|
||||
int tf_edx;
|
||||
int tf_ecx;
|
||||
int tf_eax;
|
||||
int tf_trapno;
|
||||
/* below portion defined in 386 hardware */
|
||||
int tf_err;
|
||||
int tf_eip;
|
||||
int tf_cs;
|
||||
int tf_eflags;
|
||||
/* below only when crossing rings (e.g. user to kernel) */
|
||||
int tf_esp;
|
||||
int tf_ss;
|
||||
};
|
||||
|
||||
/* Superset of trap frame, for traps from virtual-8086 mode */
|
||||
|
||||
struct trapframe_vm86 {
|
||||
int tf_fs;
|
||||
int tf_es;
|
||||
int tf_ds;
|
||||
int tf_edi;
|
||||
int tf_esi;
|
||||
int tf_ebp;
|
||||
int tf_isp;
|
||||
int tf_ebx;
|
||||
int tf_edx;
|
||||
int tf_ecx;
|
||||
int tf_eax;
|
||||
int tf_trapno;
|
||||
/* below portion defined in 386 hardware */
|
||||
int tf_err;
|
||||
int tf_eip;
|
||||
int tf_cs;
|
||||
int tf_eflags;
|
||||
/* below only when crossing rings (e.g. user to kernel) */
|
||||
int tf_esp;
|
||||
int tf_ss;
|
||||
/* below only when switching out of VM86 mode */
|
||||
int tf_vm86_es;
|
||||
int tf_vm86_ds;
|
||||
int tf_vm86_fs;
|
||||
int tf_vm86_gs;
|
||||
};
|
||||
#endif /* __i386__ */
|
||||
|
||||
#ifdef __amd64__
|
||||
/*
|
||||
* Exception/Trap Stack Frame
|
||||
*
|
||||
* The ordering of this is specifically so that we can take first 6
|
||||
* the syscall arguments directly from the beginning of the frame.
|
||||
*/
|
||||
|
||||
struct trapframe {
|
||||
register_t tf_rdi;
|
||||
register_t tf_rsi;
|
||||
register_t tf_rdx;
|
||||
register_t tf_rcx;
|
||||
register_t tf_r8;
|
||||
register_t tf_r9;
|
||||
register_t tf_rax;
|
||||
register_t tf_rbx;
|
||||
register_t tf_rbp;
|
||||
register_t tf_r10;
|
||||
register_t tf_r11;
|
||||
register_t tf_r12;
|
||||
register_t tf_r13;
|
||||
register_t tf_r14;
|
||||
register_t tf_r15;
|
||||
uint32_t tf_trapno;
|
||||
uint16_t tf_fs;
|
||||
uint16_t tf_gs;
|
||||
register_t tf_addr;
|
||||
uint32_t tf_flags;
|
||||
uint16_t tf_es;
|
||||
uint16_t tf_ds;
|
||||
/* below portion defined in hardware */
|
||||
register_t tf_err;
|
||||
register_t tf_rip;
|
||||
register_t tf_cs;
|
||||
register_t tf_rflags;
|
||||
register_t tf_rsp;
|
||||
register_t tf_ss;
|
||||
};
|
||||
|
||||
#define TF_HASSEGS 0x1
|
||||
#define TF_HASBASES 0x2
|
||||
#define TF_HASFPXSTATE 0x4
|
||||
#endif /* __amd64__ */
|
||||
|
||||
#endif /* _MACHINE_FRAME_H_ */
|
72
sys/x86/include/sigframe.h
Normal file
72
sys/x86/include/sigframe.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Marcel Moolenaar
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer
|
||||
* in this position and unchanged.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _X86_SIGFRAME_H_
|
||||
#define _X86_SIGFRAME_H_
|
||||
|
||||
/*
|
||||
* Signal frames, arguments passed to application signal handlers.
|
||||
*/
|
||||
|
||||
#ifdef __i386__
|
||||
struct sigframe {
|
||||
/*
|
||||
* The first four members may be used by applications.
|
||||
*
|
||||
* NOTE: The 4th argument is undocumented, ill commented
|
||||
* on and seems to be somewhat BSD "standard". Handlers
|
||||
* installed with sigvec may be using it.
|
||||
*/
|
||||
register_t sf_signum;
|
||||
register_t sf_siginfo; /* code or pointer to sf_si */
|
||||
register_t sf_ucontext; /* points to sf_uc */
|
||||
register_t sf_addr; /* undocumented 4th arg */
|
||||
|
||||
union {
|
||||
__siginfohandler_t *sf_action;
|
||||
__sighandler_t *sf_handler;
|
||||
} sf_ahu;
|
||||
ucontext_t sf_uc; /* = *sf_ucontext */
|
||||
siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
|
||||
};
|
||||
#endif /* __i386__ */
|
||||
|
||||
#ifdef __amd64__
|
||||
struct sigframe {
|
||||
union {
|
||||
__siginfohandler_t *sf_action;
|
||||
__sighandler_t *sf_handler;
|
||||
} sf_ahu;
|
||||
ucontext_t sf_uc; /* = *sf_ucontext */
|
||||
siginfo_t sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
|
||||
};
|
||||
#endif /* __amd64__ */
|
||||
|
||||
#endif /* _X86_SIGFRAME_H_ */
|
167
sys/x86/include/signal.h
Normal file
167
sys/x86/include/signal.h
Normal file
@ -0,0 +1,167 @@
|
||||
/*-
|
||||
* Copyright (c) 1986, 1989, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* Copyright (c) 2003 Peter Wemm.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)signal.h 8.1 (Berkeley) 6/11/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _X86_SIGNAL_H
|
||||
#define _X86_SIGNAL_H 1
|
||||
|
||||
/*
|
||||
* Machine-dependent signal definitions
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_sigset.h>
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#include <machine/trap.h> /* codes for SIGILL, SIGFPE */
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
typedef int sig_atomic_t;
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
struct sigcontext {
|
||||
struct __sigset sc_mask; /* signal mask to restore */
|
||||
int sc_onstack; /* sigstack state to restore */
|
||||
int sc_gs; /* machine state (struct trapframe) */
|
||||
int sc_fs;
|
||||
int sc_es;
|
||||
int sc_ds;
|
||||
int sc_edi;
|
||||
int sc_esi;
|
||||
int sc_ebp;
|
||||
int sc_isp;
|
||||
int sc_ebx;
|
||||
int sc_edx;
|
||||
int sc_ecx;
|
||||
int sc_eax;
|
||||
int sc_trapno;
|
||||
int sc_err;
|
||||
int sc_eip;
|
||||
int sc_cs;
|
||||
int sc_efl;
|
||||
int sc_esp;
|
||||
int sc_ss;
|
||||
int sc_len; /* sizeof(mcontext_t) */
|
||||
/*
|
||||
* See <machine/ucontext.h> and <machine/npx.h> for
|
||||
* the following fields.
|
||||
*/
|
||||
int sc_fpformat;
|
||||
int sc_ownedfp;
|
||||
int sc_flags;
|
||||
int sc_fpstate[128] __aligned(16);
|
||||
|
||||
int sc_fsbase;
|
||||
int sc_gsbase;
|
||||
|
||||
int sc_xfpustate;
|
||||
int sc_xfpustate_len;
|
||||
|
||||
int sc_spare2[4];
|
||||
};
|
||||
|
||||
#define sc_sp sc_esp
|
||||
#define sc_fp sc_ebp
|
||||
#define sc_pc sc_eip
|
||||
#define sc_ps sc_efl
|
||||
#define sc_eflags sc_efl
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* __i386__ */
|
||||
|
||||
#ifdef __amd64__
|
||||
typedef long sig_atomic_t;
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
/*
|
||||
* Information pushed on stack when a signal is delivered.
|
||||
* This is used by the kernel to restore state following
|
||||
* execution of the signal handler. It is also made available
|
||||
* to the handler to allow it to restore state properly if
|
||||
* a non-standard exit is performed.
|
||||
*
|
||||
* The sequence of the fields/registers after sc_mask in struct
|
||||
* sigcontext must match those in mcontext_t and struct trapframe.
|
||||
*/
|
||||
struct sigcontext {
|
||||
struct __sigset sc_mask; /* signal mask to restore */
|
||||
long sc_onstack; /* sigstack state to restore */
|
||||
long sc_rdi; /* machine state (struct trapframe) */
|
||||
long sc_rsi;
|
||||
long sc_rdx;
|
||||
long sc_rcx;
|
||||
long sc_r8;
|
||||
long sc_r9;
|
||||
long sc_rax;
|
||||
long sc_rbx;
|
||||
long sc_rbp;
|
||||
long sc_r10;
|
||||
long sc_r11;
|
||||
long sc_r12;
|
||||
long sc_r13;
|
||||
long sc_r14;
|
||||
long sc_r15;
|
||||
int sc_trapno;
|
||||
short sc_fs;
|
||||
short sc_gs;
|
||||
long sc_addr;
|
||||
int sc_flags;
|
||||
short sc_es;
|
||||
short sc_ds;
|
||||
long sc_err;
|
||||
long sc_rip;
|
||||
long sc_cs;
|
||||
long sc_rflags;
|
||||
long sc_rsp;
|
||||
long sc_ss;
|
||||
long sc_len; /* sizeof(mcontext_t) */
|
||||
/*
|
||||
* See <machine/ucontext.h> and <machine/fpu.h> for the following
|
||||
* fields.
|
||||
*/
|
||||
long sc_fpformat;
|
||||
long sc_ownedfp;
|
||||
long sc_fpstate[64] __aligned(16);
|
||||
|
||||
long sc_fsbase;
|
||||
long sc_gsbase;
|
||||
|
||||
long sc_xfpustate;
|
||||
long sc_xfpustate_len;
|
||||
|
||||
long sc_spare[4];
|
||||
};
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* __amd64__ */
|
||||
|
||||
#endif
|
165
sys/x86/include/ucontext.h
Normal file
165
sys/x86/include/ucontext.h
Normal file
@ -0,0 +1,165 @@
|
||||
/*-
|
||||
* Copyright (c) 2003 Peter Wemm
|
||||
* Copyright (c) 1999 Marcel Moolenaar
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer
|
||||
* in this position and unchanged.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _X86_UCONTEXT_H_
|
||||
#define _X86_UCONTEXT_H_
|
||||
|
||||
#ifdef __i386__
|
||||
/* Keep _MC_* values similar to amd64 */
|
||||
#define _MC_HASSEGS 0x1
|
||||
#define _MC_HASBASES 0x2
|
||||
#define _MC_HASFPXSTATE 0x4
|
||||
#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE)
|
||||
|
||||
typedef struct __mcontext {
|
||||
/*
|
||||
* The definition of mcontext_t must match the layout of
|
||||
* struct sigcontext after the sc_mask member. This is so
|
||||
* that we can support sigcontext and ucontext_t at the same
|
||||
* time.
|
||||
*/
|
||||
__register_t mc_onstack; /* XXX - sigcontext compat. */
|
||||
__register_t mc_gs; /* machine state (struct trapframe) */
|
||||
__register_t mc_fs;
|
||||
__register_t mc_es;
|
||||
__register_t mc_ds;
|
||||
__register_t mc_edi;
|
||||
__register_t mc_esi;
|
||||
__register_t mc_ebp;
|
||||
__register_t mc_isp;
|
||||
__register_t mc_ebx;
|
||||
__register_t mc_edx;
|
||||
__register_t mc_ecx;
|
||||
__register_t mc_eax;
|
||||
__register_t mc_trapno;
|
||||
__register_t mc_err;
|
||||
__register_t mc_eip;
|
||||
__register_t mc_cs;
|
||||
__register_t mc_eflags;
|
||||
__register_t mc_esp;
|
||||
__register_t mc_ss;
|
||||
|
||||
int mc_len; /* sizeof(mcontext_t) */
|
||||
#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */
|
||||
#define _MC_FPFMT_387 0x10001
|
||||
#define _MC_FPFMT_XMM 0x10002
|
||||
int mc_fpformat;
|
||||
#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */
|
||||
#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */
|
||||
#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */
|
||||
int mc_ownedfp;
|
||||
__register_t mc_flags;
|
||||
/*
|
||||
* See <machine/npx.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
int mc_fpstate[128] __aligned(16);
|
||||
|
||||
__register_t mc_fsbase;
|
||||
__register_t mc_gsbase;
|
||||
|
||||
__register_t mc_xfpustate;
|
||||
__register_t mc_xfpustate_len;
|
||||
|
||||
int mc_spare2[4];
|
||||
} mcontext_t;
|
||||
#endif /* __i386__ */
|
||||
|
||||
#ifdef __amd64__
|
||||
/*
|
||||
* mc_trapno bits. Shall be in sync with TF_XXX.
|
||||
*/
|
||||
#define _MC_HASSEGS 0x1
|
||||
#define _MC_HASBASES 0x2
|
||||
#define _MC_HASFPXSTATE 0x4
|
||||
#define _MC_FLAG_MASK (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE)
|
||||
|
||||
typedef struct __mcontext {
|
||||
/*
|
||||
* The definition of mcontext_t must match the layout of
|
||||
* struct sigcontext after the sc_mask member. This is so
|
||||
* that we can support sigcontext and ucontext_t at the same
|
||||
* time.
|
||||
*/
|
||||
__register_t mc_onstack; /* XXX - sigcontext compat. */
|
||||
__register_t mc_rdi; /* machine state (struct trapframe) */
|
||||
__register_t mc_rsi;
|
||||
__register_t mc_rdx;
|
||||
__register_t mc_rcx;
|
||||
__register_t mc_r8;
|
||||
__register_t mc_r9;
|
||||
__register_t mc_rax;
|
||||
__register_t mc_rbx;
|
||||
__register_t mc_rbp;
|
||||
__register_t mc_r10;
|
||||
__register_t mc_r11;
|
||||
__register_t mc_r12;
|
||||
__register_t mc_r13;
|
||||
__register_t mc_r14;
|
||||
__register_t mc_r15;
|
||||
__uint32_t mc_trapno;
|
||||
__uint16_t mc_fs;
|
||||
__uint16_t mc_gs;
|
||||
__register_t mc_addr;
|
||||
__uint32_t mc_flags;
|
||||
__uint16_t mc_es;
|
||||
__uint16_t mc_ds;
|
||||
__register_t mc_err;
|
||||
__register_t mc_rip;
|
||||
__register_t mc_cs;
|
||||
__register_t mc_rflags;
|
||||
__register_t mc_rsp;
|
||||
__register_t mc_ss;
|
||||
|
||||
long mc_len; /* sizeof(mcontext_t) */
|
||||
|
||||
#define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */
|
||||
#define _MC_FPFMT_XMM 0x10002
|
||||
long mc_fpformat;
|
||||
#define _MC_FPOWNED_NONE 0x20000 /* FP state not used */
|
||||
#define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */
|
||||
#define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */
|
||||
long mc_ownedfp;
|
||||
/*
|
||||
* See <machine/fpu.h> for the internals of mc_fpstate[].
|
||||
*/
|
||||
long mc_fpstate[64] __aligned(16);
|
||||
|
||||
__register_t mc_fsbase;
|
||||
__register_t mc_gsbase;
|
||||
|
||||
__register_t mc_xfpustate;
|
||||
__register_t mc_xfpustate_len;
|
||||
|
||||
long mc_spare[4];
|
||||
} mcontext_t;
|
||||
#endif /* __amd64__ */
|
||||
|
||||
#endif /* !_X86_UCONTEXT_H_ */
|
Loading…
Reference in New Issue
Block a user