66870 Commits

Author SHA1 Message Date
Augustin Cavalier
caaee6cc6e kernel/fs: Remove unused list_link field from advisory_lock.
The DoublyLinkedListLink is used instead.
hrev58159
2024-09-21 12:05:24 -04:00
Augustin Cavalier
a0658fbc88 kernel/vm: Consolidate logic in vm_cache_acquire_locked_page_cache.
The don't-wait and do-wait logic was very similar except for the
actual acquisition of the lock in the middle, so now they're combined.
This fixes another (minor) regression from 9e89f7c068c3b3b4c9d74bb82679c27a2c12b10a
in that if a page's cache changed before we acquired its lock and
don't-wait was set, we would wind up waiting anyway.
2024-09-21 12:03:23 -04:00
Augustin Cavalier
eb26bd6c47 kernel/vm: Fix copy/paste bug in vm_cache_acquire_locked_page_cache.
This fixes a regression from 9e89f7c068c3b3b4c9d74bb82679c27a2c12b10a.

Even if SwitchFromReadLock fails, the original read lock has been released,
and so we need to re-acquire the lock before continuing.

Should fix a KDL reported by X512.
2024-09-21 11:47:21 -04:00
Denis Ovsienko
cd333360b3 Clock: Point the hands precisely.
The clock hands do not always point exactly at the hour marks, which is
easy to see using Magnify (or a flat screen with sufficiently large
pixels): when a hand tries to points at 3 or 12 hours exactly, the
resulting line is not horizontal or vertical.

This is because the hands lines hinge on an array of coordinates, which
are calculated at run time using pi, and the calculation used to
approximate pi value as 3.1415.  This has been the case since respective
BeOS developer sample code from 1999 was imported into Haiku repository
in the initial commit in 2002.  Interestingly, BeOS R5.0.3 clock demo
does not have this bug.

Use M_PI for the pi value, point the hands precisely and fix my bug
report #19083.

Change-Id: Ie71889daed2efccd1596586f95b629f3b8e14c03
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8352
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58158
2024-09-21 15:05:45 +00:00
Adrien Destugues
6d3408c82f Add Wonderbrush to release for all architectures
Previously wonderbrush was closed source and only available for 32bit
x86, but that is not the case anymore.

Fixes #19093

Change-Id: I05a34f7aaf82ea7cc2f65b7cbd39eeaf222d6143
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8351
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58157
2024-09-20 17:46:07 +00:00
Owen Anderson
5ee5c0f3f5 arm64: Revert "arm64: Fix miscalculation of unmapping range."
* It turns out that `end` is inclusive.

Change-Id: I1d29e975afcfc1c6812fdf9ac8bfbbb3ac1e46bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8348
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
hrev58156
2024-09-20 17:05:15 +00:00
Augustin Cavalier
ce561013e5 ps2: Code cleanup in standard_command_timeout.
No functional change intended.
hrev58155
2024-09-19 13:41:59 -04:00
Augustin Cavalier
f2cb18d3f0 ps2: Lock the controller for the full duration of the command.
This way we can't race with some other command using the results
semaphore or flags fields.

May help with various PS/2 tickets.
2024-09-19 13:41:59 -04:00
Augustin Cavalier
805208b667 ps2: Use a real mutex for the controller lock rather than a semaphore. 2024-09-19 13:41:59 -04:00
Augustin Cavalier
ad4f2d20a1 ps2: Code cleanup in probe_keyboard.
* Put disabled code behind #if 0 instead of comments, as per style guide.

 * Clean up comments.

 * Errors should be ERROR not INFO (but both are printed anyway
   at the moment.)

No functional change intended.
2024-09-19 13:41:59 -04:00
Owen Anderson
0037c4432a arm64: Fix miscalculation of unmapping range.
* This could result in us inadvertently unmapping more pages than
  intended.

Change-Id: I2513028cd18436aadd29749628944a853e65e1c4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8346
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58154
2024-09-19 17:30:15 +00:00
Augustin Cavalier
1c4821ae8b BTimeSource: Assert that drift is not < 0 as well as != 0.
May help with diagnosing #19074.
hrev58153
2024-09-19 12:53:08 -04:00
Augustin Cavalier
90dca2bc8e headers: Change most remaining include guards to _DEFAULT_SOURCE.
We automatically enable _DEFAULT_SOURCE if _GNU_SOURCE is defined.
Rather than having even more optional methods undefined unless
_GNU_SOURCE manually is, just change all remaining guarts to
use _DEFAULT_SOURCE instead.

