Commit Graph
67602 Commits
Author SHA1 Message Date
Augustin Cavalier 4c76039f6f kernel/x86_64: Keep FPU and SSE control on context switch.
This reverts most of c7360f4b02.

Unlike the other floating-point registers, these values are callee-saved
(see "System V Application Binary Interface, AMD64 Architecture
Supplement" section 3.2.1.) So we need to preserve their values and not
reset defaults on context switch.

EMMS, as the previous changes used, does not suffice to clear
exceptions. We could use FNCLEX instead, but we need to reset
x87 state on context switch anyway, so use FNINIT. Do not
reinstate FNCLEX in the exception handler since it will
be executed on context switch anyway.

We also need to ensure a clean initial state, so take care of that
in arch_thread_init.

See also:
 * remarks in 396b74228e
 * as well as 53e2dc0f85

Fixes #19454 and #18624. Doesn't regress #18656 and #19063.
Doesn't seem to affect #19450.

Change-Id: I7179f1ec7304e7aed09ff80f6773e53d5dbdf5f9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9081
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:13:26 +00:00
Máximo Castañeda af381ebd19 test_app_server: fix build after hrev58397
Change-Id: I81c64db2adf21f6cea15e99f15e765c108d34506
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9118
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-03-11 02:07:19 +00:00
Emir SARI 2f2c48ad53 Terminal: use multiplication signs wherever needed
Apparently missed this one, last time.

Change-Id: Ibcafc18ccde3eb3e8c0696a68b2979c51e68dbcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7590
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2025-03-10 14:01:35 +00:00
Augustin Cavalier 848d379f5d strace: Handle area_id returns like status_t returns. 2025-03-08 14:57:37 -05:00
Augustin Cavalier cee5e4f57e strace: Don't check if status values are smaller than UINT32_MAX.
The type check suffices. Fixes printing ssize_t error names.
2025-03-08 14:57:18 -05:00
Augustin Cavalier 906623697e ram_disk: Do not use cache_get_pages in Trim().
cache_get_pages locks and unlocks the cache to wait for busy pages,
as well as after it's done, which creates a race where some other
thread may start waiting on a page that we have marked busy. But
as we are about to free those pages, that wait will deadlock.

Just loop through the cache's pages directly, skipping any busy ones
and freeing the others directly.

Fixes a deadlock observed with BFS on a ramdisk.
2025-03-08 10:16:02 -05:00
Augustin Cavalier 876171f588 ram_disk: Add missing DEBUG_PAGE_ACCESS_START.
This was removed from cache_get_pages, so we need to do it manually.

Fixes a KDL reported in the comments of #16951.
2025-03-08 09:42:28 -05:00
Autocomitter b8a3901ea2 Update translations from Pootle 2025-03-08 08:07:04 +00:00
Augustin Cavalier bb6c8ca150 strace: Handle ssize_t differently than status_t.
It's 64-bit on 64-bit architectures and must be handled as such.

Fixes strace outputs seen in #16861.

Also clean up style a bit.
2025-03-08 00:12:43 -05:00
Augustin Cavalier fe70bb7f1e libroot/unistd: Fix write truncating return values of _kern_write.
ssize_t is 64-bit on 64-bit architectures, if we truncate to int
then values above 2GB will be seen as negative and errors instead
of the successes they are.

Seems to fix #16861.
2025-03-08 00:11:51 -05:00
Andrew Lindesay 48ca9d08bb Interface: multi add/remove BColumnListView
This change will allow the BColumnListView to have
multiple rows added or removed at the same time.
Without this, applications using the BColumnListView
will need to add and remove rows one by one which,
for longer lists with complex columns, is a
performance problem; an example being HaikuDepot.

Note that this change does not amend the formatting
style on the class's source.

Change-Id: I72303c8b069b686251c3a65af7ae45c8884d5637
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9056
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Andrew Lindesay <[email protected]>
2025-03-07 10:38:28 +00:00
Humdinger 21ee34828b waitfor: re-write, added option to wait for network
The new "-n" parameter waits for the networking to be up.
Code lifted from SoftwareUpdater.

To avoid polling the network status, use start_watching_network().
As this involves messaging, a BApplication is created and a
BMessageRunner is now used to regularly check if threads or
apps have started/ended.

Change-Id: I55b5174dbdbd326d8d40b958ebf966f8fa6718b3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9067
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-03-06 20:26:16 +00:00
Jim906 4407440099 nfs4: Remove stale nodes when their ino is reused
* Add FileSystem::EnsureNoCollision to check for a stale node with
  the given inode number, and remove it if it exists.
* Call EnsureNoCollision from Inode::CreateObject and
  Inode::CreateState to cover creation of directory files and regular
  files, respectively.
* Stop using the entry cache.  Instead, make use of the driver's
  DirectoryCache in the lookup hook.
* Fixes #16924.

When a shared file is deleted, and no clients have the file open, the
server considers the file ID number of the deleted file to be eligible
for reassignment to new files.  If the deletion was performed by the
server or by some other client, the Haiku client does't know the file
was deleted, and still may hold a vnode for it.  This interferes with
the creation of a new file by the client, when the file ID / ino of
the new file is the same as that of the stale node.

The reason for disabling the entry cache is to give the driver a
chance to check the server for changes in name-to-ino mapping when the
VFS function lookup_dir_entry is called.  At least in its current
form, the driver isn't able to deal with outdated entry cache
information.  For example, if the Haiku client has added temp.txt to
its entry cache, and then temp.txt is deleted by the server, running
'nano temp.txt' on the client will attempt to open the (non-existent)
file instead of creating it.

Change-Id: Ic3ec21d18c8616fcfeb9234aafb0e647746d23cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9068
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 19:59:15 +00:00
Oscar Lesta 8ab7b2bd56 ProcessController: swap drawing of (system) committed and cached memory.
The menu item starts with: "System resources & caches..." but then it
wrote fCachedMemory before fCommittedMemory.

Swapping them seems more in line with how the rest of the "Memory usage"
menu is presented as well.

Change-Id: I83345f9ae35b405ed854e7a1992b537d31e27d02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9083
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: humdinger humdinger <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 16:42:35 +00:00
Augustin Cavalier b3d011b90a kernel/locks: Assert in rw_lock_wait that we weren't spuriously unblocked.
May have caught #19458 earlier, depending on cause.

Change-Id: Ib5dd4ef72474f944946e1dae214c49fe440669bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9086
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 15:00:31 +00:00
Augustin Cavalier 0958031b24 kernel/fifo: Don't unlock before unblock.
Otherwise there is a race that can occur if the waiting thread is
interrupted (or hasn't slept yet) while the writing thread tries to
unblock it.

Instead, don't call SetNotified again if we unblocked with a status
of B_OK. This can only happen when we were notified by another thread
successfully.

Should help with #19458.

Change-Id: Iad46b26374a01539f8765231d259392c231c786a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9085
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 15:00:31 +00:00
Augustin Cavalier 240f1a0e91 kernel/devfs: Check whether the node is a directory in devfs_open.
Same checks as other filesystems.

Fixes "cp file /dev/some/block/device".

Change-Id: Ic4bd04972247b94ac4eaa6e211fe6cb1c53f3975
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9084
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 15:00:31 +00:00
Humdinger 2d3b5776e7 AboutSystem: Separate zh-Hans/zh-Hant, add translators
Adding daniel03663 and edouardlicn for Traditional Chinese, and
Jinuk Jung for Korean.

Change-Id: Ie1f38af87068d1d5d2fa0b07b9594fb371887ea1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9027
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-05 20:11:43 +00:00
Augustin Cavalier 16db148e63 kernel/x86: Replace homegrown memcpy & memset with NetBSD's.
FreeBSD also uses NetBSD's versions (with their own modifications,
however.) So it seems to make sense for us to adopt these, too;
they look to be better tuned than ours were (like handling
non-aligned addresses better, which was a TODO before.)
2025-03-05 14:25:56 -05:00
Augustin Cavalier 282bdf736c Overhaul generic memcpy and memset.
* Rewrite generic memcpy, with optimizations more like the common memcmp
   optimizations.

 * Rewrite generic memset, with a proper optimized implementation.

 * Name the files "generic_" like other files in the arch generics dirs.

 * Always use the generic versions in the bootloader, since it's
   complied with special flags.
2025-03-05 14:23:13 -05:00
Augustin Cavalier f33654d942 libroot/string: Put the misalignment check in memcmp() into a macro. 2025-03-05 13:43:02 -05:00
Augustin Cavalier a23e085678 m68k, arm: Rename arch_string.S to memcpy.S.
As it only contains a memcpy implementation.
2025-03-05 12:53:16 -05:00
Augustin Cavalier 62793934a1 x86, x86_64: Move (userland) memcpy, memset out of arch_string.S/.cpp.
Put the C++ versions in files with their own names, and
rename the assembly thunks to "commpage_string.S", as it
really just invokes the commpage versions.

The kernel x86 arch_string.S is left alone for the moment
as it will be replaced in the near future anyway.
2025-03-05 12:48:54 -05:00
Augustin Cavalier 8a86fccb1b arm64, riscv64: Drop arch_string.S.
It was empty and unused on these architectures.
2025-03-05 11:57:05 -05:00
Augustin Cavalier 1707ab1299 runtime_loader: Use posix_string_arch as built for libroot.
Instead of using individual files from it.
This will make changes to how it is built easier to make.
2025-03-05 11:55:27 -05:00
Augustin Cavalier 2b52ddef79 libroot/string: Use '==' and not '-' and '== 0' for all except the last comparison.
Should make the code clearer and save a branch in the loop.
Also add Haiku, Inc. to copyright notice.
2025-03-05 11:12:41 -05:00
Augustin Cavalier 5d46b254d4 libroot/string: Apply the same optimization to strncmp as in strcmp. 2025-03-05 10:45:55 -05:00
Oscar Lesta 3096860403 bin/keymap: show help with -h, use -H for --header.
This is less surprising than having it the other way around.

Adjusted the "MkKeymapHeader1" action on src/servers/input/Jamfile accordingly.

Change-Id: I9fb8f8d7d0cfde493c03755beafbff73222cba93
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9066
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2025-03-05 13:01:05 +00:00
John Scipione cb4a168e37 Tracker: menu parameter is ambiguous, rename to parent instead
Change-Id: I9a8811ff8c142efcdfbebae0c2b6e438290eafcd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9061
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-04 14:50:27 +00:00
Augustin Cavalier 2e3af8f296 ralinkwifi: Import MT7601U driver from FreeBSD.
It's branded as a MediaTek device, but the firmware
copyright is Ralink.

From upstream b96864412700a2a5b5e9aaf5d6513ec062cfc96f.
Includes adaptations to make it compile on Haiku.
2025-03-03 16:46:01 -05:00
Augustin Cavalier 1f00d7e571 freebsd_network: Add firmware_get_flags.
Needed by the MT7601U driver.
2025-03-03 16:28:39 -05:00
Augustin Cavalier 640cf189a0 ralinkwifi: Cleanup interrupts glue. 2025-03-03 16:20:20 -05:00
Augustin Cavalier 5059b85380 kernel/condition_variable: Add a cpu_pause in the RemoveFromVariable loop.
All the other spin-loops have this, so this loop should too.
2025-03-03 15:13:21 -05:00
Augustin Cavalier a0c4b9a162 SCSI: Use ConditionVariable::NotifyOne, not NotifyAll.
This matches the previous behavior (which just used release_sem
or _etc with a count of 1.) The one waiter might delete the object
containing the condition variable on wakeup, so the difference
does matter.
2025-03-03 15:12:31 -05:00
Augustin Cavalier 73e7455250 BBlockCache: Don't use weak symbols except on Haiku.
We may compile on systems that don't use ELF (e.g. Darwin/macOS.)
Avoid a dependency on the feature where we don't need it.
2025-03-03 14:47:51 -05:00
Augustin Cavalier d56e1a13aa kernel/locks: Make the assertion in mutex_destroy print a backtrace of the owning thread. 2025-03-03 14:43:30 -05:00
Augustin Cavalier 752c6e8b9e kernel/thread: Fix a TODO in get_next_thread_info().
Just find the previous thread and then get the one after it in
the general case. This avoids problems with "unsorted" thread lists
as found in the kernel team or when IDs wrap, with the previous
logic only kept as a fallback if the last-fetched thread
does not exist anymore.
2025-03-03 14:36:01 -05:00
Augustin Cavalier 0c76e02c58 libroot/string: Compare size_ts in memcmp(), not uint32_ts.
Should get a small bit more of performance on 64-bit architectures.
2025-03-03 14:16:05 -05:00
Augustin Cavalier 333274ddfb kernel/thread: Free death entries if they aren't used.
Otherwise they will be leaked.

I added a dprintf() in this codepath, it happened a small number of
times on boot and when running a compile job.
2025-03-03 14:15:05 -05:00
Augustin Cavalier da6325cd03 kernel/thread: Make thread_death_entry use DoublyLinkedList. 2025-03-03 14:08:02 -05:00
Augustin Cavalier 61d76848f0 kernel/thread: Convert Team::thread_list to a DoublyLinkedList.
Increase the size of the Thread structure by another pointer,
but makes thread insertions and removals constant-time.
2025-03-03 13:49:49 -05:00
Augustin Cavalier f6ca5f1927 kernel/team: Actually fetch child thread times for B_TEAM_USAGE_CHILDREN.
Previously this code iterated over children, but only ever looked
at the parent team's thread times.

It seems this has been broken since the code was originally
introduced in 2004.
2025-03-03 12:31:54 -05:00
Augustin Cavalier 76b7ab4c8e kernel: Move struct Thread declaration above struct Team.
Paves the way for using DoublyLinkedList. No functional change.
2025-03-03 11:46:32 -05:00
Augustin Cavalier d9399d4673 iaxwifi200: Merge changes from upstream OpenBSD.
Includes changes to support "MA" devices (but these also need
new firmware.)
2025-03-01 15:58:59 -05:00
Autocomitter e38d10fd9f Update translations from Pootle 2025-03-01 08:07:27 +00:00
Vladimir Serbinenko 0f5e47bf84 bootloader/efi/64: Support GDT being above 4GiB
On my darp10-b it ends up way above 4GiB. Fix is to add 64-bit entries to
32-bit GDT. Then we use this temporary GDT in order to enter 64-bit mode
and then reload correct gdt once we're in 64-bit mode

Change-Id: I69ec32904bbbb23adbe695de0538dc2100f40b48
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9004
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-02-28 17:11:12 +00:00
Augustin Cavalier 101b09cc05 Tracker: Set message in ModelMenuItem after the try/catch block.
Otherwise the ownership isn't clear: if the exception is thrown
after the item partially initializes, the message might get
deleted by a destructor already. This way, the ownership is clear.
2025-02-27 22:07:13 -05:00
Augustin Cavalier 5341b58f5f BBlockCache: Don't cache anything if a debug heap is in use.
Otherwise, BMessage allocations and frees don't really get
checked by the debug heaps, which isn't helpful. Use a
public debug heap function with a weak definition to detect this.

While at it, drop the full MIT license from the header and use
the common shorthand.

Should help with diagnosing #18905.
2025-02-27 21:32:44 -05:00
Augustin Cavalier bc376a296b SCSI: Explicitly use UINT32_MAX and UINT64_MAX in DMA attributes. 2025-02-27 12:56:42 -05:00
Augustin Cavalier ecef10e688 Tracker: Use BStrings and BObjectList in handling MostUsedNames.
Avoids some potential races.
2025-02-27 12:56:21 -05:00