aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Add hardware interrupt notification mechanismSamuel Thibault2020-07-1018-81/+776
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows privileged userland drivers to get notifications of hardware interrupts. Initial work by Zheng Da, reworked by Damien Zammit and myself. * Makefrag.am (libkernel_a_SOURCES): Add device/intr.c and device/intr.h. (include_device_HEADERS): Add include/device/notify.defs and include/device/notify.h. * device/dev_hdr.h (name_equal): Add declaration. * device/ds_routines.c: Include <device/intr.h> (ds_device_intr_register, ds_device_intr_ack): New functions. * device/intr.c, device/intr.h: New files. * doc/mach.texi (Device Interrupt): New section. * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/irq.c and i386/i386/irq.h. * i386/i386/irq.c, i386/i386/irq.h: New files. * i386/i386at/conf.c: Include <device/intr.h>. (irqname): New macro. (dev_name_list): Add irq device. * include/device/device.defs (device_intr_register, device_intr_ack): New RPCs. * include/device/notify.defs, include/device/notify.h: New files. * kern/startup.c: Include <device/intr.h> (start_kernel_threads): Start intr_thread thread. * linux/dev/arch/i386/kernel/irq.c: Include <device/intr.h> (linux_action): Add user_intr field. (linux_intr): Call user_intr action if any. (mask_irq, unmask_irq): Move functions to i386/i386/pic.c (__disable_irq, __enable_irq): Move functions to i386/i386/irq.c. (install_user_intr_handler): New function. (request_irq): Initialize user_intr field. * linux/src/include/asm-i386/irq.h (__disable_irq, __enable_irq): Remove prototypes. * i386/i386/pic.c (mask_irq, unmask_irq): New functions. * i386/i386/pic.h (mask_irq, unmask_irq): New prototypes.
* Add vm_allocate_contiguous RPCSamuel Thibault2020-07-095-0/+184
| | | | | | | | | | | | | | | | | This allows privileged userland drivers to allocate buffers for e.g. DMA, and thus need them to be physically contiguous and get their physical address. Initial work by Zheng Da, reworked by Richard Braun, Damien Zammit, and myself. * doc/mach.texi (vm_allocate_contiguous): New RPC. * i386/include/mach/i386/machine_types.defs (rpc_phys_addr_t): New type. * i386/include/mach/i386/vm_types.h [!MACH_KERNEL] (phys_addr_t): Set type to 64bits. (rpc_phys_addr_t): New type, always 64bits. * include/mach/gnumach.defs (vm_allocate_contiguous):New RPC. * vm/vm_user.c (vm_allocate_contiguous): New function.
* Add experimental RPC infrastructureSamuel Thibault2020-07-094-0/+27
| | | | | | | | | | | | | | | | This is free for experimenting RPCs, with no backward compatibility guarantees. * Makefrag.am (EXTRA_DIST): Add kern/experimental.srv. (include_mach_HEADERS): Add include/mach/experimental.defs. (nodist_lib_dep_tr_for_defs_a_SOURCES): Add kern/experimental.server.defs.c. (nodist_libkernel_a_SOURCES): Add kern/experimental.server.h, kern/experimental.server.c, kern/experimental.server.msgids. (nodist_libkernel_a_SOURCES): Add kern/experimental.server.defs. * include/mach/experimental.defs: New file. * kern/experimental.srv: New file. * kern/ipc_kobject.c: Include <kern/experimental.server.h>. (ipc_kobject_server): Call experimental_server_routine.
* vm_map: Allow passing the name of a memory objectSamuel Thibault2020-06-201-2/+4
| | | | | | | as is returned by vm_info. * vm/vm_user.c (vm_map): Before trying to vm_object_enter, try to simply lookup the name.
* Support GPT disklabels and build them by defaultнаб2020-06-013-0/+320
| | | | Based on UEFI 2.8A spec
* kmem_alloc_wired: factorize with kmem_vallocSamuel Thibault2020-05-011-49/+3
| | | | * vm/vm_kern.c (kmem_alloc_wired): Factorize with kmem_valloc.
* Add kmem_vallocSamuel Thibault2020-05-013-1/+80
| | | | | | | | | | | Functions like vremap need to allocate some virtual addressing space before making their own mapping. kmem_alloc_wired can be used for that but that wastes memory. * vm/vm_kern.c (kmem_valloc): New function. * vm/vm_kern.h (kmem_valloc): New prototype. * linux/dev/glue/kmem.c (vremap): Call kmem_valloc instead of kmem_alloc_wired. Also check that `offset' is aligned on a page.
* doc: Add missing word.Ricardo Wurmus2020-04-161-1/+1
| | | | | * doc/mach.texi (Features): Add missing word. Message-Id: <20200416202143.16804-1-rekado@elephly.net>
* mach_trap_table: Fix 64bit versionSamuel Thibault2020-04-063-5/+4
| | | | | | | The addition of the mach_trap_name field made the 64bit unused field spurious. * kern/syscall_sw.h (mach_trap_t): Remove `unused' field.
* Add warning about one of the next 64bit fixes to makeSamuel Thibault2020-04-061-0/+3
|
* ddb: Add 64bit support to memory examinationSamuel Thibault2020-04-062-4/+11
| | | | | * ddb/db_examine.c(db_examine): Add q modifier to examine 64bit values. * doc/mach.texi (examine): Document q modifier.
* bootstrap: Add missing reference to send port between tasksSamuel Thibault2020-04-061-1/+2
| | | | | | | | | When giving the port to a bootstrap task to another bootstrap task, we need to add a reference. This shows up on error-cleanup (e.g. when forgetting to define the root). * kern/bootstrap.c (boot_script_insert_task_port): Call ipc_port_make_send on `task''s itk_sself.
* boot_script: Explicit missing symbol nameSamuel Thibault2020-04-061-0/+2
| | | | | * kern/boot_script.c: Include <kern/printf.h>. (boot_script_exec): Print missing symbol name on symbol lookup error.
* x86_64: Fix userland max addressSamuel Thibault2020-04-061-0/+4
| | | | | * i386/include/mach/i386/vm_param.h (VM_MAX_ADDRESS) [__x86_64__]: Set to 0x40000000UL.
* x86_64: Fix passing argumentSamuel Thibault2020-04-051-1/+1
| | | | * kern/boot_script.c (add_arg): Make val parameter long.
* xen: Fix vm_page layout for x86_64Samuel Thibault2020-04-051-0/+7
| | | | | | | | * i386/i386/vm_param.h [MACH_XEN && __LP64__] (VM_PAGE_MAX_SEGS): Set to 4. (VM_PAGE_DMA32_LIMIT): Define. (VM_PAGE_DIRECTMAP_LIMIT): Set to 0x400000000000. (VM_PAGE_HIGHMEM_LIMIT): Set to 0x10000000000000.
* xen: Fix rdtsc call for x86_64Samuel Thibault2020-04-051-3/+3
| | | | | * i386/i386/xen.h (hyp_cpu_clock): Replace "=A" register constraint with separate "=a" and "=d".
* Xen x86_64: Fix getting page table baseSamuel Thibault2020-04-051-1/+1
| | | | | * i386/intel/pmap.c (pmap_bootstrap): Reload base from boot_info at each loop.
* Fix warningSamuel Thibault2020-04-051-1/+1
| | | | * xen/net.c (hyp_net_intr): Cast WINDOW to long.
* Fix xen buildSamuel Thibault2020-04-051-1/+1
| | | | * xen/grant.c: Include <machine/model_dep.h> instead of <model_dep.h>.
* pmap: Fix boot with kvm+PAE on some systemsSamuel Thibault2020-04-041-2/+10
| | | | | | | | It seems some systems refuse the W bit in the pdp. Only enable it for Xen PV tables which do require it. * i386/intel/pmap.c (pmap_bootstrap, pmap_create) [!MACH_PV_PAGETABLES]: Do not set INTEL_PTE_WRITE in pdpbase entries.
* pmap.h: Fix PDPMASK in 32bit PAESamuel Thibault2020-04-031-1/+2
| | | | | | | This was erroneously set to 0x1ff in 0b3504b6 ('pmap.h: Add 64bit variant') * i386/intel/pmap.h (PDPMASK) [PAE && !__x86_64__]: Set to 3.
* Fix build with -fno-commonSamuel Thibault2020-03-3111-7/+14
| | | | | | | | | | | | | | | | which will be the default in gcc-10. * device/io_req.h (io_inband_cache): Add extern qualifier. * device/tty.h (tthiwat, ttlowat): Likewise. * i386/i386/db_machdep.h (ddb_regs): Likewise. * kern/cpu_number.h (master_cpu): Likewise. * kern/time_stamp.h (ts_tick_count): Likewise. * linux/src/drivers/scsi/in2000.h (proc_scsi_in2000): Likewise. * device/ds_routines.c (io_inband_cache): New variable. * i386/i386/db_interface.c (ddb_regs): Likewise. * kern/processor.c (master_cpu): Likewise. * kern/time_stamp.c (ts_tick_count): Likewise. * linux/pcmcia-cs/modules/pci_fixup.c (pci_root): Remove variable.
* xen: fix const warningSamuel Thibault2020-03-312-1/+7
| | | | | * xen/public/io/ring.h (__CONST_RING_SIZE): Add macro from upstream * xen/net.c (WINDOW): Use __CONST_RING_SIZE instead of __RING_SIZE.
* Restore vm_size_t to natural_tSamuel Thibault2020-03-313-2/+6
| | | | | | | | | | | Plenty of places such as glibc RPC uses currently assume that vm_size_t is a natural_t (thus int on 32bit), not an unsigned long. * i386/include/mach/i386/vm_types.h (vm_size_t) [!__x86_64__]: Set type to natural_t. * device/dev_page.c (device_pager_data_request): Cast vm_size_t to unsigned long. * i386/i386at/model_dep.c (c_boot_entry): Likewise.
* seg: Fix fill_gate offsetSamuel Thibault2020-03-311-1/+1
| | | | * i386/i386/seg.h (fill_gate): Make offset an unsigned long.
* Fix 64bit TSS/LDT system descriptorsSamuel Thibault2020-03-296-27/+117
| | | | | | | | | | | | | | | | | | | * i386/i386/seg.h (real_descriptor64): New structure. (fill_descriptor64): New function. * i386/i386/gdt.h [__x86_64__] (KERNEL_TSS): Set to 0x40 instead of 0x20. [__x86_64__] (USER_TSS): Set to 0x58 instead of 0x30. [__x86_64__] (GDTSZ): Set to 12 instead of 11. (_fill_gdt_descriptor): New macro. (_fill_gdt_descriptor64, fill_gdt_descriptor64): New macros. (_fill_gdt_sys_descriptor, fill_gdt_sys_descriptor): New macros. * i386/i386/ktss.c (ktss_init): Use fill_gdt_sys_descriptor instead of fill_gdt_descriptor to set KERNEL_TSS GDT entry. * i386/i386/ldt.c (ldt_init): Likewise for KERNEL_LDT GDT entry. * i386/i386/ldt.h (fill_ldt_descriptor, fill_ldt_gate): Use sel_idx instead of reimplementing it. * i386/i386/mp_desc.c (mp_desc_init): Use _fill_gdt_sys_descriptor instead of reimplementing it.
* Fix gate definition for 64bit.Samuel Thibault2020-03-292-0/+11
| | | | | * i386/i386/seg.h (real_gate): Add offset_ext and reserved fields. (fill_gate): Fill offset_ext and reserved fields.
* ldt: do not reload kernel LDT if we are already using itSamuel Thibault2020-03-291-1/+2
| | | | | * i386/i386/pcb.c (switch_ktss): Do not call set_ldt(KERNEL_LDT) if get_ldt() is already KERNEL_LDT.
* Share ncom, lpr, PAE definitions between i386 and x86_64Samuel Thibault2020-03-295-30/+49
| | | | | | | | | | | | Otherwise the x86_64 configfrag would overwrite i386's. * i386/configfrag.ac: Remove ncom, nlpr, pae, NCOM, NLPR, PAE definitions. * i386/configfrag.ac: Remove ncom, nlpr, NCOM, NLPR, PAE definitions. Enable PAE. * configfrag-first.ac: New file, defines ncom, nlpr, pae. * configure.ac: Include configfrag-first.ac * configfrag.ac: Define NCOM, NLPR, PAE.
* Fix warningSamuel Thibault2020-03-291-1/+1
| | | | * i386/intel/pmap.c (pmap_enter): Fix print format.
* 64bit: fix warningsSamuel Thibault2020-03-2913-20/+42
| | | | | | | | | | | | | | | | | | | | | | | * 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.
* 64bit: Fix vm_size_t sizeSamuel Thibault2020-03-294-5/+8
| | | | | | | | | | 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.
* mach_port: Fix 64bit warningsSamuel Thibault2020-03-291-2/+2
| | | | | * ipc/mach_port.c (mach_port_destroy, mach_port_deallocate): Cast sizeof to int.
* 64bit: Fix segment definitionsSamuel Thibault2020-03-294-0/+21
| | | | | | | | * 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.
* db_interface: Fix 64bit warningsSamuel Thibault2020-03-291-6/+6
| | | | | | * 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.
* com: Fix 64bit warningsSamuel Thibault2020-03-291-6/+6
| | | | | * i386/i386at/com.c (comopen, comclose, comparam, comstart, comtimer): Cast tp->t_addr to uinptr_t instead of int.
* 64bit: Fix format warningsSamuel Thibault2020-03-292-2/+65
| | | | | * i386/i386at/biosmem.c: Include <inttypes.h> (biosmem_map_show, biosmem_load_segment): Use PRIx64.
* x86_64: drop unused functionsSamuel Thibault2020-03-291-122/+0
| | | | | * x86_64/locore.S (dr6, dr0, dr1, dr2, dr3): Remove functions. (dr_msk, dr_addr): Remove variables.
* x86_64: Fix map address given to linkerSamuel Thibault2020-03-291-1/+1
| | | | | | | See VM_MIN_KERNEL_ADDRESS. * x86_64/Makefrag.am (gnumach_LINKFLAGS): Set _START to _START_MAP+0x40000000 instead of +0xC0000000.
* Enable x86_64 build for atEtienne Brateau2020-03-291-0/+6
| | | | * x86_64/Makefrag.am: Add instructions to build
* spl: Fix assembly filesEtienne Brateau2020-03-291-4/+4
| | | | * x86_64/spl.S: fix instruction length
* Enable at x86_64 buildSamuel Thibault2020-03-282-1/+20
| | | | | | | | | | * x86_64/configfrag.ac (ncom, nplr) [!at:x86_64]: Set to 0. (ncom) [at:x86_64]: Set to 4. (nlpr) [at:x86_64]: Set to 1. (ATX86_64): Define to 1. (NCOM): Define. (NLPR): Define. * configure.ac [at:x86_64]: Accept combination.
* at-x86_64: Enable fpu/pic/pit macrosSamuel Thibault2020-03-283-5/+5
| | | | | | | | | 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.
* pmap: fix 64bit non-xen buildSamuel Thibault2020-03-281-0/+2
| | | | | * i386/intel/pmap.c (pmap_bootstrap) [!MACH_PV_PAGETABLES]: Do not call pmap_set_page_readonly_init.
* kdasm: Fix 64bit buildSamuel Thibault2020-03-281-3/+3
| | | | | * x86_64/kdasm.S (count): Fix type to 32bit. (kd_slmscu, kd_slmscd): Fix getting count as 32bit.
* IDT: fix entries formatSamuel Thibault2020-03-282-3/+3
| | | | | * i386/i386/idt.c (idt_init_entry): Set entrypoint type to unsigned long. * x86_64/idt_inittab.S (IDT_ENTRY): Fix entry format accordingly.
* interrupt: Add 64bit variantSamuel Thibault2020-03-281-0/+84
| | | | * x86_64/interrupt.S: New file.
* kdasm: Add 64bit variantSamuel Thibault2020-03-282-6/+139
| | | | | | * i386/i386at/kdasm.S (start, count, value, from, to): Use B_ARG* instead of reimplementing them. * x86_64/kdasm.S: New file.
* Fix low-level macros for 64bitSamuel Thibault2020-03-281-13/+30
| | | | | | * 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.