2 * linux/arch/x86_64/kernel/head64.c -- prepare to run common code
4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
6 * $Id: head64.c,v 1.27 2003/03/31 15:12:07 ak Exp $
9 #include <asm/bootsetup.h>
10 #include <linux/init.h>
11 #include <linux/linkage.h>
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/string.h>
16 #include <asm/processor.h>
17 #include <asm/proto.h>
19 static void __init clear_bss(void)
21 extern char __bss_start[], __bss_end[];
22 printk("Clearing %ld bytes of bss...", (unsigned long) __bss_end - (unsigned long) __bss_start);
23 memset(__bss_start, 0,
24 (unsigned long) __bss_end - (unsigned long) __bss_start);
28 extern char x86_boot_params[2048];
30 #define NEW_CL_POINTER 0x228 /* Relative to real mode data */
31 #define OLD_CL_MAGIC_ADDR 0x90020
32 #define OLD_CL_MAGIC 0xA33F
33 #define OLD_CL_BASE_ADDR 0x90000
34 #define OLD_CL_OFFSET 0x90022
36 extern char saved_command_line[];
38 static void __init copy_bootdata(char *real_mode_data)
43 memcpy(x86_boot_params, real_mode_data, 2048);
44 new_data = *(int *) (x86_boot_params + NEW_CL_POINTER);
46 if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) {
47 printk("so old bootloader that it does not support commandline?!\n");
50 new_data = OLD_CL_BASE_ADDR + * (u16 *) OLD_CL_OFFSET;
51 printk("old bootloader convention, maybe loadlin?\n");
53 command_line = (char *) ((u64)(new_data));
54 memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
55 printk("Bootdata ok (command line is %s)\n", saved_command_line);
58 static void __init setup_boot_cpu_data(void)
63 cpuid(0, &boot_cpu_data.cpuid_level,
64 (int *)&boot_cpu_data.x86_vendor_id[0],
65 (int *)&boot_cpu_data.x86_vendor_id[8],
66 (int *)&boot_cpu_data.x86_vendor_id[4]);
69 cpuid(1, &eax, &dummy, &dummy, (int *) &boot_cpu_data.x86_capability);
70 boot_cpu_data.x86 = (eax >> 8) & 0xf;
71 boot_cpu_data.x86_model = (eax >> 4) & 0xf;
72 boot_cpu_data.x86_mask = eax & 0xf;
75 void __init x86_64_start_kernel(char * real_mode_data)
79 clear_bss(); /* must be the first thing in C and must not depend on .bss to be zero */
81 copy_bootdata(real_mode_data);
82 s = strstr(saved_command_line, "earlyprintk=");
84 setup_early_printk(s+12);
85 #ifdef CONFIG_DISCONTIGMEM
86 extern int numa_setup(char *);
87 s = strstr(saved_command_line, "numa=");
91 early_printk("booting x86_64 kernel... ");
92 setup_boot_cpu_data();