Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier b5a3401119 Enable NVMM.
It works!
(cherry picked from commit 56c1178ccbc073733f10a10ab1dfac433bdec3fd)

Change-Id: Ie66aabbbbdac0923f78acc4edb895cf2f8810c9f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11317
Reviewed-by: waddlesplash <[email protected]>
2026-07-22 03:42:13 +00:00
Augustin Cavalier b0310ba160 nvmm: Always use B_FULL_LOCK for non-swapping caches.
Otherwise the page daemon will unmap pages unnecessarily.
2026-07-22 03:14:58 +00:00
Augustin Cavalier 27c16710b9 nvmm: Implement curthread_save/restore_fpu.
It actually is needed to reset MXCSR.

Doesn't seem to affect behavior, though.
2026-07-22 03:14:57 +00:00
Augustin Cavalier e0ff341bce kernel: Check early safemode options in frame_buffer_console_init.
(cherry picked from commit 596150abbbf4e79d6c50d253c867e5200ae60017)

Change-Id: I691540cad733a342f50ad54bcbcedb878a549863
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11315
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-07-22 03:09:24 +00:00
Augustin Cavalier 7dc7df27e9 x86: Make "Disable BIOS calls" boot option actually work.
It was a complete no-op before. Now, when enabled, BIOS calls
won't be done past the bootloader, and the Framebuffer driver
will be used instead of VESA.
(cherry picked from commit 7f12208162a5fc676f7a03e050f7671919f4fb12)

Change-Id: Id7670cc060ab5273411222e27467a6dfdbbb9e7f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11313
Reviewed-by: waddlesplash <[email protected]>
2026-07-22 02:31:43 +00:00
Augustin Cavalier bb98e98305 safemode_defs: Sort and organize.
No functional change. Reasonably we should have architecture-specific
headers for some of these, but that can wait.
(cherry picked from commit 450728b4b717b3ea09fb2145daf2e6a24874c6de)

Change-Id: I887d37a54b44e127e4d1fe46675bf57bc2a392dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11312
Reviewed-by: waddlesplash <[email protected]>
2026-07-22 02:31:04 +00:00
Augustin Cavalier d56f3f2265 usb_disk: Change a dprintf to CALLED.
(cherry picked from commit b861fcbd866e04256d46725bd5a26f3ea1c5ff8c)

Change-Id: I314b98b8a5c7a0f1e3304b473b82fa759dff60f3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11307
Reviewed-by: waddlesplash <[email protected]>
2026-07-21 22:30:18 +00:00
Augustin Cavalier 0c29b31205 usb_disk: Unpublish devices in the driver removed hook.
We publish devices in the driver register hook, and if we try
to unpublish them from the device removed hook, not the driver
removed hook, we'll confuse the device_manager and cause it
to do use-after-frees on list iteration.

The two are called in quick succession of each other, so this
shouldn't cause problems.

Fixes a KDL reported by OscarL when unplugging a USB card reader
(which I reproduced with another USB card reader.) It seems the problem
would happen with any USB disk device that published more than
one LUN.
(cherry picked from commit a688b173e7c1e903845b6cac78baa7bd2ea23c31)

Change-Id: Ia9fae3428a45e199cb2c903acfe9c689dfa9bed4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11305
Reviewed-by: waddlesplash <[email protected]>
2026-07-21 22:25:07 +00:00
Augustin Cavalier 42371830dc usb_disk: Don't try to reset or test if the device was removed.
Avoids the media checker retrying uselessly after devices have been
removed.
(cherry picked from commit a88cbfae4fcaf80d8786d144fccbeb349c3bd91b)

Change-Id: I3fefcbe515bf46bb84b6a6476e9cef7dcbbb48eb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11304
Reviewed-by: waddlesplash <[email protected]>
2026-07-21 22:24:59 +00:00
Augustin Cavalier bf5e6e673f kernel/device_manager: Pass the correct pointer to device_removed.
We want the DriverData not the device_node.

