diff options
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/include/elf.h | 124 | ||||
-rw-r--r-- | sys/amd64/include/frame.h | 87 | ||||
-rw-r--r-- | sys/amd64/include/sigframe.h | 46 | ||||
-rw-r--r-- | sys/amd64/include/signal.h | 109 | ||||
-rw-r--r-- | sys/amd64/include/ucontext.h | 103 |
5 files changed, 15 insertions, 454 deletions
diff --git a/sys/amd64/include/elf.h b/sys/amd64/include/elf.h index d69c6b4..f932377 100644 --- a/sys/amd64/include/elf.h +++ b/sys/amd64/include/elf.h @@ -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> diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h index e171407..0953be7 100644 --- a/sys/amd64/include/frame.h +++ b/sys/amd64/include/frame.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> diff --git a/sys/amd64/include/sigframe.h b/sys/amd64/include/sigframe.h index d104507..d5cdb56 100644 --- a/sys/amd64/include/sigframe.h +++ b/sys/amd64/include/sigframe.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> diff --git a/sys/amd64/include/signal.h b/sys/amd64/include/signal.h index 085d43a..db9fe6a 100644 --- a/sys/amd64/include/signal.h +++ b/sys/amd64/include/signal.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> diff --git a/sys/amd64/include/ucontext.h b/sys/amd64/include/ucontext.h index 5ab841e..aea80e3 100644 --- a/sys/amd64/include/ucontext.h +++ b/sys/amd64/include/ucontext.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> |