static void __init start_of_day(void) { init_IRQ(); scheduler_init(); /* create idle domain */ idle_domain = domain_create(IDLE_DOMAIN_ID, 0, 0); if ((idle_domain == NULL) || (alloc_vcpu(idle_domain, 0, 0) == NULL)) BUG(); set_current(idle_domain->vcpu[0]); idle_vcpu[0] = current; initialize_keytable(); /* Register another key that will allow for the the Harware Probe * to be contacted, this works with RiscWatch probes and should * work with Chronos and FSPs */ register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe"); /* allow the dumping of the devtree */ register_keyhandler('D', key_ofdump , "Dump OF Devtree"); timer_init(); rcu_init(); serial_init_postirq(); do_initcalls(); }
asmlinkage void start_secondary(void) { trap_init(); init_IRQ(); smp_callin(); cpu_idle(NULL); }
/* * ターゲットシステム依存の初期化 */ void sys_initialize() { int i; init_vector(); /* SRAMのリマップ。LPC2388共通 */ init_clock(); /* PLLの設定。システム固有 */ init_uart0(); /* UART0の初期化。システム固有 */ init_IRQ(); /* VICを初期化する。LPC2388共通 */ /* 必要なペリフェラルの電源を入れる(システム固有) */ /* なお、UART0とTIMER3はLPC2388共通で必要 */ PCONP |= 0x00800008; /* bit3:UART0, bit23:TIMER3 */ /* UART0のピンを設定 (LPC2388共通) */ PINSEL0 &= ~0xF0; /* bit 4-7だけをクリア */ PINSEL0 |= 0x50; /* UART入出力を割り当て */ /* * ARMのベクタテーブルへ割込みハンドラを登録(どのARMv4システムでも要求される) */ arm_install_handler(IRQ_Number,IRQ_Handler); /* * Memory Acceleration Moduleの設定 ( NXP社 UM10211 chapter 7 ) * Flashメモリのプリフェッチを使ってプログラム実行を高速化する */ MAMCR = 0; /* 念のためMAMをオフにする */ MAMTIM = 4; /* UM10211によれば、60MHz以上で動作するときは4に設定する */ MAMCR = 2; /* MAM機能をオンにする */ }
/* * Called by secondaries to update state and initialize CPU registers. */ static void __init smp_cpu_init(int cpunum) { extern int init_per_cpu(int); /* arch/parisc/kernel/setup.c */ extern void init_IRQ(void); /* arch/parisc/kernel/irq.c */ /* Set modes and Enable floating point coprocessor */ (void) init_per_cpu(cpunum); disable_sr_hashing(); mb(); /* Well, support 2.4 linux scheme as well. */ if (cpu_test_and_set(cpunum, cpu_online_map)) { extern void machine_halt(void); /* arch/parisc.../process.c */ printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum); machine_halt(); } /* Initialise the idle task for this CPU */ atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; if(current->mm) BUG(); enter_lazy_tlb(&init_mm, current); init_IRQ(); /* make sure no IRQ's are enabled or pending */ }
asmlinkage void start_secondary(void) { trap_init(); #ifndef CONFIG_OSFMACH3 init_IRQ(); #endif /* CONFIG_OSFMACH3 */ smp_callin(); cpu_idle(NULL); }
/** * 主核初始化 */ asmlinkage void __init start_master(void) { debug_printstr_mmu("xby_debug, start cpu 0\n"); local_irq_disable(); //tick_init(); /* 为当前CPU设置其活动掩码 */ boot_cpu_init(); /* 体系结构特定的初始化过程 */ start_arch(); //初始化boot内存分配器 InitBootMemory(0xc0000000 + 8 * 1024 * 1024, 0xc0000000 + 24 * 1024 * 1024); init_IRQ(); //体系结构和驱动的一些初始化过程 //run_initcall(); //为VFS分配一些大的内存块,用于哈希表。此过程必须在boot阶段分配。 //vfs_caches_init_early(); #ifdef FS blk_dev_init(); inode_init(); file_table_init(); name_cache_init(); buffer_init_early(); #endif memory_init(); #ifdef FS buffer_init_tail(); tty_init(); #endif sched_init(); time_init(); setup_timer(); serial_init(); //mmc_init(); //omap_gpio_init(); //初始化文件系统 //vfs_caches_init(num_physpages); local_irq_enable(); //创建系统任务,以及用户任务入口 TaskEntry(); cpu_idle(); //不可能运行到这里来 BUG(); }
void start_kernel(void) { seg_t base, end; /* We set the idle task as #0, and init_task() will be task #1 */ sched_init(); /* This block of functions don't need console */ setup_arch(&base, &end); mm_init(base, end); buffer_init(); inode_init(); init_IRQ(); tty_init(); init_console(); #if (CONFIG_BOGOMIPS == 0) calibrate_delay(); #endif device_setup(); #ifdef CONFIG_SOCKET sock_init(); #endif fs_init(); mm_stat(base, end); printk("ELKS version %s\n", system_utsname.release); kfork_proc(init_task); wake_up_process(&task[1]); /* * We are now the idle task. We won't run unless no other process can run. */ while (1) { schedule(); #ifdef CONFIG_IDLE_HALT idle_halt (); #endif } }
/* * We use kgdb_early_setup so that functions we need to call now don't * cause trouble when called again later. */ int kgdb_arch_init(void) { /* Board-specifics. */ /* Force some calls to happen earlier. */ if (kgdb_early_setup == 0) { trap_init(); init_IRQ(); kgdb_early_setup = 1; } /* Set our traps. */ /* This needs to be done more finely grained again, paired in * a before/after in kgdb_handle_exception(...) -- Tom */ set_debug_traps(); notifier_chain_register(&mips_die_chain, &kgdb_notifier); return 0; }
void start_kernel(void) { seg_t base, end; /* We set the scheduler up as task #0, and this as task #1 */ setup_arch(&base, &end); mm_init(base, end); init_IRQ(); init_console(); #if 0 calibrate_delay(); #endif setup_mm(); /* Architecture specifics */ tty_init(); buffer_init(); #ifdef CONFIG_SOCKET sock_init(); #endif device_setup(); inode_init(); fs_init(); sched_init(); printk("ELKS version %s\n", system_utsname.release); task[0].t_kstackm = KSTACK_MAGIC; task[0].next_run = task[0].prev_run = &task[0]; kfork_proc(&task[1], init_task); /* * We are now the idle task. We won't run unless no other process can run. */ while (1){ schedule(); } }
void setup_kernel (multiboot_info_t *info, unsigned long magic) { serial_early_init(); assert(magic == MULTIBOOT_BOOTLOADER_MAGIC); init_early_pagination (); cpu_init (); trap_init (); init_IRQ (); sti(); size_t cmdline_len = strlen((char *)info->cmdline); cmdline_parse((char *)info->cmdline, cmdline_len); /* okay, this is a *ugly* hack, but it works if there is only 1 module */ if (info->mods_count != 0) { boot_module.addr = 0x4000; boot_module.len = ((module_t *)info->mods_addr)->mod_end - ((module_t *)info->mods_addr)->mod_start; /* set name to buf */ boot_module.name = (char *)&boot_module.buf; memcpy(&boot_module.buf,(void *)(((module_t *)info->mods_addr)->string + sizeof(long)),64); memcpy((void*)0x4000,(void *)((module_t *)info->mods_addr)->mod_start, PAGE_SIZE); } u32 nr_frames = frame_allocator_init(info->mem_upper * 1024); // load_stack_info(); // FIXME /* NOTE: stack reset, do nothing here */ return start_kernel (info); }
/* * Called by secondaries to update state and initialize CPU registers. */ static void __init smp_cpu_init(int cpunum) { extern int init_per_cpu(int); /* arch/parisc/kernel/processor.c */ extern void init_IRQ(void); /* arch/parisc/kernel/irq.c */ extern void start_cpu_itimer(void); /* arch/parisc/kernel/time.c */ /* Set modes and Enable floating point coprocessor */ (void) init_per_cpu(cpunum); disable_sr_hashing(); mb(); /* Well, support 2.4 linux scheme as well. */ if (cpu_online(cpunum)) { extern void machine_halt(void); /* arch/parisc.../process.c */ printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum); machine_halt(); } notify_cpu_starting(cpunum); ipi_call_lock(); set_cpu_online(cpunum, true); ipi_call_unlock(); /* Initialise the idle task for this CPU */ atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; BUG_ON(current->mm); enter_lazy_tlb(&init_mm, current); init_IRQ(); /* make sure no IRQs are enabled or pending */ start_cpu_itimer(); }
int main_loop(struct multiboot_info *boot_info) { _kclear(); syscall_init(); module_start = (char*) *((unsigned int*)boot_info->mods_addr); module_end = *((unsigned int*)(boot_info->mods_addr+4)); _kcolor(BRIGHT_GREEN); _kputs(DREAMOS_VER); _kcolor(WHITE); _kputs(LNG_SITE); _kcolor(BRIGHT_BLUE); _kputs(SITEURL); _kputs("\n"); _kcolor(WHITE); _kputs("\n"); _kputs(LNG_GDT); init_gdt(); _kprintOK(); outportb(0xFF, MASTER_PORT_1); outportb(0xFF, SLAVE_PORT_1); _kputs(LNG_IDT); asm("cli"); init_idt(); _kprintOK(); _kputs(LNG_PIC8259); init_IRQ(); _kprintOK(); printf(LNG_PIT8253); configure_PIT (); //_kprintOK(); set_memorysize((boot_info->mem_upper+boot_info->mem_lower)*1024); init_mem(); asm("sti"); _kprintOK(); init_paging(); _kprintOK(); printf("Memory (upper) amount-> %d kb \n", boot_info->mem_upper); printf("Memory (lower) amount-> %d kb \n", boot_info->mem_lower); /* Alloc and fill CPUID structure */ sinfo = kmalloc(sizeof(struct cpuinfo_generic)); get_cpuid (sinfo); vfs_init(); initfs_init(); if(boot_info->mods_count > 0) printf("Found n. %d Modules\n", boot_info->mods_count); //printf("Address of module: 0x%x - 0x%x\n", *((unsigned int*)boot_info->mods_addr),module_end-(unsigned int) module_start); printf("\n"); printf("----\n"); printf(LNG_SHELL); _kprintOK(); printf("[+] Address: 0x%x\n", &end); printf("\n"); #ifdef BOCHS_DEBUG dbg_bochs_print((const unsigned char*)"DreamOS Debug String for Bochs\n"); #endif shell(); return 0; }
asmlinkage void __init start_kernel(void) { char * command_line; extern char saved_command_line[]; /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); printk(linux_banner); setup_arch(&command_line); printk("Kernel command line: %s\n", saved_command_line); parse_options(command_line); trap_init(); init_IRQ(); sched_init(); softirq_init(); time_init(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); #ifdef CONFIG_MODULES init_modules(); #endif if (prof_shift) { unsigned int size; /* only text is profiled */ prof_len = (unsigned long) &_etext - (unsigned long) &_stext; prof_len >>= prof_shift; size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1; prof_buffer = (unsigned int *) alloc_bootmem(size); } kmem_cache_init(); sti(); calibrate_delay(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); initrd_start = 0; } #endif mem_init(); kmem_cache_sizes_init(); pgtable_cache_init(); /* * For architectures that have highmem, num_mappedpages represents * the amount of memory the kernel can use. For other architectures * it's the same as the total pages. We need both numbers because * some subsystems need to initialize based on how much memory the * kernel can use. */ if (num_mappedpages == 0) num_mappedpages = num_physpages; fork_init(num_mappedpages); proc_caches_init(); vfs_caches_init(num_physpages); buffer_init(num_physpages); page_cache_init(num_physpages); #if defined(CONFIG_ARCH_S390) ccwcache_init(); #endif signals_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif check_bugs(); printk("POSIX conformance testing by UNIFIX\n"); /* * We count on the initial thread going ok * Like idlers init is an unlocked kernel thread, which will * make syscalls (and thus be locked). */ smp_init(); #if defined(CONFIG_SYSVIPC) ipc_init(); #endif rest_init(); }
asmlinkage void __init start_kernel(void) { char * command_line; extern struct kernel_param __start___param[], __stop___param[]; smp_setup_processor_id(); /* * Need to run as early as possible, to initialize the * lockdep hash: */ unwind_init(); lockdep_init(); local_irq_disable(); early_boot_irqs_off(); early_init_irq_lock_class(); /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); boot_cpu_init(); page_address_init(); printk(KERN_NOTICE); printk(linux_banner); setup_arch(&command_line); setup_per_cpu_areas(); smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ /* * Set up the scheduler prior starting any interrupts (such as the * timer interrupt). Full topology setup happens at smp_init() * time - but meanwhile we still have a functioning scheduler. */ sched_init(); /* * Disable preemption - early bootup scheduling is extremely * fragile until we cpu_idle() for the first time. */ preempt_disable(); build_all_zonelists(); page_alloc_init(); printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line); parse_early_param(); parse_args("Booting kernel", command_line, __start___param, __stop___param - __start___param, &unknown_bootoption); sort_main_extable(); trap_init(); rcu_init(); init_IRQ(); pidhash_init(); init_timers(); hrtimers_init(); softirq_init(); timekeeping_init(); time_init(); profile_init(); if (!irqs_disabled()) printk("start_kernel(): bug: interrupts were enabled early\n"); early_boot_irqs_on(); local_irq_enable(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); if (panic_later) panic(panic_later, panic_param); lockdep_info(); /* * Need to run this when irqs are enabled, because it wants * to self-test [hard/soft]-irqs on/off lock inversion bugs * too: */ locking_selftest(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); initrd_start = 0; } #endif vfs_caches_init_early(); cpuset_init_early(); mem_init(); kmem_cache_init(); setup_per_cpu_pageset(); numa_policy_init(); if (late_time_init) late_time_init(); calibrate_delay(); pidmap_init(); pgtable_cache_init(); prio_tree_init(); anon_vma_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); #endif fork_init(num_physpages); proc_caches_init(); buffer_init(); unnamed_dev_init(); key_init(); security_init(); vfs_caches_init(num_physpages); radix_tree_init(); signals_init(); /* rootfs populating might need page-writeback */ page_writeback_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif cpuset_init(); taskstats_init_early(); delayacct_init(); check_bugs(); acpi_early_init(); /* before LAPIC and SMP init */ /* Do the rest non-__init'ed, we're now alive */ rest_init(); }
asmlinkage void start_kernel(void) { char * command_line; /* * This little check will move. */ #ifdef __SMP__ static int first_cpu=1; if(!first_cpu) start_secondary(); first_cpu=0; #endif /* * Interrupts are still disabled. Do necessary setups, then * enable them */ setup_arch(&command_line, &memory_start, &memory_end); memory_start = paging_init(memory_start,memory_end); trap_init(); #ifndef CONFIG_OSFMACH3 init_IRQ(); #endif /* CONFIG_OSFMACH3 */ sched_init(); time_init(); parse_options(command_line); #ifdef CONFIG_MODULES init_modules(); #endif #ifdef CONFIG_PROFILE if (!prof_shift) #ifdef CONFIG_PROFILE_SHIFT prof_shift = CONFIG_PROFILE_SHIFT; #else prof_shift = 2; #endif #endif if (prof_shift) { prof_buffer = (unsigned int *) memory_start; /* only text is profiled */ prof_len = (unsigned long) &_etext - (unsigned long) &_stext; prof_len >>= prof_shift; memory_start += prof_len * sizeof(unsigned int); memset(prof_buffer, 0, prof_len * sizeof(unsigned int)); } memory_start = console_init(memory_start,memory_end); #ifdef CONFIG_PCI memory_start = pci_init(memory_start,memory_end); #endif memory_start = kmalloc_init(memory_start,memory_end); sti(); calibrate_delay(); memory_start = inode_init(memory_start,memory_end); memory_start = file_table_init(memory_start,memory_end); memory_start = name_cache_init(memory_start,memory_end); #ifndef CONFIG_OSFMACH3 #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && initrd_start < memory_start) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,memory_start); initrd_start = 0; } #endif #endif /* CONFIG_OSFMACH3 */ mem_init(memory_start,memory_end); buffer_init(); sock_init(); #if defined(CONFIG_SYSVIPC) || defined(CONFIG_KERNELD) ipc_init(); #endif dquot_init(); arch_syms_export(); sti(); check_bugs(); printk(linux_banner); #ifdef __SMP__ smp_init(); #endif sysctl_init(); /* * We count on the initial thread going ok * Like idlers init is an unlocked kernel thread, which will * make syscalls (and thus be locked). */ #ifdef CONFIG_OSFMACH3 osfmach3_start_init(argv_init, envp_init); #else /* CONFIG_OSFMACH3 */ kernel_thread(init, NULL, 0); #endif /* CONFIG_OSFMACH3 */ /* * task[0] is meant to be used as an "idle" task: it may not sleep, but * it might do some general things like count free pages or it could be * used to implement a reasonable LRU algorithm for the paging routines: * anything that can be useful, but shouldn't take time from the real * processes. * * Right now task[0] just does a infinite idle loop. */ cpu_idle(NULL); }
asmlinkage void __init start_kernel(void) { char * command_line; extern struct kernel_param __start___param[], __stop___param[]; #ifdef CONFIG_RTAI_RTSPMM unsigned int indice_part; /* Size of the needed memory block by the configuration */ unsigned long rt_mem_block_size = 0; #endif /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); page_address_init(); printk(linux_banner); setup_arch(&command_line); setup_per_cpu_areas(); /* * Mark the boot cpu "online" so that it can call console drivers in * printk() and can access its per-cpu storage. */ smp_prepare_boot_cpu(); /* * Set up the scheduler prior starting any interrupts (such as the * timer interrupt). Full topology setup happens at smp_init() * time - but meanwhile we still have a functioning scheduler. */ sched_init(); /* * Disable preemption - early bootup scheduling is extremely * fragile until we cpu_idle() for the first time. */ preempt_disable(); build_all_zonelists(); page_alloc_init(); early_init_hardirqs(); printk("Kernel command line: %s\n", saved_command_line); parse_early_param(); parse_args("Booting kernel", command_line, __start___param, __stop___param - __start___param, &unknown_bootoption); sort_main_extable(); trap_init(); rcu_init(); init_IRQ(); pidhash_init(); init_timers(); softirq_init(); time_init(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); if (panic_later) panic(panic_later, panic_param); #ifdef CONFIG_RTAI_RTSPMM /* Allocate a big and continuous memory block for the module SPMM included in the RTAI functionalities */ printk("--- Memory Allocation for the module rt_spmm ---\n"); /* WARNING We need to add some space for the structures vrtxptext and vrtxpt and the partitions bitmap that the module rt_spmm uses to handle the blocks in each partition */ /* for each defined partitions */ for(indice_part = 0; indice_part < RT_MAX_PART_NUM; indice_part ++) { if ((rt_partitions_table[indice_part].block_size != 0) && (rt_partitions_table[indice_part].num_of_blocks != 0)) { rt_partitions_table[indice_part].part_size = (rt_partitions_table[indice_part].block_size + XN_NBBY) *rt_partitions_table[indice_part].num_of_blocks + + sizeof(vrtxptext_t)+sizeof(vrtxpt_t); rt_mem_block_size += rt_partitions_table[indice_part].part_size; } } #ifdef CONFIG_RTAI_PART_DMA printk("Allocate memory in the low part of memory\n"); rt_mem_block_ptr=(void*)alloc_bootmem_low(rt_mem_block_size + PAGE_SIZE-1); #else printk("Allocate memory in the standard part of memory\n"); rt_mem_block_ptr=(void*)alloc_bootmem(rt_mem_block_size + PAGE_SIZE-1); #endif /* CONFIG_PART_DMA */ printk("Needed Memory Size : %lu\n", rt_mem_block_size); printk("Allocated Memory Size : %lu\n", rt_mem_block_size + PAGE_SIZE-1); printk("Memory block address : 0x%x\n", (unsigned int)rt_mem_block_ptr); printk("-----------------------------------------------\n"); #endif /* CONFIG_RTAI_RTSPMM */ profile_init(); local_irq_enable(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); initrd_start = 0; } #endif vfs_caches_init_early(); mem_init(); kmem_cache_init(); numa_policy_init(); if (late_time_init) late_time_init(); calibrate_delay(); pidmap_init(); pgtable_cache_init(); prio_tree_init(); anon_vma_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); #endif fork_init(num_physpages); proc_caches_init(); buffer_init(); unnamed_dev_init(); security_init(); vfs_caches_init(num_physpages); #ifdef CONFIG_MOT_FEAT_DEVICE_TREE mothwcfg_init(); #endif /* CONFIG_MOT_FEAT_DEVICE_TREE */ radix_tree_init(); signals_init(); /* rootfs populating might need page-writeback */ page_writeback_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif check_bugs(); acpi_early_init(); /* before LAPIC and SMP init */ /* Do the rest non-__init'ed, we're now alive */ rest_init(); }
asmlinkage void __init start_kernel(void) { char * command_line; #ifdef __SMP__ static int boot_cpu = 1; /* "current" has been set up, we need to load it now */ if (!boot_cpu) initialize_secondary(); boot_cpu = 0; #endif /* * Interrupts are still disabled. Do necessary setups, then * enable them */ printk(linux_banner); setup_arch(&command_line, &memory_start, &memory_end); memory_start = paging_init(memory_start,memory_end); trap_init(); init_IRQ(); sched_init(); time_init(); parse_options(command_line); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ memory_start = console_init(memory_start,memory_end); #ifdef CONFIG_MODULES init_modules(); #endif if (prof_shift) { prof_buffer = (unsigned int *) memory_start; /* only text is profiled */ prof_len = (unsigned long) &_etext - (unsigned long) &_stext; prof_len >>= prof_shift; memory_start += prof_len * sizeof(unsigned int); memset(prof_buffer, 0, prof_len * sizeof(unsigned int)); } #ifdef CONFIG_REMOTE_DEBUG set_debug_traps(); /* breakpoint(); */ /* execute a BREAK insn */ #endif memory_start = kmem_cache_init(memory_start, memory_end); sti(); calibrate_delay(); #ifdef CONFIG_CPU_R5900 r5900_init(); #endif #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < memory_start) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,memory_start); initrd_start = 0; } #endif #ifdef CONFIG_BINFMT_IRIX init_inventory (); #endif mem_init(memory_start,memory_end); kmem_cache_sizes_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif uidcache_init(); filescache_init(); dcache_init(); vma_init(); buffer_init(); signals_init(); inode_init(); file_table_init(); #if defined(CONFIG_SYSVIPC) ipc_init(); #endif #if defined(CONFIG_QUOTA) dquot_init_hash(); #endif check_bugs(); printk("POSIX conformance testing by UNIFIX\n"); /* * We count on the initial thread going ok * Like idlers init is an unlocked kernel thread, which will * make syscalls (and thus be locked). */ smp_init(); kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); current->need_resched = 1; cpu_idle(NULL); }
void start_kernel(struct multiboot *mbp, unsigned int magic,u32 esp) { u32 initrd_location = *((u32*)mbp->mods_addr); u32 initrd_end = *(u32*)(mbp->mods_addr+4); __asm__ __volatile__("cli"); cpu_init(); placement_pointer = initrd_end; vmmngr_initialize(mbp->mem_upper + mbp->mem_lower); kheap = _heapmngr_initialize(0x02000000, 0x20000000, 0x200000); con_init(); init_IRQ(); time_init(); _kbd_init_hook(); /*setup_irq(2, &irq2); setup_irq(3, &irq3 ); setup_irq(4, &irq4 ); setup_irq(5, &irq5 ); setup_irq(8, &irq8 ); */ //auto_fpu(); task_initialize(); syscalls_install(); fs_root_initrd = install_initrd(initrd_location); //pci_inst_check(); //enable_pci_master(0,3,0); //8139 need this struct request *info = 0; probe_ide(info); hd_init_hook_(); putch('P'); double test = 3.14444; printk("test ::: %d\n", test); //serial_install(); //unsigned long cpu_khz = init_tsc(); //u32 *pf = (u32 *)0xffff0000; //*pf = 10; ext2_read_superblock(); register_filesystem(); __asm__ __volatile__("sti"); //graphics_install_bochs(1024,768); //heaptest(); //create_thread(test_task,1); while(1) { if(getch_polling() == 'i') { const char *filename = "test__2"; //execve__((char*)filename,0,0); load_elf((char*)filename,0,0); //show_state(); } } }
/* C entry point for boot CPU */ void __init start_xen(unsigned long boot_phys_offset, unsigned long fdt_paddr, unsigned long cpuid) { size_t fdt_size; int cpus, i; paddr_t xen_paddr; const char *cmdline; struct bootmodule *xen_bootmodule; struct domain *dom0; struct xen_arch_domainconfig config; setup_cache(); percpu_init_areas(); set_processor_id(0); /* needed early, for smp_processor_id() */ set_current((struct vcpu *)0xfffff000); /* debug sanity */ idle_vcpu[0] = current; setup_virtual_regions(NULL, NULL); /* Initialize traps early allow us to get backtrace when an error occurred */ init_traps(); smp_clear_cpu_maps(); /* This is mapped by head.S */ device_tree_flattened = (void *)BOOT_FDT_VIRT_START + (fdt_paddr & ((1 << SECOND_SHIFT) - 1)); fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr); cmdline = boot_fdt_cmdline(device_tree_flattened); printk("Command line: %s\n", cmdline); cmdline_parse(cmdline); /* Register Xen's load address as a boot module. */ xen_bootmodule = add_boot_module(BOOTMOD_XEN, (paddr_t)(uintptr_t)(_start + boot_phys_offset), (paddr_t)(uintptr_t)(_end - _start + 1), NULL); BUG_ON(!xen_bootmodule); xen_paddr = get_xen_paddr(); setup_pagetables(boot_phys_offset, xen_paddr); /* Update Xen's address now that we have relocated. */ printk("Update BOOTMOD_XEN from %"PRIpaddr"-%"PRIpaddr" => %"PRIpaddr"-%"PRIpaddr"\n", xen_bootmodule->start, xen_bootmodule->start + xen_bootmodule->size, xen_paddr, xen_paddr + xen_bootmodule->size); xen_bootmodule->start = xen_paddr; setup_mm(fdt_paddr, fdt_size); /* Parse the ACPI tables for possible boot-time configuration */ acpi_boot_table_init(); end_boot_allocator(); vm_init(); dt_unflatten_host_device_tree(); init_IRQ(); platform_init(); preinit_xen_time(); gic_preinit(); arm_uart_init(); console_init_preirq(); console_init_ring(); system_state = SYS_STATE_boot; processor_id(); smp_init_cpus(); cpus = smp_get_max_cpus(); init_xen_time(); gic_init(); p2m_vmid_allocator_init(); softirq_init(); tasklet_subsys_init(); xsm_dt_init(); init_maintenance_interrupt(); init_timer_interrupt(); timer_init(); init_idle_domain(); rcu_init(); arch_init_memory(); local_irq_enable(); local_abort_enable(); smp_prepare_cpus(cpus); initialize_keytable(); console_init_postirq(); do_presmp_initcalls(); for_each_present_cpu ( i ) { if ( (num_online_cpus() < cpus) && !cpu_online(i) ) { int ret = cpu_up(i); if ( ret != 0 ) printk("Failed to bring up CPU %u (error %d)\n", i, ret); } } printk("Brought up %ld CPUs\n", (long)num_online_cpus()); /* TODO: smp_cpus_done(); */ setup_virt_paging(); iommu_setup(); do_initcalls(); /* * It needs to be called after do_initcalls to be able to use * stop_machine (tasklets initialized via an initcall). */ apply_alternatives_all(); /* Create initial domain 0. */ /* The vGIC for DOM0 is exactly emulating the hardware GIC */ config.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE; config.nr_spis = gic_number_lines() - 32; dom0 = domain_create(0, 0, 0, &config); if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) ) panic("Error creating domain 0"); dom0->is_privileged = 1; dom0->target = NULL; if ( construct_dom0(dom0) != 0) panic("Could not set up DOM0 guest OS"); /* Scrub RAM that is still free and so may go to an unprivileged domain. */ scrub_heap_pages(); init_constructors(); console_endboot(); /* Hide UART from DOM0 if we're using it */ serial_endboot(); system_state = SYS_STATE_active; /* Must be done past setting system_state. */ unregister_init_virtual_region(); domain_unpause_by_systemcontroller(dom0); /* Switch on to the dynamically allocated stack for the idle vcpu * since the static one we're running on is about to be freed. */ memcpy(idle_vcpu[0]->arch.cpu_info, get_cpu_info(), sizeof(struct cpu_info)); switch_stack_and_jump(idle_vcpu[0]->arch.cpu_info, init_done); }
asmlinkage void __init start_kernel(void) { char * command_line; extern char saved_command_line[]; extern struct kernel_param __start___param[], __stop___param[]; #ifdef TARGET_OS2 LX_set_sysstate(LXSYSSTATE_KERNEL_BOOT_STARTED,0); #endif /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); page_address_init(); printk(linux_banner); setup_arch(&command_line); setup_per_cpu_areas(); /* * Mark the boot cpu "online" so that it can call console drivers in * printk() and can access its per-cpu storage. */ smp_prepare_boot_cpu(); build_all_zonelists(); page_alloc_init(); printk("Kernel command line: %s\n", saved_command_line); #ifdef TARGET_OS2 parse_args("Booting kernel", command_line, __start___param, 0, &unknown_bootoption); #else parse_args("Booting kernel", command_line, __start___param, __stop___param - __start___param, &unknown_bootoption); #endif sort_main_extable(); trap_init(); rcu_init(); init_IRQ(); pidhash_init(); sched_init(); softirq_init(); time_init(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); if (panic_later) panic(panic_later, panic_param); profile_init(); local_irq_enable(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); initrd_start = 0; } #endif mem_init(); kmem_cache_init(); if (late_time_init) late_time_init(); calibrate_delay(); pidmap_init(); pgtable_cache_init(); pte_chain_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); #endif fork_init(num_physpages); proc_caches_init(); buffer_init(); unnamed_dev_init(); security_scaffolding_startup(); vfs_caches_init(num_physpages); radix_tree_init(); signals_init(); /* rootfs populating might need page-writeback */ page_writeback_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif check_bugs(); printk("POSIX conformance testing by UNIFIX\n"); /* * We count on the initial thread going ok * Like idlers init is an unlocked kernel thread, which will * make syscalls (and thus be locked). */ init_idle(current, smp_processor_id()); /* Do the rest non-__init'ed, we're now alive */ rest_init(); }
asmlinkage void __init start_kernel(void) { char * command_line; extern struct kernel_param __start___param[], __stop___param[]; smp_setup_processor_id(); /* * Need to run as early as possible, to initialize the * lockdep hash: */ lockdep_init(); debug_objects_early_init(); /* * Set up the the initial canary ASAP: */ boot_init_stack_canary(); cgroup_init_early(); local_irq_disable(); early_boot_irqs_off(); early_init_irq_lock_class(); /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); tick_init(); boot_cpu_init(); page_address_init(); printk(KERN_NOTICE "%s", linux_banner); setup_arch(&command_line); mm_init_owner(&init_mm, &init_task); setup_command_line(command_line); setup_nr_cpu_ids(); setup_per_cpu_areas(); smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ build_all_zonelists(NULL); page_alloc_init(); printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); //[email protected] 2011.11.14 begin //support lcd compatible //reviewed by [email protected] #if defined(CONFIG_LCD_DRV_ALL) char *p = strstr(boot_command_line, "lcd="); if (p) { lcd_drv_index = p[4] - 'A'; printk("lcd index = %d", lcd_drv_index); } #endif //[email protected] 2011.11.14 end parse_early_param(); parse_args("Booting kernel", static_command_line, __start___param, __stop___param - __start___param, &unknown_bootoption); /* * These use large bootmem allocations and must precede * kmem_cache_init() */ pidhash_init(); vfs_caches_init_early(); sort_main_extable(); trap_init(); mm_init(); /* * Set up the scheduler prior starting any interrupts (such as the * timer interrupt). Full topology setup happens at smp_init() * time - but meanwhile we still have a functioning scheduler. */ sched_init(); /* * Disable preemption - early bootup scheduling is extremely * fragile until we cpu_idle() for the first time. */ preempt_disable(); if (!irqs_disabled()) { printk(KERN_WARNING "start_kernel(): bug: interrupts were " "enabled *very* early, fixing it\n"); local_irq_disable(); } rcu_init(); radix_tree_init(); /* init some links before init_ISA_irqs() */ early_irq_init(); init_IRQ(); prio_tree_init(); init_timers(); hrtimers_init(); softirq_init(); timekeeping_init(); time_init(); profile_init(); if (!irqs_disabled()) printk(KERN_CRIT "start_kernel(): bug: interrupts were " "enabled early\n"); early_boot_irqs_on(); local_irq_enable(); /* Interrupts are enabled now so all GFP allocations are safe. */ gfp_allowed_mask = __GFP_BITS_MASK; kmem_cache_init_late(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); if (panic_later) panic(panic_later, panic_param); lockdep_info(); /* * Need to run this when irqs are enabled, because it wants * to self-test [hard/soft]-irqs on/off lock inversion bugs * too: */ locking_selftest(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n", page_to_pfn(virt_to_page((void *)initrd_start)), min_low_pfn); initrd_start = 0; } #endif page_cgroup_init(); enable_debug_pagealloc(); kmemtrace_init(); kmemleak_init(); debug_objects_mem_init(); idr_init_cache(); setup_per_cpu_pageset(); numa_policy_init(); if (late_time_init) late_time_init(); sched_clock_init(); calibrate_delay(); pidmap_init(); anon_vma_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); #endif thread_info_cache_init(); cred_init(); fork_init(totalram_pages); proc_caches_init(); buffer_init(); key_init(); security_init(); dbg_late_init(); vfs_caches_init(totalram_pages); signals_init(); /* rootfs populating might need page-writeback */ page_writeback_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif cgroup_init(); cpuset_init(); taskstats_init_early(); delayacct_init(); check_bugs(); acpi_early_init(); /* before LAPIC and SMP init */ sfi_init_late(); ftrace_init(); /* Do the rest non-__init'ed, we're now alive */ rest_init(); }
/* C entry point for boot CPU */ void __init start_xen(unsigned long boot_phys_offset, unsigned long fdt_paddr, unsigned long cpuid) { size_t fdt_size; int cpus, i; const char *cmdline; setup_cache(); percpu_init_areas(); set_processor_id(0); /* needed early, for smp_processor_id() */ smp_clear_cpu_maps(); /* This is mapped by head.S */ device_tree_flattened = (void *)BOOT_FDT_VIRT_START + (fdt_paddr & ((1 << SECOND_SHIFT) - 1)); fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr); cmdline = device_tree_bootargs(device_tree_flattened); early_printk("Command line: %s\n", cmdline); cmdline_parse(cmdline); setup_pagetables(boot_phys_offset, get_xen_paddr()); setup_mm(fdt_paddr, fdt_size); vm_init(); dt_unflatten_host_device_tree(); dt_irq_xlate = gic_irq_xlate; dt_uart_init(); console_init_preirq(); system_state = SYS_STATE_boot; processor_id(); platform_init(); smp_init_cpus(); cpus = smp_get_max_cpus(); init_xen_time(); gic_init(); set_current((struct vcpu *)0xfffff000); /* debug sanity */ idle_vcpu[0] = current; init_traps(); setup_virt_paging(); p2m_vmid_allocator_init(); softirq_init(); tasklet_subsys_init(); init_IRQ(); gic_route_ppis(); gic_route_spis(); init_maintenance_interrupt(); init_timer_interrupt(); timer_init(); init_idle_domain(); rcu_init(); arch_init_memory(); local_irq_enable(); local_abort_enable(); smp_prepare_cpus(cpus); initialize_keytable(); console_init_postirq(); do_presmp_initcalls(); for_each_present_cpu ( i ) { if ( (num_online_cpus() < cpus) && !cpu_online(i) ) { int ret = cpu_up(i); if ( ret != 0 ) printk("Failed to bring up CPU %u (error %d)\n", i, ret); } } printk("Brought up %ld CPUs\n", (long)num_online_cpus()); /* TODO: smp_cpus_done(); */ do_initcalls(); /* Create initial domain 0. */ dom0 = domain_create(0, 0, 0); if ( IS_ERR(dom0) || (alloc_dom0_vcpu0() == NULL) ) panic("Error creating domain 0"); dom0->is_privileged = 1; dom0->target = NULL; if ( construct_dom0(dom0) != 0) panic("Could not set up DOM0 guest OS"); /* Scrub RAM that is still free and so may go to an unprivileged domain. */ scrub_heap_pages(); init_constructors(); console_endboot(); /* Hide UART from DOM0 if we're using it */ serial_endboot(); system_state = SYS_STATE_active; domain_unpause_by_systemcontroller(dom0); /* Switch on to the dynamically allocated stack for the idle vcpu * since the static one we're running on is about to be freed. */ memcpy(idle_vcpu[0]->arch.cpu_info, get_cpu_info(), sizeof(struct cpu_info)); switch_stack_and_jump(idle_vcpu[0]->arch.cpu_info, init_done); }
asmlinkage void __init start_kernel(void) { char * command_line; /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); page_address_init(); printk(KERN_NOTICE); printk(linux_banner); setup_arch(&command_line); setup_per_cpu_areas(); /* * Mark the boot cpu "online" so that it can call console drivers in * printk() and can access its per-cpu storage. */ smp_prepare_boot_cpu(); /* * Set up the scheduler prior starting any interrupts (such as the * timer interrupt). Full topology setup happens at smp_init() * time - but meanwhile we still have a functioning scheduler. */ sched_init(); /* * Disable preemption - early bootup scheduling is extremely * fragile until we cpu_idle() for the first time. */ preempt_disable(); build_all_zonelists(); page_alloc_init(); printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line); parse_early_param(); parse_args("Booting kernel", command_line, __kernel_param_list_ptr, kparam_list_count(), &unknown_bootoption); sort_main_extable(); #ifdef CONFIG_LTT ltt_init(); #endif //CONFIG_LTT trap_init(); rcu_init(); init_IRQ(); pidhash_init(); init_timers(); hrtimers_init(); softirq_init(); time_init(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); if (panic_later) panic(panic_later, panic_param); profile_init(); local_irq_enable(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); initrd_start = 0; } #endif vfs_caches_init_early(); mem_init(); kmem_cache_init(); setup_per_cpu_pageset(); numa_policy_init(); if (late_time_init) late_time_init(); calibrate_delay(); pidmap_init(); pgtable_cache_init(); prio_tree_init(); anon_vma_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); #endif fork_init(num_physpages); proc_caches_init(); buffer_init(); unnamed_dev_init(); key_init(); security_init(); vfs_caches_init(num_physpages); radix_tree_init(); signals_init(); /* rootfs populating might need page-writeback */ page_writeback_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif cpuset_init(); check_bugs(); acpi_early_init(); /* before LAPIC and SMP init */ /* Do the rest non-__init'ed, we're now alive */ rest_init(); }