Discovered while working on usb_disk. I wonder if anyone ever actually
used this method for hot-unplug before...? Looking at the source code
of other modules, only a select few try to do anything with the cookie,
and most of those likely don't use hot-unplug.
(cherry picked from commit 5fec48b27d7b4c1c831b93db3d4abc1cfaee4982)

Change-Id: Iaf8973b8212758ba2148ad88832f9f96aa5158f1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11303
Reviewed-by: waddlesplash <[email protected]>
2026-07-21 22:24:30 +00:00
Augustin Cavalier 5c0e7a34aa kernel/x86: Fix the build with KDEBUG_LEVEL 0.
(cherry picked from commit 99502154ea8699761f7b8dd7705e51ac62e3ea28)

Change-Id: Ibd6a544f8b5dfb912423d9d58fc5d3ec7b1947dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11293
Reviewed-by: waddlesplash <[email protected]>
2026-07-21 20:03:11 +00:00
Augustin Cavalier 1f0f4c0937 ACPI & PCI: Move the x86 config space fallback to the PCI module.
This way, we can use it even after the "early" boot phase is over
but before PCI is initialized, and also add the locking necessary
once there are multiple threads.

Should fix #20196.

Change-Id: Ie96daf44cc7c82050d0aa686d0d395228ffa4f20
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11285
Reviewed-by: waddlesplash <[email protected]>
(cherry picked from commit 4e8abe02f6384e6c35895785557b1eeaed85a607)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11287
2026-07-21 17:56:30 +00:00
Augustin Cavalier 779d435149 Adjust repositories to r1beta6. 2026-07-18 21:12:51 -04:00
Augustin Cavalier 04fcdf7756 build: Enable HAIKU_OFFICIAL_RELEASE. 2026-07-18 21:10:16 -04:00
Augustin Cavalier 32edc757b0 Disable serial debug output by default.
EFI doesn't have a boot keys mechanism so we just disable the
routine that enables it entirely. Also disable it in early kernel
output before the settings file has been read.
2026-07-18 21:09:32 -04:00
Augustin Cavalier 103df455af kernel_debug_config: Turn KDEBUG_LEVEL down from 2 to 1.
Per the ReleaseCookbook.
2026-07-18 21:09:02 -04:00
Augustin Cavalier 86e70e9a62 Versioning: This will be R1/beta6. 2026-07-18 21:08:43 -04:00
Augustin Cavalier 618e42b86d Versioning: Add BETA_6 and PRE_BETA_7 version constants.
* PRE_BETA_7 is now the default in master.
2026-07-18 21:07:28 -04:00
Augustin Cavalier edf3ed94bf Tracker: Drop Sync() during copy operations.
This mostly reverts commit e8d394bd51.

After the changes to how modified page writes are handled,
this shouldn't be needed anymore.

Fixes #19673.

Change-Id: I1d55f5b80f10836b3eee74a1165a682375d10ec6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11268
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-07-18 18:51:43 +00:00
Augustin Cavalier 47a645b6a0 kernel/fs: Fix reference leak of KDiskDevices.
WriteLockDevice() acquires a reference, so we have to release that
after we unlock.

May help with #18044.

Change-Id: I9f7b32ec044c310091079e17669d2186b9f6a155
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11267
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-07-18 18:51:43 +00:00
Augustin Cavalier 3bfaa91290 kernel/vm: Per-KDiskDevice modified queues and page writers.
This solves an old TODO, that the page writer could potentially cause
deadlocks when writing pages of different devices back at once. It's
also necessary after the previous change, as otherwise simultaneous
writes to disks with different write speeds would cause the quota
computations to be fluctuating and inconsistent.

Change-Id: I1c485f66625ea9013f17ab4fee007d7d58afd2ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8619
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-07-18 18:51:43 +00:00
Augustin Cavalier de0a0420a8 kernel/vm: Implement modified page quotas and wait for them in the file cache.
Otherwise, if we're marking pages modified faster than we can
write them out, the number of modified pages will just grow
unboundedly. This can lead (e.g.) to `sync` taking multiple
minutes after copying a lot of data to a slow disk. So, instead,
we now have a quota of no more than 3 seconds for all pages
to be written back.

