Commit Graph
68778 Commits
Author SHA1 Message Date
Augustin Cavalier d6c0df2394 kernel/guarded_heap: allocate_meta may fail with certain flags set.
May fix #20014.
2026-03-30 18:33:23 -04:00
Augustin Cavalier 75b91674e9 BString: Use memchr and memrchr to optimize two Find routines.
All BString tests are still passing.
2026-03-30 18:30:32 -04:00
Augustin Cavalier 53b69c0037 driver_settings: Use strchrnul to skip comments.
More optimized than just the simple loop.
2026-03-30 18:21:49 -04:00
Sam Roberts bace3a82c5 arm64: Handle signals after all types of interrupts
This is what other architectures do :)

Previously, we only handled signals after system 
calls, which could result in a funny sequence of events:
- Thread gets spawned with spawn_thread
- Thread gets resumed with resume_thread, which sends
  SIGNAL_CONTINUE_THREAD
- Thread's very first syscall is a read(), which promptly
  gets interrupted by SIGNAL_CONTINUE_THREAD and the thread
  has no idea why, and doesn't bother to read() again since
  it never expected to receive a signal
^^^ PtyReader fell victim to this and Terminal was broken

Change-Id: I32c4c73be21c60cab97add2bb7052dc56a6a6964
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10608
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-30 22:16:51 +00:00
Sam Roberts 6e590a51a2 arm64: Miscellaneous kernel fixes
* Ensure some bits in TCR have known values, since the bootloader
  might have configured something weird which causes problems for us
  (such as configuring a virtual address space that's smaller than
  we expect).
* ==NULL check in VMSAv8TranslationMap::UnmapPage was backwards
* Don't receive the number of syscall parameters from userspace. We were
  previously reading twice as many arguments as needed when handling
  a syscall.
* Save FP/SIMD registers as early as possible, since we can't know when
  they might get used
* Reset iframe stack index to 0 upon arch_thread_enter_userspace.
  Otherwise, when we exec, we push an iframe and never pop it off
  again

Change-Id: I4bc7dcc9303b9103a97226cd7ece4c9b6a6a6964
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10607
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:16:51 +00:00
Sam Roberts e78a97d381 arm64: Add timekeeping
Change-Id: Idc64a00e4dcc787e35afc560acd06a606a6a6964
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10606
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:16:51 +00:00
Sam Roberts 1b4044fde1 arm64: Add signal handling and forking
Change-Id: I8fd41bf5c540bcb2b9347aae47ad8bb86a6a6964
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10605
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-30 22:16:51 +00:00
Sam Roberts 7981c1d1c7 arm64: Add runtime_loader support + TLS
Change-Id: Ic462c6b08e6949039457e6141c83468e6a6a6964
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10604
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:16:51 +00:00
Augustin Cavalier 40205ec46a kernel/cache: Add test for #18390 and related issues.
Change-Id: I873df21c54d4df4ea85904eabd186a36e55e13d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10629
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier 28e6329e8e kernel/vm: Add assert to VMCache::MarkPageUnbusy.
Change-Id: Iec29bdfa5f0a25d9f255c6eee1937bc7c9cc4c3a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10628
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier 5554f0b829 kernel/vm: Fix a TODO about page I/O leaving pages in ACCESS state.
It turns out PAGE_ACCESS assertions could be tripped in other cases,
e.g. when resizing a cache while pages were being read in. So,
properly unset ACCESS (and just leave 'busy' set) in the places
where pages are read in, and re-enable the check.

Change-Id: I22ac5c8cb432c87613bb85e82703a0c1aeb55d86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10627
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier 05772630b8 kernel/file_cache: Recheck size in the do_cache_io loop.
Since we unlock the cache at various points in this loop,
we need to periodically recheck the size here, as otherwise
we might try to insert pages past the end.

This amends 4f8eaff87f. Re-tested
using the case described in that commit.

Change-Id: Id65e309f986a9b7f3e701d2b99c4f318a4eefbd3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10626
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier b37e0a513d kernel/vm: Clear busy_io along with the other page flags.
Change-Id: I796e6d01678e46eda9815c1c290b56975b6dbdfe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10625
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier 5eaf967479 kernel/cache: Use vm_page::busy_io in the file_cache.
This allows the VMCache to remove these pages pending the I/O
completion.

Combined with the following commits, confirmed to fix #18390.

Change-Id: I9630a00d70a9d6ac5b36e6de70475a6032390806
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10591
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier 2b9d1bb9c2 kernel/vm: Rename vm_page::busy_writing to busy_io.
This way, it's clear that it can be used for more than just writing.

