]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/head64.c
x86: check vmlinux limits, 64-bit
[linux-2.6] / arch / x86 / kernel / head64.c
index 24dbf56928d73877969fae6ebff7deb40d3624fe..38f32e798a99913ff2b1995159e771559e990164 100644 (file)
@@ -82,12 +82,28 @@ void __init x86_64_start_kernel(char * real_mode_data)
 {
        int i;
 
+       /*
+        * Build-time sanity checks on the kernel image and module
+        * area mappings. (these are purely build-time and produce no code)
+        */
+       BUILD_BUG_ON(MODULES_VADDR < KERNEL_IMAGE_START);
+       BUILD_BUG_ON(MODULES_VADDR-KERNEL_IMAGE_START < KERNEL_IMAGE_SIZE);
+       BUILD_BUG_ON(MODULES_LEN + KERNEL_IMAGE_SIZE > 2*PUD_SIZE);
+       BUILD_BUG_ON((KERNEL_IMAGE_START & ~PMD_MASK) != 0);
+       BUILD_BUG_ON((MODULES_VADDR & ~PMD_MASK) != 0);
+       BUILD_BUG_ON(!(MODULES_VADDR > __START_KERNEL));
+       BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) ==
+                               (__START_KERNEL & PGDIR_MASK)));
+
        /* clear bss before set_intr_gate with early_idt_handler */
        clear_bss();
 
        /* Make NULL pointers segfault */
        zap_identity_mappings();
 
+       /* Cleanup the over mapped high alias */
+       cleanup_highmap();
+
        for (i = 0; i < IDT_ENTRIES; i++) {
 #ifdef CONFIG_EARLY_PRINTK
                set_intr_gate(i, &early_idt_handlers[i]);