Also drop a TODO comment from the page_writer thread. Since
we only start writing pages if there's at least 256 to be written,
or if someone wakes us up deliberately (which the page daemon
does, if it schedules pages to be written out), we shouldn't
need to wait shorter.

This should fix #5777 and related tickets.

Change-Id: I4d419d149ea780677b462f5fa46cfe4d65044b2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10811
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-07-18 18:51:43 +00:00
Augustin Cavalier ebedce12c3 kqueue: Notify when semaphores and ports are closed.
Use EV_EOF for this purpose.

Follows up on #19974.
2026-07-17 16:55:42 -04:00
Augustin Cavalier 6fcd55350f kernel/vm: Check page ACCESS state in UnaccessedPageUnmapped. 2026-07-17 16:55:42 -04:00
Augustin Cavalier 22b415d0c7 kernel/vm: Make vm_page::physical_page_number const.
For safety.
2026-07-17 16:55:42 -04:00
Augustin Cavalier 77ce22f10a kernel/fifo: Don't allow selecting events we don't support.
fd_select() will just ignore them and set the selected_events
appropriately.

Change-Id: I122fe35be5ac5fca3ae8544fd78268fdc6a15a02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11253
Reviewed-by: waddlesplash <[email protected]>
2026-07-16 14:37:51 +00:00
Augustin Cavalier d4c6110550 kernel/device_manager: Clarify IOBuffer::LockMemory second argument.
It doesn't mean "write to this memory", but rather "this is for
a write IORequest" (i.e. if true, the memory will be read from
only.)

No functional change, but clarifies things around #20173.
2026-07-15 20:43:53 -04:00
Augustin Cavalier 5d403cc1e7 kernel/vm: Correct inversion of B_READ_DEVICE in lock_memory().
The documentation comment just above explains its purpose correctly:

> requests that the range must be wired writable ("read from device
> into memory").

The Be Book confirms, and there are numerous examples in the Haiku
source which are written with this behavior in mind. It appears the
original implementation of this function got it right, but then
it was broken in 550376ffb8 (which,
coincidentally, is the same commit that added the documentation
comment quoted above...)

Primary fix for #20173.
2026-07-15 20:38:42 -04:00
Augustin Cavalier f03c1740a5 kqueue: Add support for Haiku-specific object types.
Apple Darwin also extends kqueue to support other object types,
like Mach ports, so we might as well do the same for Haiku (Be)
object types.

Fixes #19974.
2026-07-15 20:01:11 -04:00
Augustin Cavalier d25d9bef1e kernel/event_queue: Also report behavior in Select().
Probably not necessary but we might as well.

Change-Id: Ie299e72f9a85d932bbe4ff7f8d313297cdb6e962
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11252
Reviewed-by: waddlesplash <[email protected]>
2026-07-09 19:41:45 +00:00
Augustin Cavalier 53630a31a0 kqueue: Implement EV_RECEIPT.
Tested with a modified FreeBSD test.

Also fix EVFILT_READ + EVFILT_WRITE failing to select only returning
one error, and not two as it's supposed to.
2026-07-09 15:36:05 -04:00
Augustin Cavalier 1699186567 kernel/event_queue: Copy back all results at once.
Copies more bytes, but should be cheaper overall as user_memcpy
does have overhead.
2026-07-09 15:31:18 -04:00
Augustin Cavalier b309eb594c kernel/event_queue: Report back what events were actually selected.
If less than requested was selected, userland will want to
know that.
2026-07-09 15:23:34 -04:00
Augustin Cavalier e388b7dedb BFS: Update node times when the file size changes.
Fixes #20164.

Change-Id: I4b66cbcc5e9b0e8bf34564b4fa5d54f0b67e835f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11199
Reviewed-by: waddlesplash <[email protected]>
2026-07-09 17:43:12 +00:00
Augustin Cavalier 8bd9d9bb9b app_server: Fix lock order inversion in HWInterface cursor routines.
Fixes the hang reported in #2539.
2026-07-01 12:30:22 -04:00
Augustin Cavalier 0e76803f9e vesa: Update the kernel framebuffer information when changing modes.
We need to update it even if we don't remap. Otherwise the KDL
screenmode will be wrong.

Noticed in #2539.
2026-07-01 12:29:38 -04:00
Augustin Cavalier 59e22cef16 bootloader: Restore activation of CR0 PAGING bit in init_page_directory.
Otherwise it may not be activated until much later.

May fix #20155.
2026-06-30 16:56:55 -04:00
Augustin Cavalier c0317b3e7b kernel: Revert UserTimer deletion changes.
This reverts a small portion of f5842905e3.

I added these asserts instead of the deletions to hedge against
the Team/Thread reaching this point with timers still active.
But it seems that doesn't happen, while if thread init fails
due to OOM, we have the default timers still present, which need
to be deleted.

Fixes #20154 and #20148.
2026-06-30 16:37:01 -04:00
Augustin Cavalier ad6cb5efd3 app_server: More fixes to screen configuration management.
* Retrieve info from the stored configuration in GetScreenMode &
   GetScreenFrame if needed.

 * Use the stored configurations in _SetCurrentWorkspaceConfiguration.

The last part seems to fix #20136.
2026-06-30 16:21:38 -04:00
Augustin Cavalier 41ca6fdabd network/unix: Return as soon as we've written the minimum data.
Otherwise we could block forever if the data size is
larger than the buffer size. Partial writes are an
expected behavior of stream sockets, so this should
not cause any other problems.

Fixes #20163.
2026-06-30 14:55:23 -04:00
Augustin Cavalier 95703fb82d ramfs: Update file times on resize even if the size stays the same.
Part of #20164.
2026-06-30 14:01:06 -04:00
Augustin Cavalier 3970f91248 ramfs: Coding style cleanup to File, no functional change. 2026-06-30 13:55:03 -04:00
Augustin Cavalier e079fff682 file_systems/bindfs: Pass the correct node to the underlying FS in rename().
We were passing our own fs_vnode, not the underlying filesystem's.

I guess this was just never tested, because it would've always crashed?

Fixes #20156.
2026-06-30 13:38:21 -04:00
Augustin Cavalier ac8b58038a network/stack: Use DoublyLinkedList<> instead of struct list for data_nodes.
Includes better assertion checking (and allows more things to be
inlined.)
2026-06-23 15:13:19 -04:00
Augustin Cavalier 2221fefb84 Tracker: Rework the file panel initialization locking changes.
* Don't unlock in ContainerWindow's constructor; instead leave
   the BWindow locked, as the BWindow constructor itself does.

 * Call Run() at the end of TFilePanel's constructor. This way,
   the TFilePanel will be in the state existing applications expect
   it to be after the constructor runs (i.e. running and not locked),
   while also performing all necessary initialization before actually
   doing that, to avoid races.

 * Drop TFilePanel::Show as it's not needed now.

 * Revert changes to BFilePanel::Show as they're now not neede.

I retested #19499 with this change, and couldn't get it to reproduce
(while it reproduced easily with Run() called at the top of TFilePanel()
followed by the Lock/Unlock scheme.)

This should be a much simpler solution that hopefully will cause no
regressions in any of #19499, #20125, #20128, #20131, #20144.
2026-06-23 15:08:03 -04:00
Augustin Cavalier eabae69d20 Tracker: Reacquire the lock in TFilePanel::Show.
See inline comment.

Fixes #20144.
2026-06-23 14:41:23 -04:00
Augustin Cavalier dbaf648047 app_server: Properly lock the HWInterface in cursor routines.
A comment in the header says the cursor handling functions "do their
own Read/Write locking", but they didn't actually lock the framebuffer.

Should fix #20141 and #2539.
2026-06-23 12:03:13 -04:00
Augustin Cavalier 2b6e9091da kernel/slab: Fix KDEBUG check.
KDEBUG itself is an expression already.
2026-06-22 14:52:02 -04:00
Augustin Cavalier bc3624c0a9 kernel/vm: Fix typo in comment. 2026-06-22 14:51:41 -04:00
Augustin Cavalier 22d9a23207 kernel/device_manager: Add some missing checks in DMAResource::TranslateNext.
* Ensure memory is locked before doing virtual->physical translation.

 * Make sure get_memory_map_etc actually returned an entry.

I didn't see either of these trip in some basic testing though.
2026-06-22 14:51:27 -04:00
Augustin Cavalier 7bee547af0 kernel/x86: Assert locked in X86VMTranslationMap64Bit::Map. 2026-06-22 14:50:29 -04:00
Augustin Cavalier 719b0ce380 kernel/vm: Consolidate and add an assert in vm_page. 2026-06-18 18:06:09 -04:00
Augustin Cavalier 59fb06ae9d kernel/vm: Overhaul set_memory_protection's handling of caches with multiple areas.
* Properly handle copy-on-write in the case of consumers, same as
   set_area_protection. This seems to fix most of the remaining problems
   in boehm-gc's mprotect-VDB.

 * Do not call set_area_protection if the whole range is covered,
   as it tries to acquire address space locks, which can lead to
   deadlocks: that was the cause of #20138. Instead, handle changing
   the protection of all pages in here.

 * Don't unmap pages of lower caches; just don't allow writing to
   those pages. This allows us to avoid unlocking the translation map,
   and also should mean a lot fewer page faults, hopefully improving
   performance.

Fixes #20138.
2026-06-18 18:06:09 -04:00
Augustin Cavalier bd8dfa4693 kernen/device_manager: Add a missing clear of an area_id.
Probably not needed, but doesn't hurt.
2026-06-18 18:06:09 -04:00
Augustin Cavalier 7214df8d3c kernel/slab: Keep ACCESS page state during mapping.
We don't assert this inside Map() at present, but I added one there
for debugging purposes, and this is one of the few places that tripped.
2026-06-18 18:06:09 -04:00
Augustin Cavalier 61445814f2 kernel/vm: Allow calling AddressSpaceWriteLocker::SetTo with something already set.
Other Lockers behave this way, and the behavior will be needed in
_user_set_memory_protection.
2026-06-18 18:06:09 -04:00
Augustin Cavalier 2e98b42157 kernel/vm: Add some more ASSERT_WRITE_LOCKED assertions. 2026-06-18 18:06:09 -04:00
Augustin Cavalier 40c254f71c kernel/locks: Allow passing const rw_locks to ASSERT_READ_LOCKED_RW_LOCK. 2026-06-18 18:06:09 -04:00
Augustin Cavalier 22a2180aa5 app_server: Always store the current configuration when adding screens.
Should hopefully fix #20136.

Change-Id: I29730bdb9bd9ceaaa68028f00797cc275ecd4629
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11107
Reviewed-by: waddlesplash <[email protected]>
2026-06-14 02:34:18 +00:00
Augustin Cavalier 2a0ccdfd34 app_server: Handle brightness more similarly to other screen configurations.
Untested as I don't have hardware with supported brightness control,
but the changes are relatively straightforward.

Should fix #20134.

Change-Id: I45b78bc8006a54cc5ba4f65a026df99401c621b5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11083
Reviewed-by: waddlesplash <[email protected]>
2026-06-14 02:34:18 +00:00
Augustin Cavalier 2a209bcf58 build: Enable S3 driver & accelerant on x86_64.
It works there now. Fixes #20112.
2026-06-10 11:58:27 -04:00
Augustin Cavalier dd5feaa4a6 freebsd_network: Drop the scan_done_sem.
It's not used anymore. Thanks to madmax for noticing!
2026-06-10 11:57:17 -04:00
Augustin Cavalier 7288df8b9c nvmm: Reinstate fallback in os_mtx_lock.
It is actually needed for the VMX backend at least.
2026-06-10 11:50:52 -04:00
Augustin Cavalier 4402cb4497 nvmm: Implement FPU save/restore.
Otherwise, the host won't be able to modify the guest FPU (and we could
clobber the state, too.)

