static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); device_tree_init(); sparse_init(); plat_swiotlb_setup(); paging_init(); }
void __init setup_arch(char **cmdline_p) { /* * init "current thread structure" pointer */ lm32_current_thread = (struct thread_info*)&init_thread_union; strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); *cmdline_p = cmd_line; #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif #ifdef CONFIG_EARLY_PRINTK setup_early_printk(); #endif /* * Init boot memory */ bootmem_init(); device_tree_init(); /* * Get kmalloc into gear. */ paging_init(); }
void kernel_init(boot_info_t bootInfo) { tty_init(); multiboot_init(bootInfo.multiboot_magic, bootInfo.multiboot_addr); if(a20_enable()) { serial_writestring(1, "A20 enable failed - triggering panic\n"); kernel_panic(); }; gdt_install(); idt_install(); irq_install(); _protected_mode_init(); paging_init(); _paging_enable(); PIC_init(); serial_init(); keyboard_init(); timer_init(); serial_writestring(1, "End kernel_init\n"); kernel_main(); };
void __init setup_arch(char **cmdline_p) { paging_init(); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; setup_hostinfo(host_info, sizeof host_info); }
/* Pintos main program. */ int main (void) { char **argv; /* Clear BSS. */ bss_init (); /* Break command line into arguments and parse options. */ argv = read_command_line (); argv = parse_options (argv); /* Initialize ourselves as a thread so we can use locks, then enable console locking. */ thread_init (); console_init (); /* Greet user. */ printf ("Pintos booting with %'"PRIu32" kB RAM...\n", init_ram_pages * PGSIZE / 1024); /* Initialize memory system. */ palloc_init (user_page_limit); malloc_init (); paging_init (); <<<<<<< HEAD
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); strlcpy(command_line, arcs_cmdline, sizeof(command_line)); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); #ifndef CONFIG_NLM_16G_MEM_SUPPORT #ifndef CONFIG_NUMA setup_mapped_kernel_tlbs(FALSE, TRUE); #endif #endif sparse_init(); paging_init(); }
void __init setup_arch(char **cmdline_p) { /* * init "current thread structure" pointer */ lm32_current_thread = (struct thread_info*)&init_thread_union; /* populate memory_start and memory_end, needed for bootmem_init() */ early_init_devtree(__dtb_start); /* a cmdline set by the bootloader overrides one defined in the dts */ if (__cmdline && strlen(__cmdline)) strlcpy(cmd_line, __cmdline, COMMAND_LINE_SIZE); *cmdline_p = cmd_line; strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); /* early commandline needed by memblock */ parse_early_param(); bootmem_init(); device_tree_init(); paging_init(); plat_setup_arch(); #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif }
void __init setup_arch(char **cmdline_p) { #ifdef CONFIG_SGI_IP22 ip22_setup(); #endif #ifdef CONFIG_SGI_IP27 ip27_setup(); #endif #ifdef CONFIG_SGI_IP32 ip32_setup(); #endif #ifdef CONFIG_SIBYTE_SWARM swarm_setup(); #endif #ifdef CONFIG_MIPS_MALTA malta_setup(); #endif strncpy(command_line, arcs_cmdline, CL_SIZE); memcpy(saved_command_line, command_line, CL_SIZE); saved_command_line[CL_SIZE-1] = '\0'; *cmdline_p = command_line; parse_mem_cmdline(); bootmem_init(); paging_init(); }
void k_main(multiboot_info_t * multiboot_info) { system_info.total_memory = multiboot_info->mem_upper; clrscr(); printf("%s\n", &uname); printf(" Copyright 2005-2006 Draco Project\n"); printf("%dM of extended memory.\n", multiboot_info->mem_upper >> 10); cons_attribute = 7; init_gdt(); init_idt(); init_irq(0x20, 0x28); paging_kernel_env(system_info.total_memory / 4); paging_init(); proc_init(); modules_init(multiboot_info); printf("Kernel is initialized.\n"); sti(); while(1); }
void mm_init(multiboot_memory_map_t* mmap, uint32_t length, uint32_t highest_module) { uint32_t i, len; if((uint32_t)&end_of_image > highest_module) { highest_module = (uint32_t)&end_of_image; } uint32_t start_addr = ((highest_module + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; uint64_t end; for(i = 0; i < length / sizeof(multiboot_memory_map_t); i++) { if(mmap[i].type == MULTIBOOT_MEMORY_AVAILABLE) { if(mmap[i].addr >= ADDRESS_SPACE_SIZE) { continue; } end = mmap[i].addr + mmap[i].len; if(end > ADDRESS_SPACE_SIZE) { end = ADDRESS_SPACE_SIZE - 1; } len = end - mmap[i].addr; if(mmap[i].addr + len <= start_addr) { continue; } if(mmap[i].addr > start_addr) { len -= (uint32_t)mmap[i].addr - start_addr; start_addr = (uint32_t)mmap[i].addr; } // page align base address: base = ((start_addr + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; max_size = len; kprintf("%d MiB available memory (0x%x - 0x%x)\n", len / (1024 * 1024), start_addr, start_addr + len); paging_init(start_addr + len); return; } } panic("did not find suitable memory region"); }
void kmain (void) { cpu = &cpus[0]; uart_init (P2V(UART0)); init_vmm (); kpt_freerange (align_up(&end, PT_SZ), P2V_WO(INIT_KERNMAP)); paging_init (INIT_KERNMAP, PHYSTOP); kmem_init (); kmem_init2(P2V(INIT_KERNMAP), P2V(PHYSTOP)); trap_init (); // vector table and stacks for models gic_init(P2V(VIC_BASE)); // arm v2 gic init uart_enable_rx (); // interrupt for uart consoleinit (); // console pinit (); // process (locks) binit (); // buffer cache fileinit (); // file table iinit (); // inode cache ideinit (); // ide (memory block device) #ifdef INCLUDE_REMOVED timer_init (HZ); // the timer (ticker) #endif sti (); userinit(); // first user process scheduler(); // start running processes }
void __init kern_start() { struct thread *main_thread; mach_start(); kprintf("Starting Koowaldah v%s kernel.\n", VERSION_STRING); /* memory allocation machinery: zones, buddy allocator, slices */ init_mem_info(); paging_init(); galloc_init(); kqueue_init(); timers_init(); sched0_load(); scheduler_init(); main_thread = thread_create(&kernel_main_thread, "GOD", NULL); if (!main_thread) { kprintf("Failed to create main kernel thread\n"); bug(); } thread_switch_to(main_thread); bug(); }
void __init setup_arch(char **cmdline_p) { init_mm.start_code = (unsigned long) _stext; init_mm.end_code = (unsigned long) _etext; init_mm.end_data = (unsigned long) _edata; init_mm.brk = (unsigned long) _end; *cmdline_p = boot_command_line; parse_early_param(); setup_bootmem(); paging_init(); unflatten_device_tree(); #ifdef CONFIG_SWIOTLB swiotlb_init(1); #endif #ifdef CONFIG_SMP setup_smp(); #endif #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif riscv_fill_hwcap(); }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); printk("Determined physical RAM map:\n"); print_memory_map(); strlcpy(command_line, arcs_cmdline, sizeof(command_line)); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { printk("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); #ifdef CONFIG_SPARSEMEM sparse_memory_present_with_active_regions(MAX_NUMNODES); #endif sparse_init(); paging_init(); }
void kmain(multiboot_info_t* mbd, unsigned long magic) { if(magic != MULTIBOOT_BOOTLOADER_MAGIC) { scrn_setmode(GREEN,BLACK); scrn_print("Algo salio muy muy mal. No se que mas decirte."); return; } scrn_cls(); scrn_setmode(GREEN,BLACK); scrn_print("BIENVENIDO A juampiOS\n\t" "Estamos trabajando para ofrecerle " "el OS del futuro.\n"); scrn_print("INICIALIZANDO GDT..."); gdt_init(); gdt_flush(); scrn_print("OK\nINICIALIZANDO IDT PARA LAS EXCEPCIONES..."); initialize_exception_handlers(); idt_init_exceptions(); remap_pic(); scrn_print("OK\nINICIALIZANDO IDT PARA LAS INTERRUPCIONES Y SYSCALLS..."); irq_init_handlers(); syscalls_initialize(); idt_init_interrupts(); idt_init_syscalls(); idt_flush(); irq_sti_force(); scrn_printf("OK\nCHEQUEANDO ESTADO DE LOS MODULOS..."); scrn_printf("%u MODULOS CARGADOS\n",mbd->mods_count); scrn_print("CHECKEANDO ESTADO DE LA MEMORIA\n"); // Chequeamos que la cantidad de memoria RAM presente. if(mbd->flags & 1) { scrn_printf("\tCantidad de RAM en el sistema:\n" "\t\tLower: %u Kb, Upper: %u Kb\n", mbd->mem_lower,mbd->mem_upper); } else { kernel_panic("Mapa de memoria de GRUB invalido"); } scrn_print("INICIALIZANDO LAS ESTRUCTURAS DE MEMORIA DEL KERNEL..."); module_t* grub_modules = (module_t*) mbd->mods_addr; uint kernel_end_addr = grub_modules[mbd->mods_count-1].mod_end; // El mapa de memoria upper es a partir del primer megabyte ergo el primer // lugar donde nos vamos de largo es 1024 kilobytes mas la memoria que dice GRUB paging_init(kernel_end_addr, (1024+mbd->mem_upper)*1024); scrn_printf("OK\n"); scrn_print("INICIALIZANDO DISCO ATA\n"); hdd_init(); scrn_printf("INICIALIZANDO FILESYSTEM MINIX\n"); init_disk_super_block(); keybuffer_init(1024); scheduler_init(); void * buffer = (void *) grub_modules[0].mod_start; jump_to_initial(buffer); while(1) ; }
void init() { gdt_init(); idt_init(); paging_init(); timer_init(50); keyboard_init(); }
void __init setup_arch(char **cmdline_p) { notifier_chain_register(&panic_notifier_list, &panic_exit_notifier); paging_init(); strcpy(command_line, saved_command_line); *cmdline_p = command_line; setup_hostinfo(); }
void arch_entry() { paging_init(); gdt_init(); idt_init(); isr_init(); pic_init(); pit_init(); }
void __init setup_arch(char **cmdline_p) { extern int mem_reserve(unsigned long, unsigned long, int); extern void bootmem_init(void); memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; *cmdline_p = command_line; /* Reserve some memory regions */ #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start < initrd_end) { initrd_is_mapped = mem_reserve(__pa(initrd_start), __pa(initrd_end), 0); initrd_below_start_ok = 1; } else { initrd_start = 0; } #endif mem_reserve(__pa(&_stext),__pa(&_end), 1); mem_reserve(__pa(&_WindowVectors_text_start), __pa(&_WindowVectors_text_end), 0); mem_reserve(__pa(&_DebugInterruptVector_literal_start), __pa(&_DebugInterruptVector_text_end), 0); mem_reserve(__pa(&_KernelExceptionVector_literal_start), __pa(&_KernelExceptionVector_text_end), 0); mem_reserve(__pa(&_UserExceptionVector_literal_start), __pa(&_UserExceptionVector_text_end), 0); mem_reserve(__pa(&_DoubleExceptionVector_literal_start), __pa(&_DoubleExceptionVector_text_end), 0); bootmem_init(); platform_setup(cmdline_p); paging_init(); zones_init(); #ifdef CONFIG_VT # if defined(CONFIG_VGA_CONSOLE) conswitchp = &vga_con; # elif defined(CONFIG_DUMMY_CONSOLE) conswitchp = &dummy_con; # endif #endif #ifdef CONFIG_PCI platform_pcibios_init(); #endif }
void __init setup_arch(char **cmdline_p) { /* * print what head.S has found out about the machine */ #ifndef CONFIG_64BIT printk((MACHINE_IS_VM) ? "We are running under VM (31 bit mode)\n" : "We are running native (31 bit mode)\n"); printk((MACHINE_HAS_IEEE) ? "This machine has an IEEE fpu\n" : "This machine has no IEEE fpu\n"); #else /* CONFIG_64BIT */ printk((MACHINE_IS_VM) ? "We are running under VM (64 bit mode)\n" : "We are running native (64 bit mode)\n"); #endif /* CONFIG_64BIT */ /* Save unparsed command line copy for /proc/cmdline */ strlcpy(boot_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); *cmdline_p = COMMAND_LINE; *(*cmdline_p + COMMAND_LINE_SIZE - 1) = '\0'; ROOT_DEV = Root_RAM0; init_mm.start_code = PAGE_OFFSET; init_mm.end_code = (unsigned long) &_etext; init_mm.end_data = (unsigned long) &_edata; init_mm.brk = (unsigned long) &_end; if (MACHINE_HAS_MVCOS) memcpy(&uaccess, &uaccess_mvcos, sizeof(uaccess)); else memcpy(&uaccess, &uaccess_std, sizeof(uaccess)); parse_early_param(); setup_memory_end(); setup_addressing_mode(); setup_memory(); setup_resources(); setup_lowcore(); cpu_init(); __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr; smp_setup_cpu_possible_map(); /* * Create kernel page tables and switch to virtual addressing. */ paging_init(); /* Setup default console */ conmode_default(); }
void main (uint32_t mboot_magic, uint32_t mboot_info) { multiboot_memmap_t *first_free; uint64_t *new_stack; asm volatile ("cli"); cpu_early_init(); x64_gdt_init(); x64_idt_init(); vga_console_init(); printk("\n================================\n"); printk("||==Welcome to CELLOS 64 bit==||"); printk("\n================================\n"); /* Read mboot header */ first_free = mboot_init(mboot_info, mboot_magic); if (first_free == NULL) { panic("No free memory for use! STOP~!\n"); } mb_parse_kernel_image(); paging_init(first_free->base_addr, first_free->base_addr + first_free->length); /* Init page allocator */ page_alloc_init(mem_get_low_addr(),mem_get_high_addr()); /* Initialize the memory pool */ init_memory_pool(CONFIG_KHEAP_SIZE, (void *)page_alloc_contig(CONFIG_KHEAP_SIZE/PAGE_SIZE)); detect_cpu(); acpi_init(); smp_init(); paging_late_init(); sched_core_init(); sched_init(); reschedule(); /* No reached */ }
void __init setup_arch(char **cmdline_p) { struct tag *tags = (struct tag *)&init_tags; char *from = default_command_line; setup_processor(); if(machine_arch_type == MACH_TYPE_A5K) machine_name = "A5000"; else if(machine_arch_type == MACH_TYPE_ARCHIMEDES) machine_name = "Archimedes"; else machine_name = "UNKNOWN"; //FIXME - the tag struct is always copied here but this is a block // of RAM that is accidentally reserved along with video RAM. perhaps // it would be a good idea to explicitly reserve this? tags = (struct tag *)0x0207c000; /* * If we have the old style parameters, convert them to * a tag list. */ if (tags->hdr.tag != ATAG_CORE) convert_to_tag_list(tags); if (tags->hdr.tag != ATAG_CORE) tags = (struct tag *)&init_tags; if (tags->hdr.tag == ATAG_CORE) { if (meminfo.nr_banks != 0) squash_mem_tags(tags); parse_tags(tags); } init_mm.start_code = (unsigned long) &_text; #ifndef CONFIG_XIP_KERNEL init_mm.end_code = (unsigned long) &_etext; #else init_mm.end_code = (unsigned long) &_endtext; init_mm.start_data = (unsigned long) &_sdata; #endif init_mm.end_data = (unsigned long) &_edata; init_mm.brk = (unsigned long) &_end; memcpy(boot_command_line, from, COMMAND_LINE_SIZE); boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; parse_cmdline(&meminfo, cmdline_p, from); bootmem_init(&meminfo); paging_init(&meminfo); request_standard_resources(&meminfo); #ifdef CONFIG_VT #if defined(CONFIG_DUMMY_CONSOLE) conswitchp = &dummy_con; #endif #endif }
t_error ia32_region_init(t_vaddr start, t_vsize size) { REGION_ENTER(region); if (paging_init() != ERROR_NONE) REGION_LEAVE(region, ERROR_UNKNOWN); REGION_LEAVE(region, ERROR_NONE); }
static void init_early(unsigned int cpu_id) { struct jailhouse_memory hv_page; unsigned long core_percpu_size; master_cpu_id = cpu_id; arch_dbg_write_init(); printk("\nInitializing Jailhouse hypervisor %s on CPU %d\n", JAILHOUSE_VERSION, cpu_id); printk("Code location: %p\n", __text_start); error = paging_init(); if (error) return; root_cell.config = &system_config->root_cell; error = check_mem_regions(&system_config->root_cell); if (error) return; root_cell.id = -1; error = cell_init(&root_cell); if (error) return; error = arch_init_early(); if (error) return; /* * Back the region of the hypervisor core and per-CPU page with empty * pages for Linux. This allows to fault-in the hypervisor region into * Linux' page table before shutdown without triggering violations. */ hv_page.phys_start = page_map_hvirt2phys(empty_page); hv_page.virt_start = page_map_hvirt2phys(&hypervisor_header); hv_page.size = PAGE_SIZE; hv_page.flags = JAILHOUSE_MEM_READ; core_percpu_size = PAGE_ALIGN(hypervisor_header.core_size) + hypervisor_header.possible_cpus * sizeof(struct per_cpu); while (core_percpu_size > 0) { error = arch_map_memory_region(&root_cell, &hv_page); if (error) return; core_percpu_size -= PAGE_SIZE; hv_page.virt_start += PAGE_SIZE; } page_map_dump_stats("after early setup"); printk("Initializing processors:\n"); }
void __init setup_arch(char **cmdline_p) { randomize_va_space = 0; *cmdline_p = command_line; cpu_cache_init(); tlb_init(); bootmem_init(); paging_init(); resource_init(); }
void __init setup_arch(char **cmdline_p) { stack_protections((unsigned long) &init_thread_info); setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); mem_total_pages(physmem_size, iomem_size, highmem); read_initrd(); paging_init(); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; setup_hostinfo(host_info, sizeof host_info); }
void init(struct multiboot *mb) { size_t i; for(i=0;i<TEXT_HEIGHT*TEXT_WIDTH*2;i++) { *(((char *)TEXT_BUFFER)+i)=0; } text_pos=0; printk("benaryOS booted"); if(mb->mbs_cmdline) { printk(" with cmdline \"%s\"",(char *)mb->mbs_cmdline); } putchar('\n'); hardware_detection(); //Physical Memory Management printk("initialise PMM\n"); pmm_init(mb); //Global Descriptor Table printk("loading GDT\n"); gdt_init(); //Programmable Interrupt Timer printk("initialise PIT\n"); pit_init(100); //Programmable Interrupt Controller printk("initialise PIC\n"); pic_init(); //Interrupt Descriptor Table printk("initialise IDT\n"); idt_init(); //Paging printk("initialise Paging\n"); paging_init(mb); //Modules printk("loading modules(%d)\n",mb->mbs_mods_count); modules_init(mb); printk("benaryOS running\n"); printk("starting first task now\n"); asm volatile("sti"); //find_com(); //this will forget our thread asm volatile("int $0x20"); }
/* * Called into from start_kernel, after lock_kernel has been called. * Initializes bootmem, which is unsed to manage page allocation until * mem_init is called. */ void __init setup_arch(char **cmdline_p) { ppc64_boot_msg(0x12, "Setup Arch"); *cmdline_p = cmd_line; /* * Set cache line size based on type of cpu as a default. * Systems with OF can look in the properties on the cpu node(s) * for a possibly more accurate value. */ dcache_bsize = ppc64_caches.dline_size; icache_bsize = ppc64_caches.iline_size; /* reboot on panic */ panic_timeout = 180; if (ppc_md.panic) setup_panic(); init_mm.start_code = (unsigned long)_stext; init_mm.end_code = (unsigned long) _etext; init_mm.end_data = (unsigned long) _edata; init_mm.brk = klimit; irqstack_early_init(); exc_lvl_early_init(); emergency_stack_init(); #ifdef CONFIG_PPC_STD_MMU_64 stabs_alloc(); #endif /* set up the bootmem stuff with available memory */ do_init_bootmem(); sparse_init(); #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif if (ppc_md.setup_arch) ppc_md.setup_arch(); paging_init(); /* Initialize the MMU context management stuff */ mmu_context_init(); ppc64_boot_msg(0x15, "Setup Done"); }
void __init setup_arch(char **cmdline_p) { unsigned long max_low_pfn; config_BSP(&command_line[0], COMMAND_LINE_SIZE); /* detect System on Chip parameters */ detect_soc(); /* process 1's initial memory region is the kernel code/data */ init_mm.start_code = (unsigned long) &_stext; init_mm.end_code = (unsigned long) &_etext; init_mm.end_data = (unsigned long) &_edata; init_mm.brk = (unsigned long) &_end; #ifdef CONFIG_BLK_DEV_INITRD initrd_start = (unsigned long)&__initrd_start; initrd_end = (unsigned long)&__initrd_end; #endif /* setup bootmem allocator */ max_low_pfn = setup_memory(); /* paging_init() sets up the MMU and marks all pages as reserved */ paging_init(); #ifdef CONFIG_SERIAL_8250_CONSOLE // early_serial_console_init(command_line); RGD setup_early_serial8250_console(command_line); #endif #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) if(!conswitchp) conswitchp = &dummy_con; #endif *cmdline_p = command_line; /* Save command line copy for /proc/cmdline RGD removed 2.6.21*/ //memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); //saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; /* fire up 8051 */ // printk("Starting 8051...\n"); // oc8051_init(); #ifndef CONFIG_OR32_ANONYMOUS printk("Linux/or32 port 2003-2005 OpenCores <*****@*****.**>\n"); #endif /* CONFIG_OR32_ANONYMOUS */ }
int main() { paging_init(); print("VM init. I don't know WHY, but it's working so don't change this shit!\n",2,0); print("Kernel Loaded\n",3, 0); memset(idt_entries, 0, sizeof(struct idt_entry) * 256); idt_init(idt_entries, &idt_table); asm("int $0x80\n"); for(;;); }