Change-Id: Ifd0928f0e8ec7b5eeb312795ceaae6e3fd266257
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10590
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier dcf4948bff kernel/vm: Add better handling for busy-writing pages on cache resizes.
Previously, busy-writing pages just stayed in the cache until
I/O finished. This wasn't right, as they should've been unmapped
(and removed) immediately, as a TODO in the PageWriteWrapper noted.

Now they are, and they're moved into a queue on the cache pending
the I/O completing.

This paves the way for fixing #18390.

Change-Id: I51778ba1cfc1d26f34dd44f1ee293381be59937f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8627
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-30 22:11:53 +00:00
Augustin Cavalier 15594f62fe DoublyLinkedList: Make DoublyLinkedListCLink more useful.
Before, it just used a hardcoded Element::link member. Now,
it uses whatever one is specified based on the template
arguments.

No source compatibility breakage intended.

Change-Id: I62128921766df0b705488eb64402f902334f2ed0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10589
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
2026-03-30 22:11:53 +00:00
nipos 397b2e8189 ControlLook: Lock minimum scrollbar size to 14px, the size with default font size
Fixes #20010

Change-Id: I64e7be52e4b4e71a9acfe675133de8e562f6bb66
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10618
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: nephele nephele <[email protected]>
2026-03-30 18:33:11 +00:00
Humdinger ec149069ce Add "Label as…" Tracker add-on to image
Change-Id: I25c47384853b5f7a23bfacca3bfe5ce06cd2177a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10614
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: humdinger humdinger <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-30 15:33:35 +00:00
SED4906 634373e466 runtime_loader: define MAX_PAGE_SIZE correctly on arm64
This fixes an issue where map_image returns B_BAD_DATA.

Change-Id: I11efbb1c1d740474f62c37c0069a76b97aeb8bc4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10602
Reviewed-by: Sam Roberts <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-28 20:04:38 +00:00
SED4906 91f3ac4f96 boot/arm64: Map pages as Inner Shareable by default
This prevents a hang when the kernel tries to remap
its own pages later, during a break-before-make on
what appears to be a page containing jump vectors.
(In the exception frame, ELR points there.)

Change-Id: Idd516c73a7702c2995fe914204d587df6fc713fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10600
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Sam Roberts <[email protected]>
2026-03-28 19:18:25 +00:00
Máximo Castañeda d60b573d4d bootloader: quote files in blocklist
As some valid file characters can be parsed as part of the driver
settings syntax.

Fixes: #20001
Change-Id: Ia0ce32fc27737cd2d5528560e114a1e71aa3fa53
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10599
Reviewed-by: waddlesplash <[email protected]>
2026-03-28 12:59:20 +00:00
Nathan Patrizi 605a1f4f4e Tracker: Prevent bringing windows to foreground when not dragging
* Prevent bringing Tracker windows to the foreground when moving the mouse
  over them with a button held but not actually dragging a file.
* Fix a regression caused by changing window->Dragging() calls to
  IsDragging().

Fixes #19683

Change-Id: Ife55885e72d4682b857baf4103d144f49b765693
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10601
Reviewed-by: nephele nephele <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-28 12:32:27 +00:00
Autocomitter f45785201d Update translations from Pootle 2026-03-28 08:14:04 +00:00
Máximo Castañeda 07fb92c15e Tracker: fix live changing of addons shortcuts
Change-Id: I8f5eca119392e316501bbbff13ca53b705d15919
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10353
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Máximo Castañeda <[email protected]>
2026-03-27 18:48:00 +00:00
Augustin Cavalier d22a7a3355 kernel/debug: Allow quotations to pass through early safemode settings.
The guarded heap override logic wants to see them at least.

Change-Id: I89c5c7a7b03e52f4bc42d71cba66775c213256e9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10597
Reviewed-by: waddlesplash <[email protected]>
2026-03-27 18:23:31 +00:00
Augustin Cavalier 2b3a46cc1b kernel/debug: Use strchrnul and memchr in parsing.
Slight efficiency improvement, and simplifies the code a bit too.

Change-Id: I502409a9aee260c3d0ad1c9003567e46c03b241b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10596
Reviewed-by: waddlesplash <[email protected]>
2026-03-27 18:23:31 +00:00
anujbillore-0-0 0ed6a7bdeb btrfs: Fix various coding style issues
- Fix pointer/reference style in btrfs_disk_system.cpp
- Add missing blank line between class definitions in Inode.h
- Remove trailing whitespace in AttributeIterator.h
- Add missing space before inline comment in BTree.cpp
- Add missing space before '{' in ExtentAllocator.cpp
- Fix C-style cast pointer style in Volume.cpp

No functional changes.

Hashtags: gsoc2026

