| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
e2fcf261076b ("interrupt: Fix saving irq/ipl when linux drivers are
disabled") changed the stack layout for interrupt handlers, but missed
updating kdb_kintr's code that tries to mangle it.
This restores the control-alt-d shortcut.
|
|
|
|
|
|
|
| |
e2fcf261076b (""interrupt: Fix saving irq/ipl when linux drivers are
disabled") broke booting under some conditions, because the parameters were
erroneously written 4 bytes too far for splx_cli and ioapic_irq_eoi to
read them.
|
|
|
|
|
|
| |
Message-Id: <20221025105502.222708-5-damien@zamaudio.com>
Co-authored-by: Almudena Garcia <liberamenso10000@gmail.com>
|
|
|
|
|
|
| |
When we want to enable APIC, we must initialize the structure or
otherwise, it will try to access to a not initialized memory addresses.
Message-Id: <20220924163145.39894-1-etienne.brateau@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When Linux drivers are disabled, in hardclock() the linux_timer_intr()
call is dropped, and gcc can tail-recursion-optimize the call to
clock_interrupt(). To do so, it overwrites the hardclock() parameters to
suit the clock_interrupt parameters layout. This however means it thrashes
the backups that the interrupt() function had made of irq/ipl, leading to
mayhem.
interrupt should thus really properly separate its irq/ipl backups from the
interrupt function parameters.
Thanks a lot to Etienne Brateau for the tricky investigation!
|
| |
|
|
|
|
|
| |
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628101054.446126-13-luca@orpolo.org>
|
|
|
|
|
|
|
|
| |
The leading space prevents it working if console=comX is the only
argument, so handle this case separately.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-5-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
| |
* use _raw_ structs where we refer to the bootloader-provided data
* remove unused structures
* fix 64 bit boot
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-3-luca@orpolo.org>
|
|
|
|
| |
Message-Id: <Yo+lzS7RtW5ZjQHN@debian>
|
|
|
|
| |
Message-Id: <20220215064133.68593-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
| |
* hardclock.c: convert to ANSI
* com.c: ditto
* lpr.c: ditto
* mem.c: ditto
Message-Id: <20220120170004.21722-1-etienne.brateau@gmail.com>
|
|
|
|
|
| |
We haven't seen the 2032 bug for a long time, f040677be3c0 ("kd: Do not
read the CMOS ram") probably fixed it at last.
|
|
|
|
|
|
|
| |
The segment code actually has vm_page entries for reserved pages, and
thus memmmap would reject mapping ACPI pages. Taking the information
from biosmem is much more precise, and indeed knows all hardware quirks
which can now be dropped from memmmap.
|
|
|
|
|
|
|
|
|
|
|
| |
We are still having issues with bogus dates. This adds prints at boot
and time set, to make sure what we actually read and write.
* i386/i386at/rtc.c: Include <kern/printf.h>
(readtodc): Warning about reaching CENTURY_START. Print the time read
from RTC.
(writetodc): Record in RTC remainder of division of year by 100 rather
than subtracting 1900. Print the time written to RTC.
|
|
|
|
|
|
|
| |
This could conflict with read/writing the RTC.
* i386/i386at/kd.c (kd_xga_init): Do not read the CRAM. We were always
assuming VGA anyway.
|
|
|
|
|
|
|
| |
We unmasked by hand kd's irq 1, but com0/1 also need unmasking. More
generally we should unmask irqs as appropriate.
* i386/i386at/model_dep.c (machine_init): Unmask irq 3 and 4.
|
|
|
|
| |
Message-Id: <20210405115921.184572-3-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20210405115921.184572-2-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20210405052916.174771-5-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20210405052916.174771-4-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20210405052916.174771-3-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20210405052916.174771-2-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
* i386/i386at/boothdr.S (_eintstack): Add missing common.
* i386/xen/xen_boothdr.S (_eintstack): Add missing common.
* x86_64/xen/xen_boothdr.S (_eintstack): Add missing common.
* i386/i386/mp_desc.c (intstack, eintstack): Add missing underscore.
|
|
|
|
|
|
|
| |
Use --enable-ncpus=x --enable-apic where x > 1 for SMP+APIC support.
Use neither for no SMP and old PIC support.
Message-Id: <20210404050812.145483-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
| |
Not only Linux drivers need BIOS mapped.
* i386/i386at/model_dep.c (i386at_init) [!LINUX_DEV]: Map the low
memory.
* i386/intel/pmap.c (pmap_create) [!LINUX_DEV]: Likewise.
|
|
|
|
|
|
| |
* i386/i386/pic.h (PICM_VECTBASE): Set to 0x20.
* i386/i386at/idt.h (IDTSZ): Set to 0x20 + 0x10.
(PIC_INT_BASE): Set to 0x20.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* i386/i386/apic.c (acpi_get_irq_override): New function.
(apic_get_ioapic): Make it return IoApicData* rather than IoApicData.
(apic_print_info): Manage IoApicData* rather than IoApicData.
* i386/i386/apic.h (struct ApicReg): Use uint32_t instead of unsigned.
(struct ioapic_route_entry): New structure.
(union ioapic_route_entry_union): New union.
(ApicLocalUnit): Rename base to gsi_base. Add ioapic field.
(APIC_IRQ_OVERRIDE_POLARITY_MASK, APIC_IRQ_OVERRIDE_TRIGGER_MASK): New
macros.
(acpi_get_irq_override, ): New prototype.
(apic_get_ioapic): Update prototype.
(lapic): New declaration.
(IMCR_SELECT, IMCR_DATA, MODE_IMCR, IMCR_USE_PIC, IMCR_USE_APIC,
LAPIC_ENABLE, LAPIC_NMI, LAPIC_DISABLE, LAPIC_TIMER_PERIODIC,
LAPIC_TIMER_DIVIDE_2, LAPIC_TIMER_DIVIDE_4, LAPIC_TIMER_DIVIDE_8,
LAPIC_TIMER_DIVIDE_16, LAPIC_TIMER_BASEDIV, NINTR, IOAPIC_FIXED,
IOAPIC_PHYSICAL, IOAPIC_LOGICAL, IOAPIC_NMI, IOAPIC_EXTINT,
IOAPIC_ACTIVE_HIGH, IOAPIC_ACTIVE_LOW, IOAPIC_EDGE_TRIGGERED,
IOAPIC_LEVEL_TRIGGERED, IOAPIC_MASK_ENABLED, IOAPIC_MASK_DISABLED): New
macros.
* i386/i386at/acpi_parse_apic.h (struct acpi_apic_ioapic): Rename base
field to gsi_base.
* i386/i386at/acpi_parse_apic.c (acpi_apic_add_ioapic): Update to
gsi_base new name. Set ioapic field.
(acpi_apic_setup): Rename lapic to lapic_unit.
Message-Id: <20210328060320.36194-5-damien@zamaudio.com>
|
|
|
|
|
|
| |
* i386/i386at/acpi_parse_apic.c (acpi_get_apic): Map rsdt entries read-only.
Message-Id: <20210328060320.36194-4-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
| |
* i386/i386at/acpi_parse_apic.c (acpi_check_rsdp_align): Make it take a
void* instead of uint32_t.
(acpi_get_rsdp): Apply phystokv on the EBDA base and 0xE0000.
(acpi_apic_setup): Drop spurious negation.
Message-Id: <20210328060320.36194-3-damien@zamaudio.com>
|
|
|
|
| |
* i386/i386at/com.c (comprobe_general): Reject unit being equal to NCOM.
|
|
|
|
|
| |
* i386/i386at/comreg.h: Add header guard angaist multiple inclusion.
Message-Id: <20210109180149.11861-1-gfleury@disroot.org>
|
|
|
|
|
|
|
| |
commmodem and lprinfo arrays would otherwise overflow.
* i386/i386at/com.c (comattach): Return early when unit is beyond NCOM.
* i386/i386at/lpr.c (lprattach): Return early when unit is beyond NLPR.
|
| |
|
|
|
|
| |
to initialize some structures needed for SMP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configfrag.ac (--enable-ncpus): Add option to set $mach_ncpus.
* i386/i386/cpu_number.h (CPU_NUMBER, cpu_number): New macros, set to 0 for
now.
* i386/i386/db_interface.c (cpu_interrupt_to_db): New function.
* i386/i386/db_interface.h (cpu_interrupt_to_db): New declaration.
* i386/i386/mp_desc.c (int_stack_base): New array.
(intel_startCPU): New function.
* i386/i386at/model_dep.c: Include <i386/smp.h>
(int_stack_top, int_stack_base): Turn into arrays
(i386at_init): Update accesses accordingly.
* i386/i386at/model_dep.h (int_stack_top, int_stack_base, ON_INT_STACK):
Likewise.
* i386/intel/pmap.c (cpus_active, cpus_idle, cpu_update_needed): Add
variables.
* i386/intel/pmap.h (cpus_active, cpus_idle, cpu_update_needed): Mark
extern.
* kern/cpu_number.h: Include <machine/cpu_number.h>
* linux/dev/arch/i386/kernel/irq.c (local_bh_count, local_irq_count):
Hardcode to the address of intr_count. We will not use the Linux code in
SMP mode anyway.
|
|
|
|
|
|
| |
if NCPUS > 1, call to smp_init to start the search and enumeration of the cpus
*i386/i386/model_dep.c (machine_init): add smp_init() call
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
To find the processors, It's necessary to find the APIC (MADT) table
This table is found inside ACPI tables.
This set of functions find the MADT table, and parse it to find the APIC structures
and register it in the kernel.
*acpi_parse_apic.h: ACPI structures and function prototypes.
*acpi_parse_apic.c: ACPI/APIC function definitions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
* i386/i386at/com.c (comopen, comclose, comparam, comstart, comtimer):
Cast tp->t_addr to uinptr_t instead of int.
|
|
|
|
|
| |
* i386/i386at/biosmem.c: Include <inttypes.h>
(biosmem_map_show, biosmem_load_segment): Use PRIx64.
|
|
|
|
|
|
| |
* i386/i386at/kdasm.S (start, count, value, from, to): Use B_ARG*
instead of reimplementing them.
* x86_64/kdasm.S: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|