summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-12-21IDE disk drives with unusual C/H/S.Thomas Schwinge
* linux/src/drivers/block/ide.c: Partially update to Linux 2.0.40 code.
2012-12-05Fix kernel task creation timeRichard Braun
The mapable_time_init function is called before machine_init, but the latter sets the system boot time. Fix their calling order. * kern/startup.c (setup_main): Call machine_init before mapable_time_init.
2012-12-04Strongly reduce risks of name capture in rbtree macrosRichard Braun
* kern/rbtree.h (rbtree_lookup): Prefix local variable names with three underscores. (rbtree_lookup_nearest): Likewise. (rbtree_insert): Likewise. (rbtree_lookup_slot): Likewise. (rbtree_insert_slot): Rewrite as an inline function.
2012-11-20Fix calls to vm_map when size is 0Richard Braun
* vm/vm_map.c (vm_map_enter): return KERN_INVALID_ARGUMENT if size is 0. * vm/vm_user.c (vm_map): Likewise.
2012-11-19Fix compilation error with older versions of GCCMatthew Leach
Some versions of GCC will error if you define a type twice (even if the definition is the same). The NCR53C8XX SCSI driver defines 'vm_offset_t', this is also defined in vm_types.h and will therefore cause a compilation error depending on the GCC version. * linux/src/drivers/scsi/ncr53c8xx.c [!MACH] (vm_offset_t, vm_size_t): Don't define types.
2012-09-23Fix gnumach_server_routine prototypeSamuel Thibault
* kern/ipc_kobject.c (ipc_kobject_server): Set gnumach_server_routine prototype to mig_routine_t.
2012-09-23Add missing file for page statisticsRichard Braun
* kern/gnumach.srv: New file.
2012-09-23Add missing file for page statisticsRichard Braun
* include/mach/vm_cache_statistics.h: New file
2012-09-23Fix panic on irq >= 16Gianluca Guida
* linux/src/drivers/net/pci-scan.c (pci_drv_register): Skip device if we are getting an invalid IRQ >= 16 and different from 255 (it happens in some motherboard).
2012-09-23Update DMA auto-enabling, make forcing DMA an optionSergio Lopez
* linux/configfrag.ac (--enable-ide-forcedma): Add option. * linux/src/drivers/block/ide.c (ide_probe_promise_20246): Do not call ide_init_promise. (probe_for_hwifs): Add SI, VIA, AL PCI probing. * linux/src/drivers/block/ide.h (hwif_chipset_t): Add hpt343, udma and ultra66 chipsets. * linux/src/drivers/block/triton.c: Update to upstream 1.14 version. * linux/src/include/linux/hdreg.h (HDIO_GET_IDENTITY): Rename to ... (HDIO_OBSOLETE_IDENTITY): ... new macro. (HDIO_GET_IDENTITY): New macro. (hd_driveid): Add fields for extended identification.
2012-09-23Fix CDROM door unlock on closure without device_closeAlexey Dejneka
* linux/dev/glue/block.c (device_open): Properly return devp on multiple opens. (device_close_forced): Renamed from device_close, when force parameter is 1, do not wait for open_count to become 0 before closing. (device_close): New function. (device_no_senders): New function. linux_block_emulation_ops: Use (device_no_senders).
2012-09-23Provide basic page cache statisticsRichard Braun
* Makefrag.am (EXTRA_DIST): Add kern/gnumach.srv. (include_mach_HEADERS): Add include/mach/gnumach.defs and include/mach/vm_cache_statistics.h (nodist_libkernel_a_SOURCES): Add kern/gnumach.server.defs.c, kern/gnumach.server.h, kern/gnumach.server.c, kern/gnumach.server.msgids, kern/gnumach.server.defs. * include/mach/mach_types.h: Add #include <mach/vm_cache_statistics.h>. * kern/ipc_kobject.c (ipc_kobject_server): Declare and call gnumach_server_routine. * vm/vm_object.c (vm_object_cached_pages): New variable. (vm_object_cached_pages_lock_data): Likewise. (vm_object_deallocate): Update number of cached pages. (vm_object_lookup): Likewise. (vm_object_lookup_name): Likewise. (vm_object_destroy): Likewise. (vm_object_enter): Likewise. * vm/vm_object.h (ref_count): Declare as int. (resident_page_count): Likewise. (vm_object_cached_count): Add extern declaration. (vm_object_cached_pages): Likewise. (vm_object_cached_pages_lock_data): Likewise. (vm_object_cached_pages_update): New macro. * vm/vm_resident.c (vm_page_insert): Assert resident page count doesn't overflow, update number of cached pages as appropriate. (vm_page_replace): Likewise. (vm_page_remove): Update number of cached pages as appropriate. * vm/vm_user.c: Add #include <mach/vm_cache_statistics.h>. (vm_cache_statistics): New function. * vm/vm_user.h: Add #include <mach/mach_types.h>. (vm_cache_statistics): New declaration. * include/mach/gnumach.defs: New file.
2012-08-24Store threads waiting on a message queue in LIFO orderRichard Braun
* ipc/ipc_thread.h (ipc_thread_enqueue_macro): Insert thread at the head of the list instead of the tail.
2012-07-14Fix Xen boot at linear address 0xC0000000Samuel Thibault
* i386/intel/pmap.c (pmap_bootstrap): Interate over linear addresses and compute l3 and l2 offsets from it instead of assuming nul l3 offset.
2012-07-08Fix slab collection timingRichard Braun
The slab garbage collector uses sched_tick as its time reference, which is increased every seconds, while the interval is expressed in clock ticks. Use the proper time reference instead. * kern/slab.c (kmem_gc_last_tick): Declare as unsigned long. (slab_collect): Use elapsed_ticks instead of sched_tick.
2012-07-07Increase the slab collection intervalRichard Braun
* kern/slab.c (KMEM_GC_INTERVAL): Increase to 5 seconds.
2012-07-07Allocate kernel thread stacks out of kmem_mapRichard Braun
The kernel submaps eat most of the available kernel space. Using the main kernel map for thread stacks sometimes lead to exhaustion when many threads are created. Use kmem_map instead to increase this limit. * kern/thread.c (stack_alloc): Use kmem_map instead of kernel_map for stack allocation. (stack_collect): Likewise for release.
2012-07-07Merge kalloc_map into kmem_mapRichard Braun
* ipc/ipc_table.c: Add #include <kern/slab.h>. (ipc_table_alloc): Use kmem_map instead of kalloc_map when allocating a table. (ipc_table_realloc): Likewise for reallocation. (ipc_table_free): Likewise for release. * kern/kalloc.h (kalloc_map): Remove declaration. * kern/slab.c (KMEM_MAP_SIZE): Increase to 128 MiB. (KALLOC_MAP_SIZE): Remove macro. (kalloc_map_store): Remove variable. (kalloc_map): Likewise. (kalloc_pagealloc): Use kmem_map instead of kalloc_map for general purpose allocations. (kalloc_pagefree): Likewise. (kalloc_init): Remove the creation of kalloc_map.
2012-06-10Permit to select/deselect whole driver groupsSamuel Thibault
* linux/configfrag.ac (AC_OPTION_Linux_group): New function (AC_OPTION_Linux_ix86_at): Do not enable driver by default if the group was explicitly disabled. (scsi, net, pcmcia, wireless): Define groups.
2012-05-17Offset bios32 entrySamuel Thibault
* linux/src/arch/i386/kernel/bios32.c (check_pcibios, pcibios_init): Convert physical bios32 entry address to kernel virtual address.
2012-05-17Clear direction flag after bios32 callSamuel Thibault
Linux does this, there are probably wild BIOSes out there. * linux/src/arch/i386/kernel/bios32.c (bios32_service, check_pcibios, pci_bios_find_class, pci_bios_find_device, pci_bios_read_config_byte, pci_bios_read_config_word, pci_bios_read_config_dword, pci_bios_write_config_byte, pci_bios_write_config_word, pci_bios_write_config_dword): Clear direction flag after lcall to bios32.
2012-05-05Offset kernel addresses by 3GiBSamuel Thibault
This permits better trace support in kdb. * i386/i386/vm_param.h (VM_MIN_KERNEL_ADDRESS): Set to 0xC0000000 * i386/Makefrag.am (_START): Set to 0xC0100000.
2012-05-05Document how to offset the kernel to get better debuggingSamuel Thibault
* i386/i386/vm_param.h (VM_MIN_KERNEL_ADDRESS): Document that it can be changed, but _START has to be offset too. (INIT_VM_MIN_KERNEL_ADDRESS): Document that it should remain 0.
2012-04-27Augment VM maps with a red-black treeRichard Braun
* vm/vm_map.c: Add #include <kern/rbtree.h>. (vm_map_setup): Initialize the map red-black tree. (vm_map_entry_cmp_lookup): New function. (vm_map_entry_cmp_insert): Likewise. (_vm_map_entry_link): Insert map entry in the red-black tree. (_vm_map_entry_unlink): Remove map entry from the red-black tree. (vm_map_lookup_entry): Rework the way the VM map hint is used, and replace the linear search with a binary search tree lookup. (vm_map_copy_insert): Move map entries from the map copy tree to the destination map tree. (vm_map_copyin): Initialize the map copy red-black tree. * vm/vm_map.h: Add #include <kern/rbtree.h>. (vm_map_entry): Add `tree_node' member. (vm_map_header): Add `tree' member.
2012-04-22Update comments.Richard Braun
Literature about red-black trees vary concerning the cases numbering, and the implementation doesn't make all of them clearly appear. Remove cases numbering references to avoid confusion.
2012-04-22Fix copyright assignmentRichard Braun
Maksym and I have assigned copyright to the Free Software Foundation. In addition, restore the original upstream copyrights for correctness. * kern/list.h: Fix copyright assignment. * kern/rbtree.c: Likewise. * kern/rbtree.h: Likewise. * kern/rbtree_i.h: Likewise. * kern/slab.c: Likewise. * kern/slab.h: Likewise.
2012-04-06Check hyp_stack_switch returnSamuel Thibault
* i386/i386/pcb.c (switch_ktss): Check value returned by hyp_stack_switch.
2012-04-06Fix integer typeSamuel Thibault
* kern/thread.c (host_stack_usage): Set `total' type to natural_t.
2012-04-06Do not take address of va_list variableSamuel Thibault
This breaks on x86_64, where it is an array and thus gets bogus results. * ddb/db_output.c (db_printf, kdbprintf): Pass copy of va_list variable instead of its address. * kern/debug.c (panic, log): Likewise. * kern/printf.c (vprintf, iprintf, sprintf, vsnprintf): Likewise. (_doprnt): Take va_list instead of va_list *, fix usage and comment accordingly. * kern/printf.h (_doprnt): Take va_list instead of va_list *.
2012-03-24Fix Xen boot after c74adfeSamuel Thibault
* i386/Makefrag.am (_START_MAP): Define symbol to 0x100000. * i386/xen/Makefrag.am (_START_MAP): Define symbol to 0xC0000000. * i386/ldscript: Use _START_MAP instead of hardcoding 0x100000.
2012-03-24Relocate kernel at bootupSamuel Thibault
Grub is not able to map us at high addresses. We can however make it load us at low addresses (through the linker script mapping), then use segmentation to move ourselves to high addresses, and switch to C which uses high addresses (through _START definition). * i386/ldscript: Force mapping kernel at 0x100000, regardless of the value of _START. * i386/i386at/boothdr.S (boot_entry): Set up initial segments to project the bootstrap linear space to high addresses.
2012-03-24Make sure BIOS area is mapped in kernel threadsSamuel Thibault
* i386/i386at/model_dep.c (i386at_init): Map BIOS memory at 0. * i386/intel/pmap.c (pmap_create): Do not map BIOS memory in user tasks.
2012-03-24Separate INIT_VM_MIN_KERNEL_ADDRESS from VM_MIN_KERNEL_ADDRESSSamuel Thibault
The former is the initial value set by the bootloader. It may not be the same as what Mach will set up. * i386/i386/vm_param.h (INIT_VM_MIN_KERNEL_ADDRESS): New macro. * i386/i386at/model_dep.c (i386at_init): Use INIT_VM_MIN_KERNEL_ADDRESS instead of VM_MIN_KERNEL_ADDRESS.
2012-03-24Add missing phystokv/kvtophys callsSamuel Thibault
* i386/i386/vm_param.h [!MACH_XEN]: Do not include <xen/public/xen.h>. * i386/i386at/model_dep.c (init_alloc_aligned): Use phystokv to compare physical memory addresses with kernel start, end, and symbol table. * i386/intel/pmap.c (pmap_enter): Use kvtophys to convert ptp pointer to pte entry. * linux/dev/init/main.c (alloc_contig_mem, linux_init): Use phystokv to convert allocated pages to virtual pointer. * linux/src/include/asm-i386/io.h: Include <machine/vm_param.h>. (virt_to_phys): Call _kvtophys. (phys_to_virt): Call phystokv. * linux/src/include/linux/compatmac.h: Include <asm/io.h>. (ioremap): Use phys_to_virt to convert physical address to virtual pointer. (my_iounmap): Likewise. * linux/dev/include/asm-i386/page.h: Include <mach/vm_param.h>. (PAGE_SHIFT, PAGE_SIZE, PAGE_MASK): Remove macros. * linux/src/drivers/scsi/ncr53c8xx.c (vm_size_t): Remove type. * linux/dev/glue/net.c: Include <machine/vm_param.h> (device_write): Call phystokv to convert from physical page address to virtual pointer. * linux/dev/glue/block.c (alloc_buffer, free_buffer, rdwr_full): Likewise.
2012-03-24Fix issig crash at bootSamuel Thibault
* linux/dev/glue/misc.c (issig): Return 0 if current_thread() is NULL.
2012-03-24Fix wrap-around in pmap bootstrapSamuel Thibault
* i386/intel/pmap.c (pmap_bootstrap): Check against `va' wrap around 0xffffffff.
2012-03-23Fix boot with big values of _startSamuel Thibault
When _start is not close to 0, just using init_alloc_aligned() is not enough to know how much should be duplicated between linear and virtual mappings. Just mapping everything that can be is not very costly and should just work when it can work. * i386/i386at/model_dep.c (i386at_init) [VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS]: Extend `nb_direct' to VM_MIN_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS.
2012-03-22Refer to `PFN_LIST' on Xen only.Ludovic Courtès
* i386/i386/i386asm.sym (PFN_LIST): Enclose in #ifdef MACH_XEN. Thanks to Samuel Thibault for the suggestion.
2012-03-20Use long typesSamuel Thibault
* ddb/db_examine.c (db_xcdump): Do not cast addr before passing to db_read_bytes. * ddb/db_macro.c (db_arg_variable): Return long. * ddb/db_macro.h (db_arg_variable): Likewise. * ddb/db_sym.c (db_maxoff): Set type to unsigned long. * ddb/db_task_thread.c (db_set_default_thread, db_get_task_thread): Return long. * ddb/db_variables.h (db_variable): Make fcn function field to return long. (FCN_NULL): Make function type return long. * i386/i386/db_interface.c (int_regs): Set field sizes to long. * i386/i386/db_machdep.h (db_expr_t): Set type to long. * i386/i386/db_trace.c (db_i386_reg_value): Return long. Use long types. (i386_frame, i386_kregs, interrupt_frame, db_nextframe): Set field sizes to long. (db_regs, i386_kregs): Use long * pointers. (db_lookup_i386_kreg): Return long *. (db_numargs, db_nextframe, db_stack_trace_cmd, db_i386_stack_trace): Use long types. * i386/i386/debug_i386.c (dump_ss): Fix format. * i386/i386/ktss.c (ktss_init): Use long type. * i386/i386/pcb.c (set_user_regs): Likewise. * i386/i386/thread.h (i386_saved_state, v86_segs, i386_kernel_state, i386_interrupt_state): Set field sizes to long. * i386/i386/trap.c (kernel_trap, user_trap): Fix formats. * kern/ast.h (ast_t): Set type to long. * kern/boot_script.c (create_task, resume_task, prompt_resume_task, boot_script_set_variable): Use long types. * kern/boot_script.h (boot_script_set_variable): Use long type. * kern/bootstrap.c (bootstrap_create): Pass long type. * kern/lock.c (simple_lock, simple_lock_try): Use long type. * linux/dev/kernel/softirq.c (linux_soft_intr): Fix format.
2012-03-20Complain about Xen console smash only once at a timeSamuel Thibault
* xen/console.c (hypputc): Warning only once per console write about console ring smash.
2012-03-20Make xchgl arch-neutralSamuel Thibault
* i386/i386/xen.h (xchgl): Use xchg instruction instead of xchgl, so the assembler can detect unsigned long size.
2012-03-20Use compiler defined __i386__ symbol instead of use defined i386Guillem Jover
* i386/configfrag.ac (i386): Remove definition. * i386/intel/pmap.c (pmap_update_interrupt): Rename i386 to __i386__. * i386/intel/pmap.h: Likewise. * kern/debug.c (Debugger): Likewise. * kern/lock.c (simple_lock, simple_lock_try, db_show_all_slocks): Likewise.
2012-03-20Change types holding cpu flags from int to longGuillem Jover
On amd64 the cpu flags is a 64-bit word, and long on 32-bit systems is 32-bit wide anyway. * linux/dev/glue/kmem.c (linux_kmalloc, linux_kfree, __get_free_pages, free_pages): Use unsigned long instead of unsigned. * linux/dev/include/asm-i386/system.h (__save_flags, __restore_flags): Likewise. * linux/dev/kernel/printk.c (printk): Likewise. * linux/src/drivers/scsi/advansys.c (DvcEnterCritical, DvcLeaveCritical, advansys_queuecommand, advansys_abort, advansys_reset, advansys_interrupt, interrupts_enabled, AdvISR): Likewise. * linux/src/drivers/scsi/aha152x.c (aha152x_intr): Likewise. * linux/src/drivers/scsi/aha1542.c (aha1542_intr_handle): Likewise. * linux/src/drivers/scsi/aic7xxx.c (aic7xxx_done_cmds_complete): Likewise. * linux/src/drivers/scsi/ultrastor.c (log_ultrastor_abort, ultrastor_queuecommand, ultrastor_abort): Likewise.
2012-03-20Match type for count with tty_get_status and tty_set_statusGuillem Jover
* i386/i386at/com.c (comgetstat): Use natural_t instead of `unsigned int'. (comsetstat): Likewise. * i386/i386at/kd.c (kdgetstat, kdsetstat): Likewise. * i386/i386at/lpr.c (lprgetstat, lprsetstat): Likewise.
2012-03-19Use unsigned int for ELF 32bit valuesSamuel Thibault
* i386/include/mach/i386/exec/elf.h (Elf32_Addr, Elf32_Off, Elf32_Sword, Elf32_Word): Use int type instead of long.
2012-03-18Fix assembly snippet portabilitySamuel Thibault
* xen/evt.c (hyp_c_callback): Do not set assembly instruction suffixes, using 1UL constant instead.
2012-03-18Use unsigned long types for addressesSamuel Thibault
* i386/include/mach/i386/vm_param.h (i386_btop, i386_ptob, i386_round_page, i386_trunc_page): Cast to unsigned long.
2012-03-18Use unsigned long for registersSamuel Thibault
* i386/i386/proc_reg.h (get_eflags, get_esp, get_eflags, get_cr0, get_cr2, get_cr3, get_cr4): Return unsigned long type. (set_eflags, set_cr0, set_cr3, set_cr4): Take unsigned long type.
2012-03-18Do not hardcode structure offsetSamuel Thibault
* i386/i386/i386asm.sym (R_EDI): Define macro. * i386/i386/locore.S (t_page_fault): Use R_CR2-R_EDI instead of hardcoded 12.
2012-03-18Set Xen kernel virtual address to 0xC0000000Samuel Thibault
That makes the virtual addressing equal to linear addressing, thus optimizing some computations away. * i386/i386/vm_param.h (VM_MIN_KERNEL_ADDRESS) [MACH_XEN]: Set to 0xC0000000UL. * i386/xen/Makefrag.am (gnumach_LINKFLAGS): Set _START to 0xC0000000. * i386/xen/xen_boothdr.S (VIRT_BASE, ELF_PADDR_OFFSET): Set to 0xC0000000.