| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628101054.446126-13-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* i386/i386/pcb.c:
- increase alignment of pcb cache to 16
- ensure the stack is properly aligned when switching ktss
* i386/i386/thread.h:
- add padding tomake iss field end aligned to 16 bytes
* i386/i386/trap.c:
- ensure the state we get after the trap points to the correct place
in the pcb structure
When handling exceptions from IA-32e compatibility mode in user space,
on a 64-bit kernel, the exception stack where error info is pushed
needs to be aligned to 16 bytes (see Intel System Programming guide,
$6.14.2)
The exception stack frame is set in the middle of pcb->iss, but it's not always
16-byte aligned; to make sure it is, we increase the alignment of the
pcb cache and add a padding field in the pcb structure.
This issue resulted in a general protection failure due to CS being
corrupted after a page fault. The corruption was happening when the
exception stack frame was not properly aligned and a page fault
happened; the error info was then pushed after re-aligning the stack,
so the value of eflags was actually written in CS place and other
fields were shifted too.
It also makes sense to ensure this by adding two assertions, although
these were primarly useful during debug.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628101054.446126-10-luca@orpolo.org>
|
|
|
|
|
| |
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-7-luca@orpolo.org>
|
|
|
|
|
|
|
|
| |
The pmap module is a bit limited on 64 bit paging, so this should be
refined when we'll be able to use addresses over 4G.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-6-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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: compile for native x86_64 by default instead of xen
* x86_64/Makefrag.am: introduce KERNEL_MAP_BASE to reuse the constant
in both code and linker script
* x86_64/ldscript: use a .boot section for the very first operations,
until we reach long mode. This section is not really allocated, so
it doesn't need to be freed later. The vm system is later
initialized starting from .text and not including .boot
* link kernel at 0x4000000 as the xen version, higher values causes
linker errors
* we can't use full segmentation in long mode, so we need to create a
temporary mapping during early boot to be able to jump to high
addresses
* build direct map for first 4G in boothdr, it seems required by Linux
drivers
* add INTEL_PTE_PS bit definition to enable 2MB pages during bootstrap
* ensure write bit is set in PDP entry access rights. This only
applies to PAE-enabled kernels, mandatory for x86_64. On xen
platform it seems to be handled differently
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-2-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PCI CONF2 access method was deprecated in PCI v2.0
Also, the conf2 ioport range is only activated for use
as pci configuration space when conf1 registers are accessed
in a particular sequence.
Since the pci-arbiter does not access the conf1 forwarding register,
we are safe to remove this completely from gnumach to allow
normal I/O use of the conf2 range as modern hardware expects.
Message-Id: <20220823032638.292813-1-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <Yo+lzS7RtW5ZjQHN@debian>
|
|
|
|
| |
vm_page_insert would not be able to store the offset.
|
| |
|
| |
|
|
|
|
| |
It shall return a phys_addr_t, not vm_offset_t.
|
|
|
|
| |
The map function is supposed to return physical addresses, thus phys_addr_t.
|
|
|
|
| |
Message-Id: <20220215064133.68593-1-damien@zamaudio.com>
|
|
|
|
|
| |
Otherwise we cannot use _DIST there and have them all taken into account.
As a consequence, we can drop duplicate _DIST between i386 and x86_64.
|
|
|
|
|
|
|
|
| |
* hardclock.c: convert to ANSI
* com.c: ditto
* lpr.c: ditto
* mem.c: ditto
Message-Id: <20220120170004.21722-1-etienne.brateau@gmail.com>
|
|
|
|
| |
Like other defs header do, to allow e.g. including libports/ports.h
|
|
|
|
| |
Notably trap/interrupt/syscall provide an exact SP value.
|
|
|
|
|
| |
When we don't have a frame but PC points to a RET instruction (e.g. in the
userland system call assembly code), we can trivially unwind it.
|
|
|
|
|
| |
User processes loaded in high memory are not visible to ddb through the
direct mapping. We can however read/write data through copy_from/to_phys.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
This is a no-op on i386.
* i386/include/mach/i386/vm_types.h (vm_size_array_t): New type.
* include/mach/mach4.defs (vm_size_array_t): New type.
(memory_object_create_proxy): Turn len parameter from vm_offset_array_t
to vm_size_array_t.
* vm/memory_object_proxy.c (memory_object_create_proxy): Turn len
parameter from const vm_offset_t * to const vm_size_t *.
|
|
|
|
|
|
|
|
|
|
| |
xrstor and xrstors also take the xsave support bitmask.
We were otherwise not necessarily properly reloading all the FPU state,
thus leading to various subtle bugs, notably with glibc 2.33's
ifunc-optimized memcpy etc.
* i386/i386/fpu.h (xrstor, xrstors): Pass fp_xsave_support in EDX:EAX.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vm_page_grab was systematically using the VM_PAGE_SEL_DIRECTMAP selector
to play safe with existing code.
This adds a flags parameter to let callers of vm_page_grab specify their
constraints.
Linux drivers need 32bit dmas, Xen drivers use kvtophys to clear some
data. Callers of kmem_pagealloc_physmem and vm_page_grab_phys_addr also use
kvtophys. Otherwise allocations can go to highmem.
This fixes the allocation jam in the directmap segment.
* vm/vm_page.h (VM_PAGE_DMA, VM_PAGE_DMA32, VM_PAGE_DIRECTMAP,
VM_PAGE_HIGHMEM): New macros.
(vm_page_grab): Add flags parameter.
* vm/vm_resident.c (vm_page_grab): Choose allocation selector according
to flags parameter.
(vm_page_convert, vm_page_alloc): Pass VM_PAGE_HIGHMEM to vm_page_grab.
(vm_page_grab_phys_addr): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* vm/vm_fault.c (vm_fault_page): Pass VM_PAGE_HIGHMEM to vm_page_grab.
* vm/vm_map.c (vm_map_copy_steal_pages): Pass VM_PAGE_HIGHMEM to vm_page_grab.
* kern/slab.c (kmem_pagealloc_physmem): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* i386/intel/pmap.c (pmap_page_table_page_alloc): Pass VM_PAGE_DIRECTMAP to
vm_page_grab.
* xen/block.c (device_read): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* linux/dev/glue/block.c (alloc_buffer): Pass VM_PAGE_DMA32 to vm_page_grab.
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
* i386/i386/pit.h (PITAUX_VAL, PIT_C2): New macros.
(PIT_RATEMODE): Fix macro value.
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Avoid panicing on all CPUs that do not support xsaves.
* i386/i386/fpu.c (init_fpu): Panic on CPUs that do not support xsaves
only if the cpu-reported xsave size is smaller than expected.
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
| |
Before C2X, _Static_assert requires a second parameter
Reported by Andrea G. Monaco <andrea.monaco@autistici.org>
* i386/i386/fpu.c: Add second parameter to _Static_assert calls.
|