Fixes #19095.

Change-Id: I5c7baf40b7fb37913e24279589fc1ae706448a45
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8330
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58152
2024-09-19 16:43:31 +00:00
Augustin Cavalier
5c1f231967 Rename B_MTR_* constants to "something more meaningful".
The names chosen (e.g. "B_UNCACHED_MEMORY") follow the existing naming
conventions for memory-related constants, of putting the type at the end
of the name: B_KERNEL_BLOCK_ADDRESS, B_FULL_LOCK, B_READ_AREA, etc.

Resolves a very old TODO. No functional change intended.

Change-Id: I31491f6b3abc1e95f915aa302b9f2fb2af14774c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8316
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58151
2024-09-19 16:43:24 +00:00
Augustin Cavalier
e323bc248c bootloader: Add a missed check for "BlockedEntries" in the package settings file.
And remove the logic to append the option with the legacy name,
now that enough time has passed.

See comments on #19081.
hrev58150
2024-09-19 12:24:33 -04:00
Owen Anderson
c2f3786ab0 arm64: Save all integer registers in exception handlers.
* This is needed in order to support syscalls and other exceptions
  that need to be able to inspect/modify userspace register contents.

Change-Id: I8a638c0c40dd44ed882adad0591ae3bf5493a6b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8329
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58149
2024-09-18 19:34:15 +00:00
Jérôme Duval
0f807f4401 kernel/x86: dump hwpstate, cpb, proc_feedback features
Change-Id: I06b6da05013c7271d0a97d5aa3af2b6f416496a9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8331
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58148
2024-09-18 16:21:44 +00:00
Jérôme Duval
017c5e70d5 Shortcuts: Mute shortcut is now from "toggle mute" instead of "mute"
Change-Id: I62ded761ac096d5ae29d7c82e0d562995a2c3811
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8347
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
hrev58147
2024-09-18 14:01:55 +00:00
Augustin Cavalier
6c26c5b01d kernel/x86: Whitespace and comment cleanup in add_memory_type_range.
No functional change.
hrev58146
2024-09-17 20:09:01 -04:00
Augustin Cavalier
734556cb96 kernel/vm: Don't unset VMArea::id in delete_areas.
It's needed in delete_area for arch_vm_unset_memory_type at least.
Instead just add a parameter indicating the area is already removed
from the areas map.
hrev58145
2024-09-17 20:00:28 -04:00
Michael Lotz
53ff60f224 x86/vm: Don't add RAM to memory type ranges under PAT.
These are only relevant for MTRRs that describe physical memory ranges.
The change that introduced PAT removed the condition of MTRRs being
usable to always add the RAM ranges to the memory type ranges as
write-back, but this doesn't allow them to be used uncached for DMA.

Change-Id: I6cdd8f5a23a8f5cc582d25cf170c3e8d71d5e1fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8344
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58144
2024-09-17 23:11:34 +00:00
Augustin Cavalier
a706a92d65 hda: Fix build with DEBUG enabled.
We need the kernel debug macros defined so that hmulti_audio doesn't
try to use the userland ones.
hrev58143
2024-09-17 18:50:09 -04:00
Augustin Cavalier
89235ee967 DebugAnalyzer: Fix build after SinglyLinkedList API change. hrev58142 2024-09-17 17:54:06 -04:00
Augustin Cavalier
99d2d975a4 BCollator: Avoid more crashes when the ICUCollator fails to initialize. hrev58141 2024-09-17 17:51:53 -04:00
Michael Lotz
16cc9b0414 cpu/x86: Use the IA32_MTR_* macros instead of numeric values.
Change-Id: I937024a5105d41060408237d79f344879e1b4caa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8343
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
hrev58140
2024-09-17 20:45:28 +00:00
Michael Lotz
44ea1250b8 x86/vm: Add memory_type_ranges KDL command to dump memory types.
Change-Id: Ie4c3dcdbaf86cb12127eb3d8b0092634759087a2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8342
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-17 20:45:28 +00:00
Michael Lotz
e7e2938459 cpu/x86: Always dump configured MTRRs on init.
When PAT is in use and MTRRs are ignored and left unchanged, it is still
useful to know what it was set up to by the firmware.

