summaryrefslogtreecommitdiff
path: root/i386
AgeCommit message (Collapse)Author
2020-03-29Fix warningSamuel Thibault
* i386/intel/pmap.c (pmap_enter): Fix print format.
2020-03-2964bit: fix warningsSamuel Thibault
* device/net_io.h (net_set_filter, ethernet_priority): Add prototypes. * device/subrs.h: Include <device/if_hdr.h>. (if_init_queues): Add prototype. * i386/i386/model_dep.h (machine_relax): Add prototype. * i386/i386/trap.c (i386_astintr): Move mycpu variable definition to where it is used. * i386/i386at/model_dep.c (i386at_init): Likewise for nb_direct, addr, delta. * i386/xen/xen.c (return_to_iret): Change type to char[]. * xen/console.c: Include <i386at/kd.h>. * xen/evt.c (hyp_evt_handler): Cast NEVNT to int. * xen/grant.c: Include <model_dep.h>. (hyp_grant_takeback, hyp_grant_init): Fix print format. * xen/net.c: Include <device/subrs.h>. (paranoia): Remove variable. (hyp_net_init, device_close, device_open): Cast nd - vif_data to int. Fix print format. * xen/store.c (store_put): Cast sizeof to int. * xen/time.c: Include "xen.h". * xen/xen.h (hypclock_machine_intr): Add prototype.
2020-03-2964bit: Fix vm_size_t sizeSamuel Thibault
It needs to be able to hold > 4G size. * i386/include/mach/i386/vm_types.h (vm_size_t): Set type to unsigned long. * vm/vm_user.c (vm_read, vm_write): Fix type according to RPC. * i386/i386at/model_dep.c (c_boot_entry): Fix format. * device/dev_pager.c (device_pager_data_request): Fix format.
2020-03-2964bit: Fix segment definitionsSamuel Thibault
* i386/i386/gdt.c: Include <kern/assert.h> (gdt_init) [__x86_64__]: Assert base is 0, pass 0 limit and 64bit size. * i386/i386/ktss.c: Warn that it needs to be fixed. * i386/i386/ldt.c: Warn that it needs to be fixed. * i386/i386/mp_desc.c: Warn that it needs to be fixed.
2020-03-29db_interface: Fix 64bit warningsSamuel Thibault
* i386/i386/db_interface.c (i386_last_kdb_sp): Set type to uintptr_t. (kdb_trap): Cast &type and &regs->uesp to uintptr_t. (kdb_kentry): Cast interrupt state with uintptr_t.
2020-03-29com: Fix 64bit warningsSamuel Thibault
* i386/i386at/com.c (comopen, comclose, comparam, comstart, comtimer): Cast tp->t_addr to uinptr_t instead of int.
2020-03-2964bit: Fix format warningsSamuel Thibault
* i386/i386at/biosmem.c: Include <inttypes.h> (biosmem_map_show, biosmem_load_segment): Use PRIx64.
2020-03-28at-x86_64: Enable fpu/pic/pit macrosSamuel Thibault
This must be replaced by 64bit equivalents, but let's enable them for now so it can build. * i386/i386/pic.h [ATX86_64]: Enable macros. * i386/i386/pit.h [ATX86_64]: Likewise. * i386/i386/fpu.c [ATX86_64]: Enable fpintr function.
2020-03-28pmap: fix 64bit non-xen buildSamuel Thibault
* i386/intel/pmap.c (pmap_bootstrap) [!MACH_PV_PAGETABLES]: Do not call pmap_set_page_readonly_init.
2020-03-28IDT: fix entries formatSamuel Thibault
* i386/i386/idt.c (idt_init_entry): Set entrypoint type to unsigned long. * x86_64/idt_inittab.S (IDT_ENTRY): Fix entry format accordingly.
2020-03-28kdasm: Add 64bit variantSamuel Thibault
* i386/i386at/kdasm.S (start, count, value, from, to): Use B_ARG* instead of reimplementing them. * x86_64/kdasm.S: New file.
2020-03-28Fix low-level macros for 64bitSamuel Thibault
* i386/i386/proc_reg.h (get_eflags, set_eflags): Add 64bit version. (get_dr0, set_dr0, get_dr1, set_dr1, get_dr2, set_dr2, get_dr3, set_dr3, get_dr6, set_dr6, get_dr7, set_dr7): Drop explicit size qualifier.
2020-03-28Fix hardclock build on 64bitEtienne Brateau
* i386/i386/hardclock.c [ATX86_64]: Include <i386/ipl.h>.
2020-03-28pmap.h: Add 64bit variantSamuel Thibault
* i386/intel/pmap.h (L4SHIFT, L4MASK, lin2l4num): New macros (PDPNUM, PDPMASK, set_pmap): Add 64bit variant. Make PAE use the 64bit mask too. (pmap): Add l4base, user_l4base, user_pdpbase fields. * i386/intel/pmap.c (pmap_bootstrap): Clear the whole PDP. Enable write bit in PDP. Set user pagetable to NULL. Initialize l4base. (pmap_clear_bootstrap_pagetable): Add 4th-level support. (pmap_ceate): Clear the whole PDP. Enable write bit in PDP. Initialize l4base, user_pdpbase, user_l4base. (pmap_destroy): Clear l4base, user_pdpbase, user_l4base. * i386/i386at/model_dep.c (i386at_init): Load l4base on 64bits.
2020-03-28trap.c: Add 32bit lcall 7 emulation on 64bitSamuel Thibault
* i386/i386/trap.c: Detect lcall 7 instructions.
2020-03-28Fix tab vs spacesSamuel Thibault
2020-03-28multiboot.h: Add 64bit variantSamuel Thibault
* i386/include/mach/i386/multiboot.h (multiboot32_module): New structure.
2020-03-28asm.h: Add 64bit variantSamuel Thibault
* i386/include/mach/i386/asm.h (S_ARG0, S_ARG1, S_ARG2, S_ARG3, S_ARG4, S_ARG5, FRAME, EMARF, B_ARG0, B_ARG1, B_ARG2, B_ARG3, INT_FIX): Add 64bit variants.
2020-03-28xen.h: Add 64bit variantSamuel Thibault
* i386/i386/xen.h (_hypcall_ret, _hypcall_arg1, _hypcall_arg2, _hypcall_arg3, _hypcall_arg4, _hypcall_arg5): New macros. (_hypcall0, _hypcall1, _hypcall2, _hypcall3, _hypcall4, _hypcall5): Fix parameters and return type. (set_callbacks, update_descriptor, set_segment_base, update_va_mapping, set_timer_op): Add 64bit variant. (hyp_set_user_cr3): New macro. (iretq): New macro.
2020-03-28vm_param: Add 64bit variantSamuel Thibault
* i386/i386/vm_param.h (VM_MIN_KERNEL_ADDRESS, HYP_VIRT_START, LINEAR_MIN_KERNEL_ADDRESS, LINEAR_MAX_KERNEL_ADDRESS): Add 64bit variants.
2020-03-28thread.h: Add 64bit variantSamuel Thibault
* i386/i386/thread.h (i386_saved_state, i386_kernel_state, i386_interrupt_state): Add 64bit registers.
2020-03-28setjmp: Add 64bit variantSamuel Thibault
* x86_64/_setjmp.S: New file * i386/i386/setjmp.h (jmp_buf): Add 64bit variant.
2020-03-28i386asm.sym: Add 64bit variantSamuel Thibault
* i386/i386/i386asm.sym (KSS_ESI, KSS_EDI): Remove. (KSS_R12, KSS_R13, KSS_R14, KSS_R15, r15): Add.
2020-03-28gdt: 64bit VariantSamuel Thibault
There is no segmentation in 64bit mode. * i386/i386/gdt.c (gdt_init): Do not load segments on 64bit.
2020-03-28db_trace: Add 64bit variantSamuel Thibault
* i386/i386/db_trace.c (i386_kregs): On 64bit, remove edi and esi, and add r12, r13, r14, r15.
2020-03-28db_interface: Add 64bit variantSamuel Thibault
* i386/i386/db_interface.c (int_regs): Drop edi/esi fields on 64bit. (kdb_kentry): Fix saving rsi/rdi.
2020-03-28cpu_number: Add 64bit variantSamuel Thibault
* i386/i386/cpu_number.h (CX): Add 64bit variant.
2020-03-28Fix inl result sizeEtienne Brateau
* i386/i386/pio.h (inl): Make result unsigned int instead of unsigned long.
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>