Change-Id: I7922a4736c072691163c05288f142cdaff1dcf9c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10469
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2026-03-27 12:55:51 +00:00
JackBurton79 4ce9cacce2 TermView: Initialize fCursorForeColor
fCursorForeColor could be used uninitialized when TermView is instantiated as a replicant

Change-Id: Ia16b6ff1e7dc024b17081e117b199c267f83d8ff
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10587
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-27 12:35:32 +00:00
Augustin Cavalier e6d9dc2731 kqueue: Don't notify B_EVENT_INVALID for FDs.
It isn't sent at all on FreeBSD.

Found while testing #19969: the disconnection was reported twice.

Change-Id: Icaf7abef7c3c3a61fccf5eb9e827e0a6a0fa1228
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10580
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-27 01:13:34 +00:00
Augustin Cavalier 498d92cbd7 kernel/guarded_heap: Add an init comment. 2026-03-26 17:53:15 -04:00
Augustin Cavalier 34e74e0556 kernel/vm: Pages in the store should be in the commitment.
Otherwise we won't reserve memory/swap for swapped-out pages.
2026-03-26 17:49:56 -04:00
Augustin Cavalier 33dc47cb2c kernel/vm: Move committed_size to the cache implementations.
This fixes a long-standing TODO, and a major inconsistency
that for different caches, "commitment" reserves from different
pools, so any two aren't necessarily convertible.

The new system introduces a virtual method "TakeCommitmentFrom",
which allows the VM's cut_area routine to behave as it did
previously.
2026-03-26 17:36:27 -04:00
Augustin Cavalier 0a5cd96093 kernel/vm: Preparations for VMCache::committed_size removal.
Includes some cleanup to the organization of VMCache.h.
2026-03-26 17:25:05 -04:00
Augustin Cavalier 76af6f4c98 kernel/vm: Update/add some documentation comments and drop some old files.
They mostly contained descriptions of functions' operations, not
what they're for, so they weren't so useful. I've added some of
the remarks they had (or ones with a similar purpose) inline
as documentation comments, and deleted the rest.
2026-03-26 16:43:52 -04:00
Augustin Cavalier 222c477cf0 docs: Update the VM swap documentation.
It was mostly up-to-date technically; a few details have been
amended where things have changed, and the "personal" stuff
dropped.
2026-03-26 14:54:05 -04:00
Augustin Cavalier 030b7c1426 kernel/vm: Clarify locking of VMArea and drop old documentation.
The documentation file hadn't been updated in a very long time,
and referred to locks and paradigms that have long since been
dropped (e.g. sMappingLock was removed in 2010, in
afed2658f4ef3e3df5ff8390d1d7a51b5b897a9e.)

Add a few "protected by" comments in VMArea to clarify things,
but otherwise this document looks entirely obsolete (I went
through all of it.)
2026-03-26 14:11:23 -04:00
Augustin Cavalier b10415b7cc kernel/fs: Update comments in EntryCache.
Make the concurrency model slightly clearer.
2026-03-26 14:08:57 -04:00
Augustin Cavalier acde38ead3 freebsd_network: Update comment in kernel_malloc.
bus_dmamem_alloc doesn't need this behavior anymore.
2026-03-26 14:01:54 -04:00
Augustin Cavalier eb097f749b kernel/slab: Use (1 << x) to define cache flag bits.
No functional change intended.
2026-03-26 12:26:22 -04:00
Augustin Cavalier bb1c367a6d kqueue: Add a no-op EV_ENABLE definition.
EV_ADD implies ENABLE, so this isn't needed, but a lot of applications
try to specify it anyway. So this extends source compatibility.

If in the future we ever implement EV_DISABLE, we can just add a
real definition for it then, and since ADD implies ENABLE existing
applications shouldn't break.
2026-03-26 12:25:41 -04:00
Augustin Cavalier 5ac1c21e5f kernel/vm: Set the memory type on cloned device cache areas.
If the source area is now mapped write-combining, so will the
target area.

May fix some problems or slowness that occurred after the
framebuffers refactor commits.
2026-03-25 12:50:57 -04:00
Leo Rouleau 787ff471d3 Devices: Implement Order by Bus sorting feature
Adds a new sorting mode to the Devices app to allow users to view the
hardware tree sorted by bus connections.

Resolves the TODO: Implement BY_BUS in DevicesView.cpp

Changes:
- Added ORDER_BY_BUS state and kMsgOrderBus constant
- Added Bus option to the orderByPopupMenu
- Implemented alogrithm in RebuildDevicesOutline() to group devices under their CAT_BUS parent
- Added kMsgOrderBus in DevicesApplication to ensure it updates when
  selected