This doesn't seem to fix the general problems seen so far, however.
2026-06-08 16:31:21 -04:00
Augustin Cavalier e2accec408 nvmm: Remove now-unnecessary hack from os_mtx_lock().
It's not needed after implemeting a real os_return_needed.
2026-06-08 16:31:21 -04:00
Augustin Cavalier aeadb071a2 Tracker: Fix deadlock on opening file panels a second time.
Follows up on #20125.
2026-06-08 16:24:06 -04:00
Augustin Cavalier 29393e16ae graphics/s3: Fixes for 64-bit.
Untested as I don't have this hardware, but relatively straightforward.

Part of #20112.
2026-06-08 12:11:18 -04:00
Augustin Cavalier 658cb74bed kernel/x86: Initialize CR0 in the kernel more than the bootloader.
The bootloader is now only responsible for setting up Protected Mode
and Paging. It otherwise preserves the existing CR0, and leaves setup
to the kernel.

The kernel now sets CR0 for each CPU in preboot_init_percpu().
Some redundant sets are removed from x86_init_fpu, which now
panic()s in the case where we don't have a FPU, and avoids
unnecessary prints.

This fixes a massive oversight where CR0 was never reset on x86
systems booted using the EFI loader, except on the boot CPU! That
meant that NUMERIC_ERROR and possibly even WRITE_PROTECT were
simply not set on non-boot CPUs, unless the EFI BIOS had set them up
already. (On the BIOS loader, smp_start_kernel() ran on all CPUs.)