Change-Id: I6b0c0f1277659c81fa9b3e9b7bb2c5df92cfdf0f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8341
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-17 20:45:28 +00:00
Michael Lotz
32a3bddfdf x86: Implement PAT support for memory type configuration.
Using the page attribute table to set the memory type on a per page
mapping basis is the more modern and flexible approach to physical
memory type handling compared to using MTRRs.

Most of the needed infrastructure was already in place, as setting the
page table entry attributes was already done for uncachable and
write-back memory types. Using the PAT now also allows to set the last
remaining memory type of write-combining through the PTE flags. The PAT
is configured to have entry 4 mean write-combining and the PAT bit in
the PTE is set to point to that.

When PAT is supported and not disabled, MTRRs are completely ignored
and left as set up by the system firmware, where the basic uncachable
and RAM ranges are supposed to be set up. These configurations are then
overridden by the PTE flags as needed.

Change-Id: I0a74b3fc7d3ba9fa384251290ce41621b69d3a02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8340
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-17 20:45:28 +00:00
Michael Lotz
8271b4a8bf x86/arch_vm: Allow arch_vm_set_memory_type to override type.
We allow requesting an explicit memory type when calling
map_physical_memory but default to the uncached B_MTR_UC when not given.

When called without an explicitly requested memory type, allow
arch_vm_set_memory_type to modify and return an effective memory type.
When an overlapping range already exists, the effective memory type is
set to the one of the existing mapping. If there is an explicit memory
type request that conflicts with an existing range, or if multiple
overlaps with conflicting types would be produced, the mapping is
disallow (and a panic is triggered under KDEBUG).

This effectively detects and panics when conflicting aliases of physical
memory would be created. This is also useful on an MTRR based setup,
as such overlaps cannot be properly represented.

When using the page attribute table (PAT) to set the memory type on a
per page virtual memory mapping basis, this is needed to prevent
aliasing of the same physical memory with different types. As per the
specs, such aliasing is unsupported and may result in undefined
operations that lead to system failure.

The mechanism is extended to the general arch_vm_set_memory_type as such
aliasing prevention also seems to apply to other architectures (at least
on ARM, aliasing is also strongly discouraged).

Change-Id: I7aaf6ea8415e92e74cd1643b67793a6857619eea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8339
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-17 20:45:28 +00:00
Augustin Cavalier
5a8a2b5066 package_repo: Add -f argument to "list" mode to print filenames.
This way, users of package_repo don't have to reassemble the
canonical filenames themselves.
hrev58139
2024-09-17 10:53:21 -04:00
Michael Lotz
fece81468c Cleanup: Various whitespace cleanup.
Change-Id: I9b3d910d14f845f750d01d7f028da4b461e9fcd6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8338
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
hrev58138
2024-09-17 09:33:47 +00:00
Michael Lotz
b21df8feab cpu/x86: Fix build with MTRR tracing enabled.
Change-Id: Ib1059851bd2aea9dd2bbba92ce078d177b6f1b3d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8337
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
hrev58137
2024-09-17 09:33:31 +00:00
Augustin Cavalier
8728f4797f libroot: Move malloc implementations to their own subdirectory.
No functional change intended.
hrev58136
2024-09-16 16:12:01 -04:00
Augustin Cavalier
f6313044f1 kernel/vm: Add "unimplemented" messages in VMTranslationMap::Debug methods.
This way, when certain KDL commands don't work on architectures that
don't implement these methods, it won't be a mystery as to why.
hrev58135
2024-09-16 16:00:01 -04:00
Augustin Cavalier
d29c0e6ee5 libroot: Fix shared unnamed semaphore acquisition with timeouts.
We set flags above the timeout check, so we need to use |= and
not lose the SHARED flag we already set.