Change-Id: I266333e1ced25d231d73a0850e6a8ff3155084c4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10481
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-25 12:33:28 +00:00
Augustin Cavalier 7240f3762f kernel: Add mechanism to replace specific object caches with the guarded heap.
This allows the guarded heap to be used in a much more targeted way,
if it's suspected specific object_caches have problems.

Enabled by default for KDEBUG. The new safemode/kernel option is
"guarded_heap_for_object_caches". This accepts a comma-separated
list of quoted strings, optionally with * at beginning and/or end
(but not middle.) Examples:

mbufs*   # matches caches starting with "mbufs"
*jumbo9*	# matches caches containing "jumbo9"
"*jumbo9 chunks","mbufs*" # matches caches ending with "jumbo9 chunks"
                          # or starting with "mbufs"

This should help with diagnosing #19973, among others, without needing
to compile custom versions of drivers or anything like that.

Unfortunately it is not possible to use this mechanism to selectively
replace parts of the slab malloc. The slab malloc free() relies on
the MemoryManager to figure out what cache an object belongs to, which
doesn't work if objects of some size classes aren't known to the
MemoryManager at all.
2026-03-24 18:10:10 -04:00
John Davis 76df196f25 hyperv: Fix VMBus receive buffer signaling
Hyper-V needs to be notified when VMBus receive buffer has enough
space for devices supporting this functionality.

Change-Id: Ib2bb0d65bbd8c402d1c73e9cad83d00d644dcf2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10566
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-24 17:18:15 +00:00
shivamsinghydv 6e52ff1941 bluetooth: Before activation of a local device in UI, verify that it has a valid address.
Change-Id: I516d71312ed269d75fa9ae81e05cabfa41f264fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10568
Reviewed-by: waddlesplash <[email protected]>
2026-03-24 14:44:40 +00:00
X512 0a40b3a1ce BPicture: fix subpicture token storage
Picture token written for `BView::DrawPicture` and
`BView::ClipTo[Inverse]Picture` should be zero-based index in
subpictures array, not global app_server BPicture token.

Part of #1133.

Change-Id: I2a544aefb343650e8bad58c5d297f7b9d5d1dbb5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10575
Reviewed-by: waddlesplash <[email protected]>
2026-03-24 14:33:50 +00:00
Augustin Cavalier 90ac9e6538 kernel/vm: Overhaul swap cache commitments.
Before this commit, swap space was committed entirely orthogonally
from memory commitments. This was not handled at all correctly
when cutting areas (the area cutting logic tries to migrate commitments
between caches, but in the case of swapping caches, it didn't,
and couldn't, take the separate fCommittedSwapSize into account.)

Even without that problem, totally separate swap and memory commitments
caused other problems. For instance, suppose a setup with 4GB of RAM
and 4GB of swap. Many caches are created, and all 4GB of swap gets
reserved, but the caches with this swap reserved have no or few pages
in them. Then, all 4GB of RAM gets used up. The page daemon runs, and
looks for things to swap out, but it can't find anything because all
our swappable caches with pages have no swap reservations, so all it
can do is flush out cached pages, which just degrades performance.

Or, consider what would happen if the 4GB of swap was released, but
the 4GB of RAM was still in use, and then the kernel tried to
allocate memory. It would get OOM errors, because none of the
caches have swap commitments and so nothing can be written out.

Under this new system, the specific swap space reservation only happens
just before the page is first written out, so both these cases should
be handled smoothly, and swap should be used in a much more sensible
fashion overall.

This change seems to be more in line with what other OSes do (Windows
Task Manager's "Committed" clearly is RAM+swap, for instance.)

The only potential downside to this change is that swappable caches
may temporarily go over their commitment when reading or writing
out pages to swap, before the page daemon has a chance to come by
and free the page or the swap space. But as that is a temporary state
and should always be resolved by the page daemon, I think it's
probably an acceptable trade-off.

Change-Id: I928f4b4cacbec26ed6315179476eaff1a7f626c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10305
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-24 14:02:52 +00:00
Augustin Cavalier 9be0e148a2 vesa & framebuffer: Clone the framebuffer instead of having it be user-accessible.
This begins paving the way for removal of user access to kernel
address space.

After the previous commits, BDirectWindow and BWindowScreen
still function properly.

Part of #19990.

Change-Id: I8477e43cd517ba67383755a4cb60b00bc117f5d7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10559
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-24 14:01:11 +00:00
Augustin Cavalier 95ace7f374 kernel/vm: Introduce methods to change the cache of all an area's clones.
This will be useful in the case of cloned device caches based
around physical memory, e.g. for framebuffers.

Change-Id: If2b864208e86f436e91379b73c4b866b0bd5e1d7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10558
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-24 14:01:11 +00:00