Fixes NVMM initialization on non-boot CPUs on Intel hardware.
2026-06-04 18:18:28 -04:00
Augustin Cavalier de79d42abb nvmm: Use dummy kernel & current process maps to avoid allocations.
Removes a bunch of #ifdef __HAIKU__ and avoids unnecessary overhead.
2026-06-04 12:35:08 -04:00
Augustin Cavalier 6f1500d726 kernel/arm64: Add missing "memory" attribute to barrier functions. 2026-06-04 11:16:31 -04:00
Augustin Cavalier d2fdc62fd6 kernel/debug: Check gKernelStartup before printing "CPUs not trapped".
They won't be trapped during kernel startup.
2026-06-04 11:14:34 -04:00
Augustin Cavalier 9b6a529847 kernel/vm: Make VM internal methods C++-only.
They shouldn't be needed from C.

Also add a declaration for VMAddressSpace. This should fix the
RISC-V build.
2026-06-04 11:13:53 -04:00
Augustin Cavalier dd14b451e9 build: Add NVMM, but commented out, to image definitions.
At present, it can boot TinyCore Linux to a GUI, but a Haiku
image reaches the rocket before crashing with an NVMM error,
when tested under nested virtualization in VMware. (It seems
my Intel device is a few generations too old and doesn't have
all required features, so I wasn't able to test there.) So,
some more work is still required, it seems.
2026-06-03 23:12:43 -04:00
Augustin Cavalier fbed0c1424 nvmm & kernel: Implement proper TLB flushing for the nested paging. 2026-06-03 23:12:43 -04:00
Augustin Cavalier 827af4d89a nvmm: Make use of cpu_ent::reschedule_disabled.
This allows the removal of the hacks in VMX support (admittedly
I did not test this, but the equivalent setup works on AMD.)
2026-06-03 23:12:36 -04:00
Augustin Cavalier 08037f3107 kernel/scheduler: Add a mechanism to block reschedules.
This will be used by NVMM, which wants interrupts enabled
but not to be actually preempted until it is safe to do so.
2026-06-03 23:04:56 -04:00
Augustin Cavalier be817ba080 nvmm & kernel: Implement necessary functions/classes for AMD support. 2026-06-03 23:04:56 -04:00
Augustin Cavalier 099de13932 nvmm: Implement necessary functions and classes for Haiku.
Intel VMX only.

Co-authored-by: Augustin Cavalier <[email protected]>
2026-06-03 23:04:56 -04:00
Augustin Cavalier 6e43f9a34a bsd/sys/cdefs.h: Additions for NVMM. 2026-06-03 23:04:55 -04:00
Augustin Cavalier aa731510c1 kernel/vm: Changes to prepare for NVMM.
* VMUserAddressSpace & VMTranslationMap64Bit will need to be inherited from.

 * vm_soft_fault & vm_unmap_address_range will need to be invoked directly.

 * map_backing_store will need to be invoked directly. The whole concept
   of "backing stores" is long merged into VMCache anyway, so at the
   same time, just rename the method to "vm_map_cache".

Methods added to the internal vm_priv.h; they should not be needed
except in special circumstances.
2026-06-03 23:04:55 -04:00
Augustin Cavalier 0088ac13b0 app_server: Refactors to screen configuration management.
* Drop screen_configuration::is_current. This just caused significant
   confusion and problems, because values could get out of sync between
   the Stored and Current screen configuration storage.

 * Try to match by monitor_info always, not just ID.

 * Add the current vs. stored Configurations distinction to VirtualScreen.
   This will populate the CurrentScreenConfiguration object during
   initial configuration of screens.

Fixes app_server not properly reverting to the original resolution after
apps that change the resolution quitting, which was seen in #20042.

Change-Id: I61c9ee4c5b7e755cbb207170d2eddb1d31fd0ea8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11024
Reviewed-by: waddlesplash <[email protected]>
2026-05-28 01:22:15 +00:00
Augustin Cavalier 914768faa8 kernel/timer: Reinstate lazy timer resetting.
This reverts dbc6b2061e.

Hopefully after the various fixes to APIC timer setup, the
problems that this was causing will be gone. (The users who
reported issues with it did so only on the forums and never
opened tickets, it seems.)
2026-05-21 15:12:00 -04:00
Augustin Cavalier 5dfc0663d5 kernel/x86: Avoid using any initial values in APIC timer registers.
We should just be zeroing any unknown bits, not trying to preserve them.
If the BIOS or other mechanisms left the timer in some other mode
besides "one-shot" like we need, then we might incorrectly preserve
those bits.

This also has the advantage of avoiding config reads in set_hardware_timer.
2026-05-21 15:01:17 -04:00
Augustin Cavalier faa27a36dd kernel/thread: Print pinned_to_cpu when dumping thread information.
May help with diagnosing #20100.
2026-05-21 14:06:12 -04:00
Augustin Cavalier 51bbd3778c kernel/smp: Drop the "last caller" spinlock debug system.
Even on a single-core software-emulation QEMU VM, we acquire more
than 10k spinlocks per second (sometimes even over 100k.) That makes
sense, as every syscall entry, mutex acquisition (even uncontended,
for KDEBUG kernels), etc. acquires a spinlock. So, reasonably, this
list will always be too small to detect much of anything at this point.

If we need a similar debugging facility, we should store addresses
or thread IDs in the lock structure. That will require a more significant
refactor to locking code, however, and it doesn't seem necessary at this
time, so I haven't implemented that (yet).
2026-05-21 13:41:52 -04:00
Augustin Cavalier 282c6a34f6 Package Kit: Fix memory leak in BRequest. 2026-05-21 12:58:53 -04:00
Augustin Cavalier 8c25999955 BTabView: Allow SetEnabled to work even if there is no view.
Amends 0a2766d6b0.
2026-05-21 12:58:35 -04:00
Augustin Cavalier f5842905e3 kernel/UserTimer: Major overhaul of the locking design.
* Get rid of the global sUserTimerLock. This was added in 2013
   to prepare for the removal of the global scheduler lock, which
   is what all these routines previously used. The locking design
   was never redesigned since then to accomodate for the changes,
   it appears.

 * Make CPU timers always locked by time_lock, and the system-time
   timers locked by a local lock.

 * Make fScheduled load-bearing as to whether the timer is presently
   in the team/thread lists or not.

 * Don't re-fetch the team/thread every wait cycle. This allows us
   to avoid a lock/unlock dance that would otherwise complicate
   the scheduling logic significantly.

Tested using the old version of the Open POSIX Testsuite (which
indeed caught some bugs in earlier versions of this patch.) All
12 timer_create tests still pass, including the ones that depend on
timers firing within the right timeframe.

Fixes #20090.

Change-Id: I54dd9a49e72f51711baa0fbf18e5c35a7fafec8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11007
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-05-21 16:54:52 +00:00
Augustin Cavalier 6eec6769f2 kernel: Update comments and add some asserts around the user timers.
Change-Id: I8c5e8faaf9c9a3eb86c1faed29beee4ab2958b3c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11006
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-05-21 16:54:52 +00:00
Augustin Cavalier 57a5a0ff6c kernel/debug: Enter KDL even if some CPUs can't be trapped in it.
Otherwise the system just hangs, which isn't good.

Turns #20090 from a hang into a KDL, as one CPU is stuck in a loop
with interrupts disabled.
2026-05-19 15:25:02 -04:00
Augustin Cavalier ced8a80543 kernel/vm: vm_page_requeue() must be called with the page in ACCESS state.
Should hopefully fix #20103.
2026-05-19 14:55:14 -04:00
Augustin Cavalier 41b45506fc kernel: Add missing NULL check in LegacyDevice::Control.
Fixes #20091.
2026-05-19 13:32:10 -04:00
Augustin Cavalier ff1c6abba8 build_cross_tools (GCC2): Use -std=gnu89 for GCC 13 also.
It shouldn't hurt, and may fix the build in more environments.
2026-05-19 13:15:41 -04:00
Augustin Cavalier c6024e1bff kernel/thread: Assert that thread->pinned_to_cpu does not become negative.
May help with diagnosing #20100.
2026-05-18 11:45:33 -04:00
Augustin Cavalier 286eb01997 stdint.h: Declare SIZE_MAX using __SIZE_MAX__ if available.
Fixes the size_t part of #20079.
2026-05-11 14:36:10 -04:00
Augustin Cavalier 8b38e91f46 headers: Declare address and 64-bit limits using hexadecimal.
No functional change intended.
2026-05-11 14:32:27 -04:00
Augustin Cavalier fd09d924e6 headers: Drop nonstandard null.h and size_t.h.
They're holdovers from R5. <stddef.h> should just be included instead,
and ssize_t declared directly in sys/types.h.
2026-05-11 14:17:55 -04:00
Augustin Cavalier 60d0411454 headers: Move version constants to config/HaikuVersion.h.
They have been in BeBuild.h since BeOS days, but as this file
is included everywhere in the base system headers, it causes
a bunch of unnecessary POSIX namespace pollution. So, instead,
put them in a config header, and include it from SupportDefs.h,
which should only ever be included by Be/Haiku API headers.
2026-05-11 14:08:18 -04:00
Augustin Cavalier 414c41e7bf OS.h: Drop some unnecessary comments.
The first wasn't quite accurate, and the second seems to have been
copied from the R5 header.
2026-05-11 14:03:23 -04:00
Augustin Cavalier 56be32b772 Drop direct includes of size_t.h.
It's a non-standard header we inherited from BeOS. According to the
POSIX specification, size_t should be declared from including stddef.h
and/or sys/types.h, and ssize_t from sys/types.h.
2026-05-11 13:26:44 -04:00