| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Message-ID: <20240309140244.347835-2-luca@orpolo.org>
|
| |
|
|
|
|
|
| |
vm_page_grab_contig does not necessarily allocate at the beginning of
the DMA segment, so rather allocate by hand very early.
|
|
|
|
|
|
|
| |
TESTED: This works in qemu correctly
TESTED: This works on an AMD board with ACPI v2.0 correctly
Message-ID: <20240207050158.1640853-3-damien@zamaudio.com>
|
|
|
|
|
|
| |
self-modifying code is generally frowned upon, Intel largely says the
support is model-dependent. We can as well just relocate from the C
code like we did for the temporary gdt.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This took some time to figure out.
Involves a hand-crafted 16 bit assembly instruction [1]
because it requires an immediate for the memory address
of far jump. This required self-modifying code
to inject the next instruction, therefore I added a near
jump to clear the instruction cache queue in case the pipeline
cached the unmodified jump location.
[1] Intel Architecture Software Developer's Manual,
Volume 2: Instruction Set Reference Manual
|
|
|
|
|
|
|
|
|
| |
This enables gnumach to additionally parse the XSDT table
if the revision of ACPI is 2.
TESTED: Still works on qemu (ACPI v1.0)
TESTED: Works on a x86 board with XSDT (ACPI v2.0)
Message-ID: <20240131021218.1335821-1-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
Move cninit() further down so that IOAPIC has a chance
to initialize before the com port interrupt is unmasked
in the IOAPIC, fixing a fault and reboot.
Message-ID: <20240131100210.1354522-1-damien@zamaudio.com>
|
| |
|
|
|
|
| |
Message-Id: <20231001045755.95707-1-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20231001045731.95682-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This speeds up smp again, by storing the struct processor
in a percpu area and avoiding an expensive cpu_number every call
of current_processor(), as well as getting the cpu_number by
an offset into the percpu area. Untested on 64 bit
and work remains to use other percpu arrays.
TESTED: (NCPUS=8) -smp 1 boots to login shell ~2x slower than uniprocessor
TESTED: (NCPUS=8) -smp 2 boots to INIT but hangs there
TESTED: (NCPUS=8) -smp 4 gets stuck seemingly within rumpdisk and hangs
TESTED: (NCPUS=1) uniprocessor is a bit faster than normal
Message-Id: <20230924103428.455966-3-damien@zamaudio.com>
|
|
|
|
| |
spl cannot be called before the clock is set up.
|
| |
|
|
|
|
| |
So that userland's uname -m still reports i686-AT386.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the lapic timer was calibrated by one-shot PIT timer2.
This method can be buggy and generally unused in emulation environments.
This patch reworks the timer calibration to use a mach timer based
on regular PIT interrupts to remapped IOAPIC pin.
This also changes the primary clock source to use PIT timer0 remapped
to an IOAPIC pin when APIC mode is enabled, instead of a periodic lapic
timer.
Message-Id: <20230306070452.292697-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes boot --enable-ncpus=1 with --enable-apic configuration
albeit the keyboard is stuck and network cannot be accessed.
Error messages:
Timeout reached while wating for return value
/bin/console: Could not receive return value from daemon process: Connection timed out
Message-Id: <20230219022351.25767-1-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
This also serialises the AP bringup, so paging can be enabled per cpu
one by one.
Also-by: Almudena Garcia <liberamenso10000@gmail.com>
|
|
|
|
|
|
| |
We haven't built gnumach using a.out for a very long time.
Message-Id: <Y+SgsQ3y8pPqfxRV@jupiter.tail36e24.ts.net>
|
|
|
|
| |
Message-Id: <20230203100133.835589-1-damien@zamaudio.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* device/ds_routines.c: use static qualifier.
* device/subrs.c: delete unused functions.
* i386/i386/ast_check.c: include prototypes in kern/ast.h
* i386/i386/db_disasm.c: Include prototypes in ddb/db_examine.h
* i386/i386/db_interface.h: Define prototype for kdb_kentry. Expose
debug methods feep and kd_debug_put.
* i386/i386/db_trace.c: delete left over cthreads support, functions are
not used.
* i386/i386/model_dep.h: Define prototype for c_boot_entry.
* i386/i386at/acpi_parse_apic.c: Static qualifiers.
* i386/i386at/autoconf.c: Include header file for prototypes and remove
dead code.
* i386/i386at/autoconf.h: Fix prototype.
* i386/i386at/com.c: Add static qualifiers, delete dead code.
* i386/i386at/com.c: ditto.
* i386/i386at/com.h: Define prototypes for debug functions.
* i386/i386at/int_init.c: Include header.
* i386/i386at/kd.c: Include header for debug interface. Remove dead
kd_cmdreg_read and make xga_getpos static.
* i386/i386at/kd_mouse.c: Static qualifiers.
* i386/i386at/lpr.c: Dead lprpr.
* i386/i386at/model_dep.c: Remove exit function.
* kern/mach_clock.c: Include mig prototypes.
* kern/mach_clock.h: Remove duplicates of mig prototypes.
* kern/machine.c: Use static.
* kern/startup.c: slave_main is unused.
* kern/thread.h: Define thread_stats that is useful for debugging.
* kern/timer.c: Keep db_thread_times since it can be used for debugging.
* kern/timer.h: ditto.
* linux/dev/glue/misc.c: Use mig header for host_get_time.
Message-Id: <Y8oyiecaflCaYhaW@mercury.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
time_value64_t uses int64_t to track seconds and nanoseconds and hence
is Y2038 proof. It does not have nano second resolution but it could
be provided in the future.
Removed include/sys/time.h as it remaps time_value_t into timeval which
can create confusion.
The timestamp from keyboard and mouse events is no longer set and
replaced with rpc_time_value for better compatibility.
|
|
|
|
|
|
|
|
| |
The format constants are not correct for 32 bits and there was
duplication for PRIx* constants (replaced with octal constants).
Fixed a few format warnings too.
Message-Id: <Y6o5KsvtPavCYe8f@mars>
|
|
|
|
|
|
|
|
|
|
|
| |
Marked some functions as static (private) as needed and added missing
includes.
This also revealed some dead code which was removed.
Note that -Wmissing-prototypes is not enabled here since there is a
bunch more warnings.
Message-Id: <Y6j72lWRL9rsYy4j@mars>
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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/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.
|
|
|
|
|
| |
* i386/i386at/model_dep.c (register_boot_data): Register reserved
biosmem areas only when they have a non-zero size.
|
|
|
|
|
|
| |
* i386/configfrag.ac (register_boot_data): Process modules only when
their count is non-zero.
(i386at_init): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* i386/i386at/model_dep.c (halt_all_cpus): Change halt message to better
explain what happened.
|
|
|
|
|
|
|
|
|
| |
This reverts commit c031b41b783cc99c0bd5aac7d14c1d6e34520397.
Adding the ACPI parser from GRUB was a mistake as its license
conflicts with the one used by the legacy Linux drivers. Furthermore,
adding support for ACPI to the kernel violates the minimality
principle.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, we used contiguous page directories four pages in length
when using PAE. To prevent physical memory fragmentation, we need to
use virtual memory for objects spanning multiple pages. Virtual
kernel memory, however, is a scarce commodity.
* i386/intel/pmap.h (lin2pdenum): Never include the page directory pointer table index.
(lin2pdenum_cont): New macro which does include said index.
(struct pmap): Remove the directory base pointer when using PAE.
* i386/intel/pmap.c (pmap_pde): Fix lookup.
(pmap_pte): Fix check for uninitialized pmap.
(pmap_bootstrap): Do not store the page directory base if PAE.
(pmap_init): Reduce size of page directories to one page, use
direct-mapped memory.
(pmap_create): Allocate four page directories per pmap.
(pmap_destroy): Adapt to the discontinuous directories.
(pmap_collect): Likewise.
* i386/i386/xen.h (hyp_mmu_update_la): Adapt code manipulating the
kernels page directory.
* i386/i386at/model_dep.c (i386at_init): Likewise.
|
|
|
|
|
|
| |
* i386/i386at/model_dep.c (register_boot_data): For multiboot cmdline,
module structure, module data and module strings, set
biosmem_register_boot_data temporary parameter to TRUE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old assumption that all physical memory is directly mapped in
kernel space is about to go away. Those variables are directly linked
to that assumption.
* i386/i386/model_dep.h (phys_first_addr): Remove extern declaration.
(phys_last_addr): Likewise.
* i386/i386/phys.c (pmap_zero_page): Use VM_PAGE_DIRECTMAP_LIMIT
instead of phys_last_addr.
(pmap_copy_page, copy_to_phys, copy_from_phys): Likewise.
* i386/i386/trap.c (user_trap): Remove check against phys_last_addr.
* i386/i386at/biosmem.c (biosmem_bootstrap_common): Don't set
phys_last_addr.
* i386/i386at/mem.c (memmmap): Use vm_page_lookup_pa to determine if
a physical address references physical memory.
* i386/i386at/model_dep.c (phys_first_addr): Remove variable.
(phys_last_addr): Likewise.
(pmap_free_pages, pmap_valid_page): Remove functions.
* i386/intel/pmap.c: Include i386at/biosmem.h.
(pa_index): Turn into an alias for vm_page_table_index.
(pmap_bootstrap): Replace uses of phys_first_addr and phys_last_addr
as appropriate.
(pmap_virtual_space): Use vm_page_table_size instead of phys_first_addr
and phys_last_addr to obtain the number of physical pages.
(pmap_verify_free): Remove function.
(valid_page): Turn this macro into an inline function and rewrite
using vm_page_lookup_pa.
(pmap_page_table_page_alloc): Build the pmap VM object using
vm_page_table_size to determine its size.
(pmap_remove_range, pmap_page_protect, phys_attribute_clear,
phys_attribute_test): Turn page indexes into unsigned long integers.
(pmap_enter): Likewise. In addition, use either vm_page_lookup_pa or
biosmem_directmap_end to determine if a physical address references
physical memory.
* i386/xen/xen.c (hyp_p2m_init): Use vm_page_table_size instead of
phys_last_addr to obtain the number of physical pages.
* kern/startup.c (phys_first_addr): Remove extern declaration.
(phys_last_addr): Likewise.
* linux/dev/init/main.c (linux_init): Use vm_page_seg_end with the
appropriate segment selector instead of phys_last_addr to determine
where high memory starts.
* vm/pmap.h: Update requirements description.
(pmap_free_pages, pmap_valid_page): Remove declarations.
* vm/vm_page.c (vm_page_seg_end, vm_page_boot_table_size,
vm_page_table_size, vm_page_table_index): New functions.
* vm/vm_page.h (vm_page_seg_end, vm_page_table_size,
vm_page_table_index): New function declarations.
* vm/vm_resident.c (vm_page_bucket_count, vm_page_hash_mask): Define
as unsigned long integers.
(vm_page_bootstrap): Compute VP table size based on the page table
size instead of the value returned by pmap_free_pages.
|