aboutsummaryrefslogtreecommitdiff
path: root/include/asm-i386
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-19 00:42:13 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-19 00:42:13 -0400
commit4a3381feb823e06c8e2da7e283c17b0b6fdbddcf (patch)
treee1bef4c3db854bb10fd13dc67415d77b5d999533 /include/asm-i386
parentfea63e38013ec628ab3f7fddc4c2148064b7910a (diff)
parent47a5c6fa0e204a2b63309c648bb2fde36836c826 (diff)
Merge branch 'master' into upstream
Diffstat (limited to 'include/asm-i386')
-rw-r--r--include/asm-i386/Kbuild4
-rw-r--r--include/asm-i386/elf.h10
-rw-r--r--include/asm-i386/setup.h2
-rw-r--r--include/asm-i386/signal.h4
-rw-r--r--include/asm-i386/system.h8
-rw-r--r--include/asm-i386/unistd.h4
6 files changed, 22 insertions, 10 deletions
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild
index 335b2fa4e06..2308190321d 100644
--- a/include/asm-i386/Kbuild
+++ b/include/asm-i386/Kbuild
@@ -1,5 +1,5 @@
include include/asm-generic/Kbuild.asm
-header-y += boot.h debugreg.h ldt.h setup.h ucontext.h
+header-y += boot.h debugreg.h ldt.h ucontext.h
-unifdef-y += mtrr.h vm86.h
+unifdef-y += mtrr.h setup.h vm86.h
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 1eac92cb5b1..db4344d9f73 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -7,10 +7,7 @@
#include <asm/ptrace.h>
#include <asm/user.h>
-#include <asm/processor.h>
-#include <asm/system.h> /* for savesegment */
#include <asm/auxvec.h>
-#include <asm/desc.h>
#include <linux/utsname.h>
@@ -48,6 +45,12 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
#define ELF_DATA ELFDATA2LSB
#define ELF_ARCH EM_386
+#ifdef __KERNEL__
+
+#include <asm/processor.h>
+#include <asm/system.h> /* for savesegment */
+#include <asm/desc.h>
+
/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
contains a pointer to a function which might be registered using `atexit'.
This provides a mean for the dynamic linker to call DT_FINI functions for
@@ -111,7 +114,6 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
#define ELF_PLATFORM (system_utsname.machine)
-#ifdef __KERNEL__
#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
/*
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index f737e423029..2734909eff8 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -6,6 +6,7 @@
#ifndef _i386_SETUP_H
#define _i386_SETUP_H
+#ifdef __KERNEL__
#include <linux/pfn.h>
/*
@@ -13,6 +14,7 @@
*/
#define MAXMEM_PFN PFN_DOWN(MAXMEM)
#define MAX_NONPAE_PFN (1 << 20)
+#endif
#define PARAM_SIZE 4096
#define COMMAND_LINE_SIZE 256
diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h
index 3824a502351..c3e8adec591 100644
--- a/include/asm-i386/signal.h
+++ b/include/asm-i386/signal.h
@@ -2,7 +2,6 @@
#define _ASMi386_SIGNAL_H
#include <linux/types.h>
-#include <linux/linkage.h>
#include <linux/time.h>
#include <linux/compiler.h>
@@ -10,6 +9,9 @@
struct siginfo;
#ifdef __KERNEL__
+
+#include <linux/linkage.h>
+
/* Most things should be clean enough to redefine this at will, if care
is taken to make libc match. */
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 49928eb33f8..098bcee94e3 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -11,9 +11,14 @@
struct task_struct; /* one of the stranger aspects of C forward declarations.. */
extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
+/*
+ * Saving eflags is important. It switches not only IOPL between tasks,
+ * it also protects other tasks from NT leaking through sysenter etc.
+ */
#define switch_to(prev,next,last) do { \
unsigned long esi,edi; \
- asm volatile("pushl %%ebp\n\t" \
+ asm volatile("pushfl\n\t" /* Save flags */ \
+ "pushl %%ebp\n\t" \
"movl %%esp,%0\n\t" /* save ESP */ \
"movl %5,%%esp\n\t" /* restore ESP */ \
"movl $1f,%1\n\t" /* save EIP */ \
@@ -21,6 +26,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
"jmp __switch_to\n" \
"1:\t" \
"popl %%ebp\n\t" \
+ "popfl" \
:"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
"=a" (last),"=S" (esi),"=D" (edi) \
:"m" (next->thread.esp),"m" (next->thread.eip), \
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index d983b74e4d9..fc1c8ddae14 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -324,6 +324,8 @@
#define __NR_vmsplice 316
#define __NR_move_pages 317
+#ifdef __KERNEL__
+
#define NR_syscalls 318
/*
@@ -423,8 +425,6 @@ __asm__ volatile ("push %%ebp ; push %%ebx ; movl 4(%2),%%ebp ; " \
__syscall_return(type,__res); \
}
-#ifdef __KERNEL__
-
#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_OLD_STAT