summaryrefslogtreecommitdiffstats
path: root/sys/i386/include
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-02-20 17:39:52 +0000
committerkib <kib@FreeBSD.org>2013-02-20 17:39:52 +0000
commitcda69c96226e8d1ab1647199344302d2d5f4cf02 (patch)
treee11ca597288ba6690ebab08a041053e2d8a5a6e8 /sys/i386/include
parentd04ffbb5a5cb5fa49847b87fbff94d4c6be4bfe9 (diff)
downloadFreeBSD-src-cda69c96226e8d1ab1647199344302d2d5f4cf02.zip
FreeBSD-src-cda69c96226e8d1ab1647199344302d2d5f4cf02.tar.gz
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.
Diffstat (limited to 'sys/i386/include')
-rw-r--r--sys/i386/include/elf.h118
-rw-r--r--sys/i386/include/frame.h100
-rw-r--r--sys/i386/include/sigframe.h21
-rw-r--r--sys/i386/include/signal.h73
-rw-r--r--sys/i386/include/ucontext.h60
5 files changed, 10 insertions, 362 deletions
diff --git a/sys/i386/include/elf.h b/sys/i386/include/elf.h
index 93fa1fd..f932377 100644
--- a/sys/i386/include/elf.h
+++ b/sys/i386/include/elf.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>
diff --git a/sys/i386/include/frame.h b/sys/i386/include/frame.h
index 3558b98..0953be7 100644
--- a/sys/i386/include/frame.h
+++ b/sys/i386/include/frame.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>
diff --git a/sys/i386/include/sigframe.h b/sys/i386/include/sigframe.h
index 98be731..8de4664 100644
--- a/sys/i386/include/sigframe.h
+++ b/sys/i386/include/sigframe.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_ */
diff --git a/sys/i386/include/signal.h b/sys/i386/include/signal.h
index 892115b..26c1ee6 100644
--- a/sys/i386/include/signal.h
+++ b/sys/i386/include/signal.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_ */
diff --git a/sys/i386/include/ucontext.h b/sys/i386/include/ucontext.h
index 79aabd7..fe21b34 100644
--- a/sys/i386/include/ucontext.h
+++ b/sys/i386/include/ucontext.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_ */
OpenPOWER on IntegriCloud