Fixes some testcases in the POSIX testsuite, and the shared
semaphore code in Gecko/Firefox.
2024-09-16 15:38:29 -04:00
Augustin Cavalier
2eb83002c5 strace: Add FlagsTypeHandler for the mutex option flags.
So that MUTEX_SHARED etc. are displayed in strace output.
Also fix indentation, and the name of the "toFlags" parameter
in syscall definitions.
2024-09-16 15:36:12 -04:00
Augustin Cavalier
e1d0a30ed4 bin: Link launch_roster against libshared. hrev58133 2024-09-16 14:48:54 -04:00
Augustin Cavalier
532c5e75d3 TextTable: Ignore ANSI escape codes when counting text width.
Otherwise the launch_roster table will be misaligned.
hrev58132
2024-09-16 14:39:31 -04:00
Alexander von Gluck IV
ece6263825 launch_roster: Spice up launch_roster, add color and details to job list
Change-Id: Iae907da336209bcbe39d37bfa35f090b46e783d2

Amended by waddlesplash to use TextTable.
2024-09-16 14:38:04 -04:00
Augustin Cavalier
33ce9b1b5c runtime_loader: Remove -fno-builtin from compiler options.
Except on kernel_cpp.cpp. We don't use it for most of libroot, so
we don't need it for most of runtime_loader either. The two preceding
changes were all that's necessary to fix things with builtins enabled.

Very slight performance improvement (the "run 1000 shells" benchmark
seems to decrease by about 0.4 seconds out of 16.5 or so.)
hrev58131
2024-09-16 13:23:46 -04:00
Augustin Cavalier
6a519848d8 runtime_loader: Add cast in ELF TLS to appease GCC.
Otherwise when builtins are enabled, we get class-memaccess warnings.
2024-09-16 13:19:47 -04:00
Augustin Cavalier
6863cd3038 runtime_loader: Add calloc() to heap implementation.
Taken from the bootloader's version, which this heap is based on.
2024-09-16 13:18:57 -04:00
Jessica Hamilton
b6554e72fc configure: allow specifying python to use --with-python.
Change-Id: Iba5e5a428a4cd84e6dc149943c033d2c5025ae23
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8327
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
hrev58130
2024-09-16 16:57:03 +00:00
Jessica Hamilton
c40570934e configure: add a version check for python.
Tooling used by HaikuDepotServer relies on typing features that
exist in Python >= 3.9.

Change-Id: I926d464130a3cef331a00b9a6abbbad5edfcefda
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8326
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-09-16 16:57:03 +00:00
Jessica Hamilton
e22ea41c57 configure: add missing sanity check for cross tools options.
Change-Id: Ia79a7eb654dc4bb8dfa35df0f85b2428965e1571
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8325
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-09-16 16:57:03 +00:00
Owen Anderson
83316034af arm64: Remove unnecessary TLB flush
Change-Id: I4c1c68dffee4fe054100293410b8988f623a8e9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8319
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
hrev58129
2024-09-16 16:55:35 +00:00
Owen Anderson
af5e461fb1 arm64: Fix TLB flushing of the kernel address space.
* Don't use ASID-delimited flushes for kernel space. The ASID comes
  from TTBR0_EL1, but kernel address space comes from TTBR1_EL1, so
  this never works.
* Adjust ProcessRange to operate on unmasked VAs. This means that
  the kernel space tag bits are preserved and passed into the
  callback, which can then pass to them to whatever flushes are
  necessary correctly.

Change-Id: If86aeea105f50fc4f294ce1c85cea5dfc938f5cf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8324
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-16 16:55:35 +00:00
Owen Anderson
129bc12b13 arm64: Factor out access flag checking when flushing TLB entries.
Change-Id: Id4c5f79042a801f1dcd2a553783862ec762c94ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8322
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-16 16:55:35 +00:00
Owen Anderson
0a36780989 arm64: Implement UnmapArea
Change-Id: Ia46b9c03dc471a795baf7b82fc146c39ce4ebeb9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8321
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-16 16:55:35 +00:00
Owen Anderson
3b098011b4 arm64: Implement UnmapPages
* Derived from RISC-V implementation

Change-Id: Ia5d95dce3dc9936f5bb6d03ed04ff4133162d93d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8320
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-09-16 16:55:35 +00:00