summaryrefslogtreecommitdiff
path: root/i386
AgeCommit message (Collapse)Author
2016-01-23Use vm_page as the physical memory allocatorRichard Braun
This change replaces the historical page allocator with a buddy allocator implemented in vm/vm_page.c. This allocator allows easy contiguous allocations and also manages memory inside segments. In a future change, these segments will be used to service requests with special constraints, such as "usable for 16-bits DMA" or "must be part of the direct physical mapping". * Makefrag.am (libkernel_a_SOURCES): Add vm/vm_page.c. * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386at/biosmem.{c,h}. * i386/i386/vm_param.h: Include kern/macros.h. (VM_PAGE_DMA_LIMIT, VM_PAGE_MAX_SEGS, VM_PAGE_DMA32_LIMIT, VM_PAGE_DIRECTMAP_LIMIT, VM_PAGE_HIGHMEM_LIMIT, VM_PAGE_SEG_DMA, VM_PAGE_SEG_DMA32, VM_PAGE_SEG_DIRECTMAP, VM_PAGE_SEG_HIGHMEM): New macros. * i386/i386at/model_dep.c: Include i386at/biosmem.h. (avail_next, avail_remaining): Remove variables. (mem_size_init): Remove function. (i386at_init): Initialize and use the biosmem module for early physical memory management. (pmap_free_pages): Return phys_last_addr instead of avail_remaining. (init_alloc_aligned): Turn into a wrapper for biosmem_bootalloc. (pmap_grab_page): Directly call init_alloc_aligned instead of pmap_next_page. * i386/include/mach/i386/vm_types.h (phys_addr_t): New type. * kern/bootstrap.c (free_bootstrap_pages): New function. (bootstrap_create): Call free_bootstrap_pages instead of vm_page_create. * kern/cpu_number.h (CPU_L1_SIZE): New macro. * kern/slab.h: Include kern/cpu_number.h. (CPU_L1_SIZE): Remove macro, moved to kern/cpu_number.h. * kern/startup.c (setup_main): Change the value of machine_info.memory_size. * linux/dev/glue/glue.h (alloc_contig_mem, free_contig_mem): Update prototypes. * linux/dev/glue/kmem.c (linux_kmem_init): Don't use defunct page queue. * linux/dev/init/main.c (linux_init): Don't free unused memory. (alloc_contig_mem, free_contig_mem): Turn into wrappers for the vm_page allocator. * linux/pcmcia-cs/glue/ds.c (PAGE_SHIFT): Don't undefine. * vm/pmap.h (pmap_startup, pmap_next_page): Remove prototypes. * vm/vm_fault.c (vm_fault_page): Update calls to vm_page_convert. * vm/vm_init.c (vm_mem_init): Call vm_page_info_all. * vm/vm_object.c (vm_object_page_map): Update call to vm_page_init. * vm/vm_page.h (vm_page_queue_free): Remove variable declaration. (vm_page_create, vm_page_release_fictitious, vm_page_release): Remove declarations. (vm_page_convert, vm_page_init): Update prototypes. (vm_page_grab_contig, vm_page_free_contig): New prototypes. * vm/vm_resident.c (vm_page_template, vm_page_queue_free, vm_page_big_pagenum): Remove variables. (vm_page_bootstrap): Update and call vm_page_setup. (pmap_steal_memory): Update and call vm_page_bootalloc. (pmap_startup, vm_page_create, vm_page_grab_contiguous_pages): Remove functions. (vm_page_init_template, vm_page_grab_contig, vm_page_free_contig): New functions. (vm_page_init): Update and call vm_page_init_template. (vm_page_release_fictitious): Make static. (vm_page_more_fictitious): Update call to vm_page_init. (vm_page_convert): Rewrite to comply with vm_page. (vm_page_grab): Update and call vm_page_alloc_pa. (vm_page_release): Update and call vm_page_free_pa.
2016-01-23Import the biosmem module from X15 and relicense to GPLv2+Richard Braun
* i386/i386at/biosmem.c: New file. * i386/i386at/biosmem.h: Likewise.
2016-01-23Import the multiboot module from X15 and relicense to GPLv2+Richard Braun
* i386/include/mach/i386/multiboot.h: Merge multiboot.h from X15.
2016-01-23Import the elf module from X15 and relicense to GPLv2+Richard Braun
* i386/i386at/elf.h: New file.
2016-01-13Increase kernel map sizeSamuel Thibault
To avoid running out of memory due to the increased consumption by radix trees which replaced arrays. * kern/slab.c (KMEM_MAP_SIZE): Bump from 96MiB to 128MiB. * i386/i386/vm_param.h (VM_KERNEL_MAP_SIZE): Add 32MiB accordingly.
2016-01-02fix t_addr assignment in lpropenFlavio Cruz
* i386/i386at/lpr.c (lpropen): Fix assignment to t_addr.
2016-01-01remove unnused disk code and headersFlavio Cruz
* i386/Makefrag.am: Remove disk.h. * i386/i386at/disk.h: Remove unnused definitions. * i386/include/mach/i386/disk.h: Remove. * linux/dev/glue/block.c (device_get_status): Remove V_GETPARMS case.
2016-01-01fix some compiler warnings in gnumachFlavio Cruz
* linux/dev/glue/block.c (out): Cast to device_t. * linux/dev/init/main.c (alloc_contig_mem): Initialize addr and cast return value to void *. * i386/i386/phys.c (pmap_copy_page): Initialize src_map. * i386/intel/pmap.c: Include i386at/model_dep.h. * kern/mach_clock.c (mapable_time_init): Cast to void *.
2015-12-11Fix boot under kvm in linux 4.3Samuel Thibault
* i386/i386/locore.S (discover_x86_cpu_type): Disable Cyrix CPU discovery.
2015-11-27Fix boundSamuel Thibault
* i386/i386at/lpr.c (lprprobe): Fix checking unit against NLPR.
2015-09-27i386: trace syscalls of a single taskJustus Winter
* i386/i386/debug_i386.c (syscall_trace_task): New variable. (syscall_trace_print): If set, trace only syscalls from this task.
2015-09-27i386: improve syscall tracingJustus Winter
* kern/syscall_sw.h (mach_trap_t): Turn unused field into `mach_trap_name'. (MACH_TRAP, MACH_TRAP_STACK): Record name. * i386/i386/debug_i386.c (syscall_trace_print): Use the name and format the arguments to look like c.
2015-09-27Fix build with -DDEBUGJustus Winter
* device/cirbuf.c: Add missing include. * i386/i386/debug.h (dump_ss): Hide declaration from assembler. * i386/i386/debug_i386.c: Fix include. * kern/sched_prim.h: Add missing include, fix declaration.
2015-08-31Reserve 64k at beginning of memory, not just 4kSamuel Thibault
Linux does this to be extra careful with some BIOSes which apparently spuriously write between 4k and 64k. * i386/i386at/model_dep.c (RESERVED_BIOS): New macro. (avail_next, mem_size_init, init_alloc_aligned): Use RESERVED_BIOS instead of hardcoded 0x1000.
2015-08-30Fix printk not handling ANSI escape codesJames Clarke
* i386/i386at/kd.c (kdstart): Moved escape sequence handling to new kd_putc_esc function. (kd_putc_esc): New function with logic from kdstart. (kdcnputc): Call kd_putc_esc rather than kd_putc to allow for ANSI escape codes. * i386/i386at/kd.h (kd_putc_esc): New function.
2015-08-20i386: enable assertionsJustus Winter
* i386/intel/pmap.c (pmap_page_protect): Enable assertions. (phys_attribute_clear, phys_attribute_test): Likewise.
2015-08-18i386: fix panic messageJustus Winter
* i386/intel/pmap.c (pmap_page_protect): Fix function name in panic message.
2015-07-15i386: fix typoJustus Winter
* i386/intel/pmap.c: Fix typo.
2015-07-09i386: fix line wrapping in the immediate consoleJustus Winter
* i386/i386at/immc.c (immc_cnputc): Fix line wrapping.
2015-06-28i386: improve the immediate consoleJustus Winter
Improve the immediate console to the point that it can be enabled and display e.g. assertion failures from very early on (i.e. from `c_boot_entry'). * device/cons.h (romgetc, romputc): New declarations. * i386/configfrag.ac: Add configuration variable. * i386/i386at/conf.c (dev_name_list): Add entry. * i386/i386at/cons_conf.c (constab): Add entry. * i386/i386at/immc.c: Add missing includes. (immc_cnprobe, immc_cninit, immc_cngetc, immc_romputc): New functions. (immc_cnputc): Fix signature, use virtual addresses. * i386/i386at/immc.h: New file. * i386/i386at/kd.c: Use `#if ENABLE_IMMEDIATE_CONSOLE'. * i386/i386at/kd.h (kd_setpos): Add missing declaration. * i386/i386at/model_dep.c (c_boot_entry): Install immediate console as early boot console.
2015-06-26i386: add commentJustus Winter
* i386/i386at/model_dep.c (rebootflag): Explain flag.
2015-05-23i386: avoid breaking the strict-aliasing rulesJustus Winter
* i386/i386/pcb.c (switch_ktss): Cleanly convert the value.
2015-05-19kern: import `macros.h' from x15Justus Winter
Import the macro definitions from the x15 kernel project, and replace all similar definitions littered all over the place with it. Importing this file will make importing code from the x15 kernel easier. We are already using the red-black tree implementation and the slab allocator from it, and we will import even more code in the near future. * kern/list.h: Do not define `structof', include `macros.h' instead. * kern/rbtree.h: Likewise. * kern/slab.c: Do not define `ARRAY_SIZE', include `macros.h' instead. * i386/grub/misc.h: Likewise. * i386/i386/xen.h: Do not define `barrier', include `macros.h' instead. * kern/macro_help.h: Delete file. Replaced by `macros.h'. * kern/macros.h: New file. * Makefrag.am (libkernel_a_SOURCES): Add new file, remove old file. * device/dev_master.h: Adopt accordingly. * device/io_req.h: Likewise. * device/net_io.h: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_mqueue.h: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_space.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * kern/assert.h: Likewise. * kern/ast.h: Likewise. * kern/pc_sample.h: Likewise. * kern/refcount.h: Likewise. * kern/sched.h: Likewise. * kern/sched_prim.c: Likewise. * kern/timer.c: Likewise. * kern/timer.h: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_map.h: Likewise. * vm/vm_object.h: Likewise. * vm/vm_page.h: Likewise.
2015-05-17i386: avoid compiler warningJustus Winter
* i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys, copy_from_phys): Avoid compiler warning about `map' being used uninitialized.
2015-05-14i386: use macro to compute address of saved registersJustus Winter
* i386/i386/pcb.c (stack_attach): Use `USER_REGS'. (stack_handoff): Likewise.
2015-05-02Fix warningSamuel Thibault
* i386/i386at/rtc.c (rtcget, rtcput): Make functions take an rtc_st structure which it casts to char * itself.
2015-04-23Prepend 0x to hexadecimal offsetSamuel Thibault
* i386/i386/db_trace.c (db_i386_stack_trace): Prepend 0x to hexadecimal offset.
2015-03-08Remove spl debugging in Xen caseSamuel Thibault
xen cli/sti doesn't use IF * i386/i386/spl.S [MACH_XEN]: Disable IF check.
2015-02-26Use printf_once instead of recoding itSamuel Thibault
* i386/i386at/kd_event.c: Call printf_once instead of recoding it. * i386/i386at/kd_mouse.c: Likewise.
2015-02-26Limit printing "queue full" messagesSamuel Thibault
* i386/i386at/kd_event.c (kbd_enqueue): Print "queue full" warning only once. * i386/i386at/kd_mouse.c (mouse_enqueue): Likewise.
2015-02-20i386: specialize `copyinmsg' and `copyoutmsg'Justus Winter
Previously, `copyinmsg' was the same function as `copyin'. The former is for messages, and the size of messages is a multiple of four. Likewise for `copyoutmsg'. Provide a specialized version of both functions. This shaves off a couple of instructions and improves our IPC performance. * i386/i386/locore.S (copyinmsg): New function. (copyoutmsg): New function.
2015-02-20i386: drop needless instruction from `copyout'Justus Winter
* i386/i386/locore.S (copyout): Do not needlessly copy length to %eax first.
2015-01-02i386: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02Handle kernel traps happening before starting userlandSamuel Thibault
* i386/i386/trap.c (kernel_trap): When current_thread is null, assume that we are in kernel land.
2014-12-15Make spl7 just clear IF instead of setting the PIC maskSamuel Thibault
* i386/i386/spl.S (spl7): Just set curr_ipl and cli. (splx) [MACH_KDB || MACH_TTD]: When curr_ipl is 7, make sure that IF is cleared. (splx): When staying at ipl7, do not enable interrupts. (spl) [MACH_KDB || MACH_TTD]: When curr_ipl is 7, make sure that IF is cleared. (spl): When new ipl is 7, branch to spl7. * i386/i386/locore.S (TIME_TRAP_UENTRY, TIME_TRAP_SENTRY): Save flags, and restore them instead of blindly using sti.
2014-11-16Only set debug registers when they are usedSamuel Thibault
* i386/i386/db_interface.c (zero_dr): New variable (db_load_context): Do not set debug registers to zero when they are already zero. (db_dr): When kernel debug registers get zero, record that the debug registers have been zeroed.
2014-09-17ddb: add support for ELF symbol tablesJustus Winter
* ddb/db_elf.c: New file. * ddb/db_elf.h: Likewise. * Makefrag.am (libkernel_a_SOURCES): Add db_elf.{c,h}. * ddb/db_sym.c (dummy_db_sym_init): New stub db_sym_init function. (db_sym_switch): Add ELF functions. * ddb/db_sym.h (SYMTAB_ELF): New macro. (elf_db_sym_init): New declaration. * i386/i386at/model_dep.c (c_boot_entry): Get ELF section header information from the multiboot structure, and call elf_db_sym_init.
2014-09-17Report DR6 to userlandSamuel Thibault
* i386/i386/trap.c (user_trap): On T_DEBUG, record the content of dr6 in PCB, and clear it.
2014-08-22Fix computationSamuel Thibault
* i386/i386at/com.c (comintr): Fix computation of '@'.
2014-08-22Even less magic-looking control valueNeal H. Walfield
* i386/i386at/com.c (comintr): Use 'A'-1 instead of '@'.
2014-08-22Support invoking the debugger over the serial consoleJustus Winter
* i386/i386at/com.c (comintr): Invoke the debugger if ctrl-alt-d is pressed. * i386/i386at/com.h (kdb_kintr): Add declaration.
2014-07-25Drop debugging printsSamuel Thibault
* i386/i386at/acpi.c (grub_machine_acpi_get_rsdpv2): Drop debugging prints.
2014-07-06Do not unmap page 0 when not neededSamuel Thibault
Since we need it to access some BIOS information, e.g. at ACPI shutdown. When the kernel VM is not starting at 0, there is already nothing mapped there in user tasks, anyway. * i386/i386at/model_dep.c (machine_init) [VM_MIN_KERNEL_ADDRESS != 0]: Do not call pmap_unmap_page_zero. * i386/intel/pmap.c (pmap_unmap_page_zero): Warn that unmapping page zero may break some BIOS functions.
2014-07-06Document that io_map_cached leaks memorySamuel Thibault
2014-07-06Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumachSamuel Thibault
2014-07-06i386: use ACPI to power off the machineJustus Winter
This is a mostly verbatim copy of acpihalt.c from GRUB2 with a little bit of glue code. * i386/Makefrag.am (libkernel_a_SOURCES): Add the new files. * i386/grub/acpi.h: Verbatim copy from GRUB2. * i386/grub/compiler.h: Likewise. * i386/grub/cpu/io.h: Likewise. * i386/grub/cpu/time.h: Likewise. * i386/grub/cpu/types.h: Likewise. * i386/grub/err.h: Likewise. * i386/grub/misc.h: Likewise. * i386/grub/mm.h: Likewise. * i386/grub/symbol.h: Likewise. * i386/grub/time.h: Likewise. * i386/grub/types.h: Likewise. * i386/i386at/acpi.c: Likewise. * i386/i386at/acpihalt.c: Likewise. (grub_acpi_halt): Map physical addresses. * i386/i386at/acpihalt.h: New file. * i386/grub/glue.h: Some glue macros. * i386/grub/i18n.h: Stub out i18n. * i386/i386at/grub_glue.c: Some glue code. * i386/i386at/model_dep.c (halt_all_cpus): Use grub_acpi_halt.
2014-07-06i386: add io_map_cachedJustus Winter
io_map_cached is like io_map, but reuses the old mapping if it is applicable. * i386/i386/io_map.c: Add io_map_cached.
2014-06-11i386: remap some keysJustus Winter
As a convenience for the nice people using our debugger, remap some keys to the readline-like shortcuts supported by dde. * i386/i386at/kd.c (kdcnmaygetc): Remap some keys.
2014-06-11i386: reformat the key mapJustus Winter
* i386/i386at/kd.c (key_map): Remove superfluous newlines so that every entry fits into one line. This way line numbers can be used as an index into the map.
2014-06-11ddb: print task names if availableJustus Winter
* ddb/db_print.c (db_print_task): Print task name if available. * i386/i386/db_interface.c (db_task_name): Likewise. * i386/i386/db_machdep.h (DB_GNUMACH_TASK_NAME): Remove unused definition.