linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / x86_64 / kernel / setup64.c
index f77c6ca..07772c8 100644 (file)
@@ -3,7 +3,9 @@
  * Copyright (C) 1995  Linus Torvalds
  * Copyright 2001, 2002, 2003 SuSE Labs / Andi Kleen.
  * See setup.c for older changelog.
+ * $Id: setup64.c,v 1.12 2002/03/21 10:09:17 ak Exp $
  */ 
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -29,15 +31,13 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
 struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
-EXPORT_SYMBOL(_cpu_pda);
 struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
 
-struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
+struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
 
 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask __read_mostly = ~0UL;
-EXPORT_SYMBOL(__supported_pte_mask);
 static int do_not_nx __cpuinitdata = 0;
 
 /* noexec=on|off
@@ -46,7 +46,7 @@ Control non executable mappings for 64bit processes.
 on     Enable(default)
 off    Disable
 */ 
-void __init nonx_setup(const char *str)
+int __init nonx_setup(char *str)
 {
        if (!strncmp(str, "on", 2)) {
                 __supported_pte_mask |= _PAGE_NX; 
@@ -55,7 +55,28 @@ void __init nonx_setup(const char *str)
                do_not_nx = 1;
                __supported_pte_mask &= ~_PAGE_NX;
         }
+       return 0;
+} 
+__setup("noexec=", nonx_setup);        /* parsed early actually */
+
+int force_personality32 = READ_IMPLIES_EXEC;
+
+/* noexec32=on|off
+Control non executable heap for 32bit processes.
+To control the stack too use noexec=off
+
+on     PROT_READ does not imply PROT_EXEC for 32bit processes
+off    PROT_READ implies PROT_EXEC (default)
+*/
+static int __init nonx32_setup(char *str)
+{
+       if (!strcmp(str, "on"))
+               force_personality32 &= ~READ_IMPLIES_EXEC;
+       else if (!strcmp(str, "off"))
+               force_personality32 |= READ_IMPLIES_EXEC;
+       return 0;
 }
+__setup("noexec32=", nonx32_setup);
 
 /*
  * Great future plan:
@@ -157,6 +178,8 @@ void __cpuinit check_efer(void)
         }       
 }
 
+unsigned long kernel_eflags;
+
 /*
  * cpu_init() initializes state that is per-CPU. Some data is already
  * initialized (naturally) in the bootstrap process, such as the GDT
@@ -168,7 +191,6 @@ void __cpuinit cpu_init (void)
 {
        int cpu = stack_smp_processor_id();
        struct tss_struct *t = &per_cpu(init_tss, cpu);
-       struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu);
        unsigned long v; 
        char *estacks = NULL; 
        struct task_struct *me;
@@ -228,7 +250,7 @@ void __cpuinit cpu_init (void)
                switch (v + 1) {
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
                case DEBUG_STACK:
-                       cpu_pda(cpu)->debugstack = (unsigned long)estacks;
+                       cpu_pda[cpu].debugstack = (unsigned long)estacks;
                        estacks += DEBUG_STKSZ;
                        break;
 #endif
@@ -236,7 +258,7 @@ void __cpuinit cpu_init (void)
                        estacks += EXCEPTION_STKSZ;
                        break;
                }
-               orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks;
+               t->ist[v] = (unsigned long)estacks;
        }
 
        t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
@@ -261,12 +283,14 @@ void __cpuinit cpu_init (void)
         * Clear all 6 debug registers:
         */
 
-       set_debugreg(0UL, 0);
-       set_debugreg(0UL, 1);
-       set_debugreg(0UL, 2);
-       set_debugreg(0UL, 3);
-       set_debugreg(0UL, 6);
-       set_debugreg(0UL, 7);
+       set_debug(0UL, 0);
+       set_debug(0UL, 1);
+       set_debug(0UL, 2);
+       set_debug(0UL, 3);
+       set_debug(0UL, 6);
+       set_debug(0UL, 7);
 
        fpu_init(); 
+
+       raw_local_save_flags(kernel_eflags);
 }