Age | Commit message (Collapse) | Author |
|
Message-Id: <20210326094850.2606-5-damien@zamaudio.com>
|
|
Message-Id: <20210326094850.2606-4-damien@zamaudio.com>
|
|
* linux/dev/drivers/block/ahci.c (ahci_probe_dev): Rename spd to det.
|
|
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.
|
|
bash: no: command not found
seems to be confusing for users. Revert to setting back to mig, but
after printing the warning.
* configure.ac (MIG): Default to mig when not found.
|
|
* configure.ac (MIG): Do not default to mig, and warn when this is
missing. Advertise the MIG variable.
|
|
* README: Advise to use i686-linux-gnu-* tools.
|
|
* i386/i386at/com.c (comprobe_general): Reject unit being equal to NCOM.
|
|
* doc/mach.texi(struct thread_sched_info): Add 'int last_processor' item.
Message-Id: <20210120185809.2429-1-gfleury@disroot.org>
|
|
* i386/i386at/comreg.h: Add header guard angaist multiple inclusion.
Message-Id: <20210109180149.11861-1-gfleury@disroot.org>
|
|
This does not make sense, and produces incorrect results (since
vme_end is 0, etc.)
* vm/vm_map.h (_vm_map_clip_start, _vm_map_clip_end): Add link_gap
parameter.
* vm/vm_map.c (_vm_map_entry_link): Add link_gap parameter, do not call
vm_map_gap_insert if it is 0.
(vm_map_entry_link): Set link_gap to 1 in _vm_map_entry_link call.
(_vm_map_clip_start): Add link_gap parameter, pass it to
_vm_map_entry_link call..
(vm_map_clip_start): Set link_gap_to 1 in _vm_map_clip_start call.
(vm_map_copy_entry_link): Set link_gap to 0 in _vm_map_entry_link call.
(vm_map_copy_clip_start): Set link_gap_to 0 in _vm_map_clip_start call.
(_vm_map_entry_unlink): Add unlink_gap parameter, do not call
vm_map_gap_remove if it is 0.
(vm_map_entry_unlink): Set unlink_gap to 1 in _vm_map_entry_unlink call.
(_vm_map_clip_end): Add link_gap parameter, pass it to
_vm_map_entry_link call..
(vm_map_clip_end): Set link_gap_to 1 in _vm_map_clip_end call.
(vm_map_copy_entry_unlink): Set unlink_gap to 0 in _vm_map_entry_unlink call.
(vm_map_copy_clip_end): Set link_gap_to 0 in _vm_map_clip_end call.
* vm/vm_kern.c (projected_buffer_deallocate): set link_gap to 1 in
_vm_map_clip_start and _vm_map_clip_end calls.
|
|
* vm/vm_map.c (vm_map_find_entry_anywhere): Print warning when max_size
gets smaller than size.
|
|
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.
|
|
glibc's sysdeps/mach/hurd/dl-sysdep.c has been wanting to use this for
decades.
* include/string.h (ffs): New declaration.
* vm/vm_map.c: Include <string.h>.
(vm_map_find_entry_anywhere): Separate out high bits from mask, to
compute the maximum offset instead of map->max_offset.
* doc/mach.texi (vm_map): Update documentation accordingly.
|
|
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.
|
|
|
|
Since fp_reg.h is installed on the system, and compilers may not even
support _Static_assert.
* i386/include/mach/i386/fp_reg.h: Move _Static_assert to...
* i386/i386/fpu.c: ... c file.
|
|
vm_offset_t are offsets inside memory objects, not actual addresses.
* include/mach/gnumach.defs (gsync_wait, gsync_wake, gsync_requeue): Use
vm_address_t instead of vm_offset_t.
|
|
We cannot include stdint.h in fp_regs.h since this is included by
mach_types.h for bootstrapping, before we have stdint.h from glibc.
* i386/include/mach/i386/fp_reg.h: Do not include <stdint.h>
(XSAVE_XCOMP_BV_COMPACT, struct i386_xfp_xstate_header): Use unsigned
long long instead of uint64_t.
|
|
It seems that at least qemu does not like our initial state. We can as
well just take it from fninit.
* i386/i386/fpu.c (MXCSR_DEFAULT, CWD_DEFAULT): Remove macros.
(fpu_module_init): Get default state from CPU.
(fpinit): Do not call fninit.
|
|
* i386/i386/fpu.c (init_fpu): Panic if the CPU gives us a size that is
smaller than it should.
|
|
fpu_rstor is not enough, exceptions and such remain behind, so restore
calling fninit.
* i386/i386/fpu.c (fpinit): call fninit() before fpu_rstor().
|
|
The value in fp_state_alloc was actually an oldie, the value in fpinit
was the expected one nowadays.
* i386/i386/fpu.c (CWD_DEFAULT): Set to 0x37f.
|
|
fninit does not clear MMX/SSE/AVX registers, so we have to use rstor to
clear them when starting a new thread. Along the way, we can as well
just have a default state to be loaded in each new thread.
* i386/include/mach/i386/fp_reg.h (XSAVE_XCOMP_BV_COMPACT): New macro.
* i386/i386/fpu.h (fp_default_state): New variable declaration.
* i386/i386/fpu.c (fp_default_state): New variable.
(MXCSR_DEFAULT, CWD_DEFAULT): New macros.
(fpu_module_init): Allocate and initialize fp_default_state.
(fpinit): rstor from fp_default_state instead of setting FPU state by
hand.
(fp_load): Copy initial state from fp_default_state instead of setting
it to 0. This is more future-proof since this is the exact state that we are
loading in fpinit.
(fp_state_alloc): fp_state_alloc: Copy initial state from
fp_default_state.
|
|
* i386/i386/fpu.h (fpu_save, fpu_rstor): New macros.
(fpu_save_context): Use fpu_save macro.
* i386/i386/fpu.c (fp_save): Use fpu_save macro.
(fp_load): Use fpu_rstor macro.
|
|
Now that XSAVEOPT is supported, we are fine with supporting large FPU
state.
* i386/i386/fpu.c (init_fpu): Do not limit fp_xsave_support to
CPU_XCR0_SUPPORTED.
* i386/i386/fpu.h (CPU_XCR0_SUPPORTED): Remove macro.
|
|
* i386/i386/fpu.h (CPU_FEATURE_XSAVEOPT, CPU_FEATURE_XSAVEC,
CPU_FEATURE_XGETBV1, CPU_FEATURE_XSAVES): New macros.
(xsaveopt, xsavec, xsaves, xrstors): New macros.
(fpu_save_context): Use xsaveopt, xsavec, or xsaves when available.
(fp_save_kind): New enum.
(fp_save_kind): New variable declaration.
* i386/i386/fpu.c (fp_save_kind): New variable.
(init_fpu): Set fp_save_kind according to enumeration. When XSAVES is
supported, use xsave area size from corresponding enumeration.
(fp_save): Use xsaveopt, xsavec, xsaves when available.
(fp_load): Use xrstors when available.
|
|
* i386/i386/fpu.c (fp_xsave_size): New variable.
(init_fpu): Save XSAVE size to fp_xsave_size.
(fpu_module_init): Pass fp_xsave_size as size to kmem_cache_init.
(fpu_set_state, fp_load, fp_state_alloc): Use fp_xsave_size to clear
ifps.
* i386/include/mach/i386/fp_reg.h (struct i386_xfp_save): Replace static
fp_yreg_word with extended field.
* i386/i386/thread.h (struct i386_fpsave_state): Make fp_valid field
first in the structure to let the extended finish the structure.
|
|
* i386/i386/fpu.h (CPU_XCR0_X87, CPU_XCR0_SSE, CPU_XCR0_AVX,
CPU_XCR0_MPX, CPU_XCR0_AVX512): New macros.
(xsave): Pass fp_xsave_support to xsave.
(fpu_save_context): When fp_kind is FP_387X, use xsave.
(fp_xsave_support): New variable declaration.
* i386/i386/proc_reg.h (cpuid): New macro.
* linux/src/include/asm-i386/processor.h (cpuid): Disable macro.
* i386/include/mach/i386/fp_reg.h: Include <stdint.h>
(i386_xfp_xstate_header): New structure.
(i386_xfp_save): Add xsave fields.
* i386/i386/fpu.c (fp_xsave_support): New variable.
(init_fpu): Look for XSAVE feature; if available, get the supported
parts and set fp_kind to FP_387X.
(fpu_module_init): Set ifps_cache alignment to alignof(struct
i386_fpsave_state).
(fpu_set_state): Make sure to clear all the ifps structure.
Reuse the FP_387FX for the FP_387X case.
(fpu_get_state, fpexterrflt, fpastintr, fp_state_alloc): Reuse the FP_387FX
for the FP_387X case.
(fp_save): When fp_kind is FP_387X, use xsave.
(fp_load): When fp_kind is FP_387X, use xrstor.
Reuse the FP_387FX for the FP_387X case.
|
|
To leave FP_387X for XSAVE-supporting CPU (as opposed to
FXSAVE-supporting CPU)
* i386/include/mach/i386/fp_reg.h (FP_387X): Rename to FP_387FX.
(FP_387X): New macro.
* i386/i386/fpu.c (init_fpu, fpu_set_state, fpu_get_state, fpexterrflt,
fpastintr, fp_save, fp_load, fp_state_alloc): Update accordingly.
* i386/i386/fpu.h (fpu_save_context): Likewise.
|
|
* i386/include/mach/i386/fp_reg.h (struct i386_xfp_save): Extend
fp_xreg_word to 16 registers.
(sizeof(struct i386_xfp_save)): Assert that it is equal to 512.
|
|
* i386/i386/fpu.h (xgetbv, get_xcr0, xsetbv, set_xcr0): New inline
functions.
(xsave, xrstor): New macros.
* i386/i386/locore.S (cpu_features): Extend to two words.
(cpu_features_edx, cpu_features_ecx): New labels.
(discover_x86_cpu_type): Also save ecx cpuid(1) report.
* x86_64/locore.S: Likewise.
* i386/i386/locore.h (cpu_features): Extend to two words.
(CPU_FEATURE_XSAVE): New macro.
* i386/i386/proc_reg.h (CR4_OSXSAVE): New macro.
|
|
* i386/i386/pio.h (inl, inw, inb, outl, outw, outb): Add N constraint
alternative on port.
(outl): Cast data to unsigned int.
|
|
We do not support shared IRQs for these, so avoid boot issues when
running on a system with more than 2 com ports.
* i386/configfrag.ac (ncom) [at:i?86]: Set to 2.
* x86_64/configfrag.ac (ncom) [at:x86_64]: Set to 2.
|
|
* i386/i386/pit.h: Add header guard angaist multiple inclusion.
Message-Id: <20201122074155.4883-1-gfleury@disroot.org>
|
|
* linux/dev/drivers/block/genhd.c [!CONFIG_BLK_DEV_IDE] (device_setup):
Do not call ide_setup.
|
|
As described in XXX comments, the workaround for memory mapping is
implemented for 80386 and it is unnecessary on i486 or later. Thus, it
is safe to omit that if the kernel is built for the recent (1989~)
processors.
Fuhito Inagawa pointed out the problem to me.
* i386/i386/trap.c (kernel_trap): Disable the workaround when the kernel
is built for i[456]86.
* i386/intel/pmap.c (pmap_protect, pmap_enter): Ditto.
* i386/intel/read_fault.c: Define intel_read_fault if and only if it is
necessary.
|
|
* i386/intel/pmap.c (pmap_enter): Fix debugging print format.
|
|
It seems that ld.so sometimes gets into troubles and hangs at bootstrap.
* kern/elf-load.c (exec_load): When x.e_type == ET_DYN || x.e_type ==
ET_REL, add 128MiB as loadbase.
|
|
* kern/bootstrap.c (STACK_SIZE): Set to 128KB. glibc's
__MAX_ALLOCA_CUTOFF is 64K by default.
|
|
|
|
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
|
|
This pseudoclass generalize the initialization and access of SMP data,
allowing expands it to other architectures. In x86, the functions calls to apic functions.
*kern/smp.c: Source file. Implements a interface to load the SMP functions for the current architecture.
*kern/smp.h: Header file. Add declaration for smp_data structure.
*i386/i386/smp.c: Source file. Implements a set of functions to manage the SMP actions in i386
*i386/i386/smp.h: Header file. Add declarations for SMP functions in i386.
|
|
|
|
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 function allows to map a table in a memory page,
using its physical address,aligning the start of the page with the start of the table
*vm/vm_kern.c (kmem_alloc_aligned_table): New function. Returns a reference for the virtual address of the table.
*vm/vm_kern.h (kmem_alloc_aligned_table): New prototype
|
|
The SMP support requires access, register and configure some APIC structures,
like Local APIC and IOAPIC.
This pseudoclass includes functions to register some APIC structures into the kernel,
and access to these structures to extract some information.
*apic.h: Header file recovered from Mach 4 source code, and updated for xAPIC.
Includes some structs with Local APIC and IOAPIC fields,
and the declaration of the functions.
*apic.c: Source file. Includes the definition of the functions, within some globals
of apic_info structures and the lapic reference.
|