summaryrefslogtreecommitdiff
path: root/i386
AgeCommit message (Collapse)Author
2020-03-09Set readtodc parameter 64bitv1.8+git20200309Samuel Thibault
In order to fix year 2038 limit. * i386/i386at/rtc.h (readtodc): Make tp parameter uint64_t *. * i386/i386at/rtc.c (readtodc): Likewise. * xen/time.c (readtodc): Likewise. * i386/i386at/model_dep.c (inittodr): Pass uint64_t pointer to readtodc.
2019-12-01i386: use 64bit precision by defaultSamuel Thibault
This is the System V ABI default. * i386/i386/fpu.c (fpinit): Use FPC_PC_64 instead of FPC_PC_53. (fp_state_alloc): Likewise.
2019-11-11PIC: Acknowledge interrupts more carefullySamuel Thibault
Specs seems to be saying that we should mask an irq out while acknowledging it with EOI. Also, better acknowledge only the concerned irq. * i386/i386at/interrupt.S (interrupt): Mask irq before notifying EOI. Using specific EOI instead of unspecific EOI.
2019-11-11PIC: fix EOI valuesSamuel Thibault
* i386/i386/pic.h (SPECIFIC_EOI, ROT_NON_SPEC, SET_ROT_AEOI, ROT_SPEC_EOI, SET_PRIORITY, NO_OPERATION): Shift value left by one bit.
2019-11-11intnull: Only warn once.Samuel Thibault
On real hardware, irq 7 seems to get raised often for some reason. * i386/i386/pic.c (intnull): Only print once the warning about interrupt being unexpectedly raised.
2019-11-10spl: Remove intpri arraySamuel Thibault
And simplify prtnull vs intnull vs linux_bad_intr. * i386/i386/ipl.h (intpri): Remove declaration * i386/i386/pic.c (prtnull_count): Remove variable. (prtnull): Remove function. * i386/i386/pic.h (prtnull): Remove declaration. * i386/i386at/autoconf.c (take_dev_irq, take_ctlr_irq): Use ivect instead of intpri to determine irq availability. Do not set intpri. * i386/i386at/pic_isa.c (ivect): Replace prtnull with intnull. (intpri): Remove array. * linux/dev/arch/i386/kernel/irq.c (linux_intr_pri): Remove variable. (linux_bad_intr): Remove function. (setup_x86_irq): Do not check intpri coherency. Do not set intpri. Set default ivect to intnull instead of linux_bad_intr. (probe_irq_on): Check ivect against intnull instead of linux_bad_intr. Do not set intpri. (probe_irq_off): Likewise. (reserve_mach_irqs): Do not check against prtnull. (old_clock_pri): Remove variable. (init_IRQ): Do not set intpri. Do not set ivect to linux_bad_intr. (restore_IRQ): Do not set ivect. * i386/i386/pit.c (clkstart): Do not set intpri. * i386/i386at/kd_mouse.c (kd_mouse_open, kd_mouse_close): Likewise. * linux/dev/drivers/block/genhd.c (device_setup): Do not set linux_intr_pri. * linux/dev/glue/block.c (init_partition, device_open): Likewise. * linux/dev/glue/net.c (device_open): Likewise. * linux/dev/glue/glue.h (linux_intr_pri, linux_bad_intr): Remove declarations.
2019-11-10Run interrupt handlers at spl7Samuel Thibault
* i386/i386at/interrupt.S (interrupt): Call spl7 instead of the intpri-provided one.
2019-11-10simplify interrupt handlingDamien Zammit
We have removed spl levels, now remove the machinery to manage different PIC masks according to levels. Only keep machinery to disable interrupts whatever the level. * i386/i386/pic.c (pic_mask): Remove array. (picinit): Do not form PIC mask. Set initial PIC mask to 0. (form_pic_mask): Remove function. * i386/i386/pic.h (form_pic_mask, pic_mask): Remove declarations. * i386/i386/spl.S (SETMASK): Remove macro. (XEN_SETMASK): Add macro, containing the Xen version of SETMASK. (spl0, splx_cli, spl) [MACH_XEN]: Call XEN_SETMASK instead of SETMASK. * i386/i386/pit.c (clkstart): Do not call form_pic_mask. * i386/i386at/autoconf.c (take_dev_irq, take_ctlr_irq): Likewise. * i386/i386at/kd_mouse.c (kd_mouse_open, kd_mouse_close): Likewise. * linux/dev/arch/i386/kernel/irq.c (mask_irq, unmask_irq): Directly update curr_pic_mask without using pic_mask array. (init_IRQ, restore_IRQ): do not call form_pic_mask. * linux/dev/include/asm-i386/system.h: Include <i386/ipl.h>. (__save_flags, __restore_flags): Use curr_ipl and splx instead of hardware flags. * linux/dev/init/main.c (linux_init): Do not call cli. * linux/dev/kernel/sched.c (linux_timer_intr): Do not use pic_mask. * linux/src/drivers/block/ide.c (try_to_identify): Disable irq probing. * linux/src/drivers/scsi/NCR53c406a.c (NCR53c406a_detect): Disable irq probing.
2019-11-10spl: Squash levels 1-6 into level 7Damien Zammit
* i386/i386/spl.S (SETIPL): Remove macro. (splsoftclock, spl1, spl2, spl3, splnet, splhdw, spl4, splbio, spldcm, spl5, spltty, splimp, splvm, spl6): Move entries to the spl7 entry.
2019-11-10pmap: fix format warningsSamuel Thibault
* i386/intel/pmap.c (pmap_bootstrap, pmap_set_page_readwrite, pmap_set_page_readonly, pmap_set_page_readonly_init, pmap_clear_bootstrap_pagetable, pmap_map_mfn, pmap_destroy, pmap_enter, pmap_collect, phys_attribute_clear): Fix format warnings.
2019-11-10Xen: fix bootSamuel Thibault
Xen seems to want a whole page for the PAE pdp. * i386/intel/pmap.c (pmap_init): Make pdpt cache use page-size allocation.
2019-10-31pit: fix buildSamuel Thibault
* i386/i386/pit.c: Include <kern/cpu_number.h>
2019-10-31pit: avoid initializating several timesSamuel Thibault
i386/i386/pit.c (clkstart): Do not initialize PIT if cpu_number() is not 0.
2019-04-28Avoid calling biosmem with size 0Samuel Thibault
* i386/i386at/model_dep.c (register_boot_data): Register reserved biosmem areas only when they have a non-zero size.
2019-04-28Avoid calling biosmem with size 0Samuel Thibault
* i386/configfrag.ac (register_boot_data): Process modules only when their count is non-zero. (i386at_init): Likewise.
2018-12-05io_perm: Rename macro to better nameSamuel Thibault
* i386/i386/io_perm.c (IS_IN_PROTECTED_RANGE): Rename to CONTAINS_PCI_CFG.
2018-12-05Restrict access to PCI cfg io ports to one processDamien Zammit
* i386/i386/io_perm.c (PCI_CFG1_START, PCI_CFG1_END, PCI_CFG2_START, PCI_CFG2_END, IS_IN_PROTECTED_RANGE): New macros. (taken_pci_cfg): New variable. (io_perm_deallocate): New function. (i386_io_perm_create): Return KERN_PROTECTION_FAILURE if requested port range contains PCI config registers and that is already taken. Set taken_pci_cfg to true when taking them. * i386/i386/io_perm.h (io_perm_deallocate): New declaration. * i386/include/mach/i386/mach_i386.defs (io_perm_t): Add io_perm_deallocate destructor.
2018-11-04Fix using all dynamic prioritiesSamuel Thibault
6a2342010811 ("Increase number of priorities") increased NRQS but didn't increase PRI_SHIFT to extend the use of the additional queues by the scheduler. This does it. While at it, extend to NRQS to 64, the double of the original 32, to keep all values coherent. * i386/i386/sched_param.h (PRI_SHIFT): Set from 18 to 17. * kern/sched.h (PRI_SHIFT): Set from 18 to 17. (NRQS): Set to 64.
2018-08-13Drop spurious changesSamuel Thibault
2018-08-13Fix building out of sourceSamuel Thibault
* configure.ac: Fix patching Makefile.in in $srcdir.
2018-07-28device: Fix d_mmap typeSamuel Thibault
* device/conf.h (dev_ops): Make d_mmap return vm_offset_t instead of int. (nomap): Update accordingly. * device/blkio.c (block_io_mmap): Likewise. * device/blkio.h (block_io_mmap): Likewise. * device/dev_name.c (nomap): Likewise. * i386/i386at/kd.c (kdmmap): Likewise. * i386/i386at/kd.h (kdmmap): Likewise. * i386/i386at/mem.c (memmmap): Likewise. * i386/i386at/mem.h (memmmap): Likewise. * i386/i386at/model_dep.c (timemmap): Likewise. * i386/i386at/model_dep.h (timemmap): Likewise.
2018-07-28Fix dev_ops typesSamuel Thibault
* device/conf.h: Include <device/device_types.h>. (dev_ops): Make d_getstat and d_setstat fields use dev_flavor_t, dev_status_t, and mach_msg_type_number_t types. * device/tty.h: (t_getstat, t_setstat): Likewise. * device/conf.h (nulldev_getstat, nulldev_setstat): Fix parameter types accordingly. * device/dev_name.c (nulldev_getstat, nulldev_setstat): Likewise. * device/kmsg.c (kmsggetstat): Likewise. * device/kmsg.h (kmsggetstat): Likewise. * device/net_io.c (net_getstat): Likewise. * device/net_io.h (net_getstat): Likewise. * i386/i386at/com.c (comgetstat, comsetstat): Likewise. * i386/i386at/com.h (comgetstat, comsetstat): Likewise. * i386/i386at/kd.c (kdgetstat, kdsetstat): Likewise. * i386/i386at/kd.h (kdgetstat, kdsetstat): Likewise. * i386/i386at/kd_event.c (kbdgetstat, kbdsetstat): Likewise. * i386/i386at/kd_event.h (kbdgetstat, kbdsetstat): Likewise. * i386/i386at/kd_mouse.c (mousegetstat): Likewise. * i386/i386at/kd_mouse.h (mousegetstat): Likewise. * i386/i386at/lpr.c (lprgetstat, lprsetstat): Likewise. * i386/i386at/lpr.h (lprgetstat, lprsetstat): Likewise. * xen/console.c (hypcngetstat, hypcnsetstat): Likewise. * xen/console.h (hypcngetstat, hypcnsetstat): Likewise. * device/dev_hdr.h: Forward-declare struct dev_ops and dev_ops_t type instead of including <device/conf.h>. * device/dev_pager.c: Include <device/conf.h> * i386/i386/pcb.h: Include <machine/io_perm.h> * i386/i386/thread.h: Do not include <i386/tss.h>
2018-07-28Fix warningSamuel Thibault
* i386/intel/pmap.c (pmap_enter): Fix panic format.
2018-06-27Fix interrupt_processor prototypeSamuel Thibault
* i386/i386/mp_desc.h [MULTIPROCESSOR] (interrupt_processor): Add prototype. * i386/intel/pmap.c [NCPUS > 1]: Include <i386/mp_desc.h>
2018-06-27Add missing includeSamuel Thibault
* i386/intel/pmap.c: Include <i386/spl.h>.
2018-06-27Fix pmap nameSamuel Thibault
* i386/intel/pmap.c (pmap_map_bd): Lock kernel_pmap, not just the inexistent pmap.
2018-06-27Add splvm prototypeSamuel Thibault
* i386/i386/spl.h (splvm): Add prototype.
2018-06-17Re-fix typoSamuel Thibault
* machine/lock.h (_simple_lock_xchg_): Remove spurious parenthesis.
2018-06-17Fix typoSamuel Thibault
* machine/lock.h (_simple_lock_xchg_): Add missing parenthesis.
2018-01-28Add const MIG typesSamuel Thibault
* i386/include/mach/i386/mach_i386_types.h (const_descriptor_list_t): New type. * include/mach/port.h (const_mach_port_array_t): New type.
2018-01-28Fix warningSamuel Thibault
* i386/i386at/lpr.c (lpropen): Cast io port to void *.
2017-11-12Fix halt messageSamuel Thibault
* i386/i386at/model_dep.c (halt_all_cpus): Change halt message to better explain what happened.
2017-10-23Drop the register qualifier.Justus Winter
* i386/intel/pmap.c: Drop the register qualifier. * ipc/ipc_kmsg.h: Likewise. * kern/bootstrap.c: Likewise. * kern/profile.c: Likewise. * kern/thread.c: Likewise. * vm/vm_object.c: Likewise.
2017-08-27ddb: More gracefully handle address errorsSamuel Thibault
* i386/i386/db_interface.h (db_read_bytes): Return boolean_t instead of void. * i386/i386/db_interface.c (db_user_to_kernel_address): Return -1 instead of calling db_error() if address is bogus. (db_read_bytes): Return FALSE instead of calling db_error() if address is bogus. * ddb/db_access.c (db_get_task_value): Return 0 if db_read_bytes failed. * ddb/db_examine.c (db_xcdump): Only print * if db_read_bytes failed.
2017-08-14i386: Fix pmap_remove on PAE kernels.Justus Winter
* i386/intel/pmap.c (pmap_remove): Fix iteration over page directory. (pmap_enter): Explain why it is ok here.
2017-08-05ddb: debug traps and port referencesJustus Winter
* ddb/db_command.c (db_debug_all_traps_cmd): New declaration and function. (db_debug_port_references_cmd): Likewise. * doc/mach.texi: Describe new commands. * i386/i386/db_interface.h (db_debug_all_traps): New declaration. * i386/i386/trap.c (db_debug_all_traps): New function. * ipc/mach_port.c (db_debug_port_references): New function. * ipc/mach_port.h (db_debug_port_references): New declaration.
2017-08-05i386: Make function static.Justus Winter
* i386/intel/pmap.c (pmap_remove_range): Make function static. * i386/intel/pmap.h (pmap_remove_range): Remove declaration.
2017-06-10Fix year computationSamuel Thibault
* i386/i386at/rtc.c (readtodc): Do not spuriously add 70 to the year.
2017-06-10Fix Epoch computationSamuel Thibault
* i386/i386at/rtc.c (CENTURY_START): New macro. (readtodc): Use CENTURY_START instead of assuming it is equal to 1970, and set yr to an absolute date before calling yeartoday.
2017-01-24Fix bissextile years computationSamuel Thibault
In practice, fixes 2100, 2200, 2300, 2500, 2600, 2700, etc. * i386/i386at/rtc.c (yeartoday): Make years divisible by 100 but not divisible by 400 non-bisextile.
2016-12-25Increase the size of the kernel mapRichard Braun
Sometimes, in particular during IO spikes, the slab allocator needs more virtual memory than is currently available. The new size should also be fine for the Xen version. * i386/i386/vm_param.h (VM_KERNEL_MAP_SIZE): Increase value.
2016-12-24VM: rework map entry wiringRichard Braun
First, user wiring is removed, simply because it has never been used. Second, make the VM system track wiring requests to better handle protection. This change makes it possible to wire entries with VM_PROT_NONE protection without actually reserving any page for them until protection changes, and even make those pages pageable if protection is downgraded to VM_PROT_NONE. * ddb/db_ext_symtab.c: Update call to vm_map_pageable. * i386/i386/user_ldt.c: Likewise. * ipc/mach_port.c: Likewise. * vm/vm_debug.c (mach_vm_region_info): Update values returned as appropriate. * vm/vm_map.c (vm_map_entry_copy): Update operation as appropriate. (vm_map_setup): Update member names as appropriate. (vm_map_find_entry): Update to account for map member variable changes. (vm_map_enter): Likewise. (vm_map_entry_inc_wired): New function. (vm_map_entry_reset_wired): Likewise. (vm_map_pageable_scan): Likewise. (vm_map_protect): Update wired access, call vm_map_pageable_scan. (vm_map_pageable_common): Rename to ... (vm_map_pageable): ... and rewrite to use vm_map_pageable_scan. (vm_map_entry_delete): Fix unwiring. (vm_map_copy_overwrite): Replace inline code with a call to vm_map_entry_reset_wired. (vm_map_copyin_page_list): Likewise. (vm_map_print): Likewise. Also print map size and wired size. (vm_map_copyout_page_list): Update to account for map member variable changes. * vm/vm_map.h (struct vm_map_entry): Remove `user_wired_count' member, add `wired_access' member. (struct vm_map): Rename `user_wired' member to `size_wired'. (vm_map_pageable_common): Remove function. (vm_map_pageable_user): Remove macro. (vm_map_pageable): Replace macro with function declaration. * vm/vm_user.c (vm_wire): Update call to vm_map_pageable.
2016-12-24VM: fix mapping removal on wired pagesRichard Braun
Memory wiring is about to be reworked, at which point the VM system will properly track wired mappings. Removing them when changing protection makes sense, and is fine as long as the VM system rewires them when access is restored. * i386/intel/pmap.c (pmap_page_protect): Decrease wiring count instead of causing a panic when removing a wired mapping.
2016-11-06Revert "i386: use ACPI to power off the machine"Justus Winter
This reverts commit c031b41b783cc99c0bd5aac7d14c1d6e34520397. Adding the ACPI parser from GRUB was a mistake as its license conflicts with the one used by the legacy Linux drivers. Furthermore, adding support for ACPI to the kernel violates the minimality principle.
2016-11-01i386: Use discontiguous page directories when using PAE.Justus Winter
Previously, we used contiguous page directories four pages in length when using PAE. To prevent physical memory fragmentation, we need to use virtual memory for objects spanning multiple pages. Virtual kernel memory, however, is a scarce commodity. * i386/intel/pmap.h (lin2pdenum): Never include the page directory pointer table index. (lin2pdenum_cont): New macro which does include said index. (struct pmap): Remove the directory base pointer when using PAE. * i386/intel/pmap.c (pmap_pde): Fix lookup. (pmap_pte): Fix check for uninitialized pmap. (pmap_bootstrap): Do not store the page directory base if PAE. (pmap_init): Reduce size of page directories to one page, use direct-mapped memory. (pmap_create): Allocate four page directories per pmap. (pmap_destroy): Adapt to the discontinuous directories. (pmap_collect): Likewise. * i386/i386/xen.h (hyp_mmu_update_la): Adapt code manipulating the kernels page directory. * i386/i386at/model_dep.c (i386at_init): Likewise.
2016-10-31Make multiboot cmdline and modules non-permanent reservationsSamuel Thibault
* i386/i386at/model_dep.c (register_boot_data): For multiboot cmdline, module structure, module data and module strings, set biosmem_register_boot_data temporary parameter to TRUE.
2016-10-24Fix warningsSamuel Thibault
* i386/i386/seg.h (fill_descriptor): Fix format for vm_offset_t. * i386/i386/xen.h (hyp_free_mfn, hyp_free_page): Fix format for unsigned long.
2016-10-22i386: Allocate page directories using the slab allocator.Justus Winter
* i386/intel/pmap.c (pd_cache): New variable. (pdp_cache): Likewise. (pmap_init): Initialize new caches. (pmap_create): Use the caches. (pmap_destroy): Free to the caches.
2016-10-02Fix format securityDavid Michael
* i386/i386at/biosmem.c (boot_panic): Use %s format instead of passing the string directly to `panic'. (biosmem_unregister_boot_data): Use %s format instead of passing `biosmem_panic_inval_boot_data' directly to `panic'.
2016-09-22biosmem: show memory map at bootSamuel Thibault
* i386/i386at/biosmem.c (biosmem_type_desc, biosmem_map_show): Define even if DEBUG is 0. But show biosmem heap addresses only if DEBUG is 1.