Commit Graph

63757 Commits

Author SHA1 Message Date
Jérôme Duval
39dae8ee4e radeon_hd: handle 64-bit PCI BARs 2022-03-14 16:36:23 +01:00
Jérôme Duval
7a5f5dc504 intel_extreme: handle 64-bit PCI BARs 2022-03-14 16:19:51 +01:00
Jérôme Duval
d9df712ebc intel_gart: handle 64-bit PCI BARs 2022-03-14 16:19:51 +01:00
Rudolf Cornelissen
eb2b376271 various fgx drivers: fix cloning accelerants, allow for modelist cloning. 2022-03-13 00:18:09 +00:00
Augustin Cavalier
77034a15f8 kernel/vm: Let _user_set_memory_protection change area->protection if possible.
If mprotect() is being run over an entire area, and the area does
not have per-page protections, then we can just invoke set_area_protection
instead of allocating a protections array.

This is a major efficiency increase, as every page fault would otherwise
have to use the protections array if it was allocated.

Testing with QtWebEngine shows this new path being hit relatively often
(multiple hundred times in loading a single webpage).

Change-Id: I60258d56f681060861602922f3fbdbce2fd380d6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5097
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-03-12 17:12:49 +00:00
Augustin Cavalier
a09dd6bb6c kernel/vm: Cleanups and minor fixes to get_area_page_protection.
* We should not assume all non-kernel areas have KERNEL_READ_AREA
   permission, but follow the other permission flags directly.
   This way the kernel will be blocked from accessing guard pages, too.

 * Compute kernelProtection only once, and either return it directly
   or return it OR'd with the user protections.

Change-Id: Id6daa1cd15eb3102e23f95c08672ad97344e0722
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5096
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-12 17:12:49 +00:00
Augustin Cavalier
4c51faeb59 kernel/vm: Use get_area_page_protection in all cases of _user_get_memory_properties.
It already checks for area->page_protections == NULL and returns
area->protection appropriately if so, we do not need to test specifically
for that here.

No functional change intended.
2022-03-11 14:18:04 -05:00
Augustin Cavalier
5c69be739e kernel/vm: De-wrap line for clarity.
No functional change. Now it looks the same as the surrounding checks.
2022-03-11 14:16:59 -05:00
Augustin Cavalier
63664eaa21 kernel/vm: Do not assume "no user protection" means "kernel area".
It's entirely possible that we have a user area with a page that
has protections of 0 (e.g. a guard page). In that case we should
print the standard read/write fault message instead of "kernel"
fault messages.

This should not be a major behavioral change, only the syslog
and tracing entries should be affected; such memory accesses
should be caught by the read/write permissions checks immediately
following.
2022-03-11 14:15:56 -05:00
Augustin Cavalier
3a81e9446d kernel/vm: Check the area's cache_type, not the cache's, in cut_area.
It seems this is the type of the innermost source cache, not the
topmost cache (which well may be "RAM" if this is an anonymous cache
on top of a Vnode cache.)

Originally VMArea::cache_type was introduced 15 years ago
(commit 0c12332715, 2007)
merely to mirror the underlying cache's type. Somewhere along the way,
it acquired different values. As the VM has changed a lot since then,
perhaps its overall purpose should be re-evaluated?

Fixes #17556.
2022-03-10 17:40:15 -05:00
Augustin Cavalier
23840276a9 kernel/system_info: Rename variable based on axeld's review. 2022-03-10 16:06:11 -05:00
Augustin Cavalier
488f8888a2 network stack: Fix deadlock in get_interface functions.
If these methods are called while the interface in question
is receiving data via a receive thread, we can hit a deadlock
where a receive thread is holding the receive lock and then
tries to call get_interface_address_for_link (due, e.g., to ipv4
checking is_local_link_address), which tries to acquire the interfaces
lock, while at the same time we are trying to acquire the receive lock
due to CreateDomainDatalinkIfNeeded invoking a module's datalink_init
which calls register_device_handler, so we deadlock. (Whew!)

As far as I can tell, we do not need to set Busy() here despite unlocking
the interfaces lock, as the Interface acquires its own lock in
CreateDomainDatalinkIfNeeded.

Observed in VMware when the DHCP client spins for a long time,
and the deadlock occurs upon opening Network preferences.
2022-03-10 14:27:40 -05:00
Augustin Cavalier
2828ed2fa1 network stack: Add missing ASSERT_LOCKED_RECURSIVE. 2022-03-10 14:22:46 -05:00
Augustin Cavalier
b6bfd9b749 kernel/elf: Use Deleters and get rid of gotos in elf_load_user_image.
Briefly tested: system boots and applications launch as before.
2022-03-10 13:46:35 -05:00
Augustin Cavalier
64a051399f kernel/system_info: Avoid unnecessary usage of set_ac.
Instead add a second level to the loop and a small temporary array.
Makes the code slightly simpler (and safer, as there is no risk
of races now.)

Also add a missing "firstCPU +" in the current_frequency calculation.
It seems that has been broken since the frequency value was introduced...
2022-03-10 12:18:43 -05:00
Augustin Cavalier
4027df884e kernel/vfs: Fix mismatched frees of vnodes.
Regression from yesterday's commit. Fixes #17642.
Hopefully this is all of them.
2022-03-10 09:53:23 -05:00
Augustin Cavalier
585ce471d1 kernel/vfs: Create an object_cache for vnodes.
In addition to being slightly more efficient, this also allows one
to see precisely how many vnodes are currently "alive" across all
mounts via the "slabs" KDL command.
2022-03-09 19:02:31 -05:00
Augustin Cavalier
bb09a3ed07 kernel/condition_variable: Remove a confusing requirement for published variables.
Part of the point of published variables is to make them "shareable",
and not require external synchronization. Requiring the callers
to ensure unpublishing does not occur is thus unreasonable, as e.g.
a variable could be unpublished immediately after being notified.

That is the case for some usages of these variables in the FreeBSD
compatibility layer, which under heavy usage, can and did trigger
use-after-unpublishes and then KDLs, at least in local testing.

Instead, only unlock the hash after we have locked the variable.
This is already done in some other functions, so it's safe to do
it here, too. This way, the variable won't be unpublished
while Notify() is running.
2022-03-09 18:55:55 -05:00
Augustin Cavalier
d38d90de25 kernel/vm: Notify the low_resource manager on low_resource address space.
We cannot wait here, but now that the low_resource manager actually
does something with the information it is provided, we can invoke it.
2022-03-09 18:17:35 -05:00
Augustin Cavalier
42ed7815ff kernel/low_resource_manager: Actually set the low-resource state based on parameters.
This resolves a TODO, and allows B_KERNEL_RESOURCE_ADDRESS_SPACE
to be a bit more useful, as fragmentation will now turn in
to a low-resource notification.
2022-03-09 18:14:47 -05:00
Augustin Cavalier
3d01655a91 kernel/int: Remove now-unneded ifdef __riscv.
Following the rework to permit arch_int_assign_cpu to change what
CPU an interrupt is assigned to, this ifdef is no longer needed.
2022-03-09 18:09:20 -05:00
Augustin Cavalier
c3c7a44261 kernel/slab: Make block_alloc and block_free static.
They are not used outside this file.
2022-03-09 18:08:42 -05:00
Augustin Cavalier
1b333e9176 freebsd_network: Use MTX_SPIN for fast taskqueues instead of a direct spinlock. 2022-03-09 17:26:23 -05:00
Augustin Cavalier
385fce1cde freebsd_network: Properly implement callout_drain().
Also cleanup code a bit.

May help with #17634.
2022-03-09 17:10:55 -05:00
Augustin Cavalier
49fd143d15 freebsd_network: Print the taskqueue name in the timeout KASSERT.
Should help with diagnosing #17634.
2022-03-09 17:10:15 -05:00
Augustin Cavalier
45f4882a72 libroot: Allow posix_spawn to use load_image in more cases.
If a spawnattr and file_actions are specified but empty, that
can be treated the same as if they were passed as NULL.
2022-03-09 16:20:42 -05:00
Augustin Cavalier
2f26390421 libroot: Remove another unused glibc header. 2022-03-09 16:02:44 -05:00
Augustin Cavalier
3a76add7d3 libroot: Replace a64l/l64a with musl equivalents. 2022-03-09 15:50:30 -05:00
Augustin Cavalier
92ca4f66a7 libroot: Remove duplicate obstack.h and obprintf.
We never included obprintf in the build, and the real obstack.h
exists in the "extensions" folder. Unfortunately, it seems the
BeOS R5 libroot had an obstack.h in the public POSIX headers
directory and exported the functions, so we cannot remove it
completely just yet.
2022-03-09 15:29:12 -05:00
X512
b19f5c839b kernel/x86: add ability to set GS segment base from userland
Needed for Wine.

Co-authored-by: Jérôme Duval <jerome.duval@gmail.com>

Change-Id: I13f6a5802fce04fd2ebb4cc01ecd2f12c90830db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4839
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-09 18:28:00 +00:00
Alexander von Gluck IV
397102c17d boot/riscv64: Fix -znotext invocation to work under ld and lld
Change-Id: If47b0aeeda49661e466c66cabd2ac9a83f16aeef
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4987
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-09 13:47:03 +00:00
Alexander von Gluck IV
e9541a68ed build/riscv64: Disable relaxation linker optimization under clang/lld
* Fixes errors compiling under clang around 'R_RISCV_ALIGN
  requires unimplemented linker relaxation'
* Same fix FreeBSD applied https://reviews.freebsd.org/D25210

Change-Id: I680cac5e3e73d3ebb84aa0741bcee61530405db0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4986
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-09 13:45:04 +00:00
Jérôme Duval
86e5dd70f6 glibc: add missing prototypes in wchar.h
fixes #17636

Change-Id: Iab9db947abf9b13d840fb94d2095f1c42f1c4051
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5077
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-09 08:56:41 +00:00
Humdinger
1e174254d6 Media replicant: fix menu label "Sounds preferences"
Change-Id: I561393f3d8663e650a27380eb45bcf4412af87a9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5076
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-03-08 07:08:22 +00:00
Jérôme Duval
62dbe4d6c9 intel_extreme: map with kernel permissions only. 2022-03-07 12:03:10 +01:00
Rudolf Cornelissen
c9e1571cc3 intel_extreme: added Intel ACPI OpRegion basic support for fetch of native panel modeline. 2022-03-06 23:47:19 +01:00
Augustin Cavalier
d497bf51a6 kernel/wait_for_objects: Fix copy/paste error in poll().
Seems none of the applications I tested yesterday actually used poll(),
because it was completely broken by this.

The previous code assigned this variable inside a malloc() call, though,
which wasn't all that obvious either.
2022-03-05 11:16:14 -05:00
Augustin Cavalier
f666c0873e kernel/wait_for_objects: Use BStackOrHeapArray for userland data.
Especially in select(), this cuts overhead significantly,
as we now only invoke malloc() once, and for small select()s
we never have to.
2022-03-04 16:56:46 -05:00
Augustin Cavalier
856721d9fe kernel/vfs: Use correct select pointer type in allocation of IO context.
All pointers are the same size of course, so this is not a functional change.
2022-03-04 16:15:40 -05:00
Augustin Cavalier
ce172b8e10 freebsd_network: Check for errors in usbd_transfer_submit.
This way, transfers that fail to queue will have their callbacks
actually invoked.

Fixes hangs when trying to disable unplugged USB WiFi devices.
2022-03-04 16:04:53 -05:00
Dale Cieslak
2398586d63 Pairs: reset IsFirstClick to true for New game
Reset the value of IsFirstClick to true whenever a new game is
started. Without this fix the board gets confused if there is
a card flipped when a game is restarted.

I can't reproduce any of the other oddities in the ticket but
this fixes the egregious repro case mentioned.

Fixes #6932

Change-Id: Ie5cedd7fc2ca411db722d3c24f68fe9aa48f7b5f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5038
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-02 22:42:05 +00:00
Adrien Destugues
015b40866c vesa: live mode patching, nvidia version.
Some improvements to allow setting 8, 15, 16 and 32bit modes, and detect
the correct mode number after patching the BIOS automatically, instead
of hardcoding it.

Also move the patching code to a separate file.

Fixes #10570.

Change-Id: I920f448b59ad7373cb8595d92ce3fa52324be67e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4629
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-02 22:39:02 +00:00
Adrien Destugues
9515cd8c6f vesa: implement live patching for ATI/AMD cards
This uses atombios headers to find where in the BIOS the video mode
tables is located. Then, we can replace entries in the table (in a RAM
copy of the BIOS, of course) and inject any video mode we need. To make
the table easy to find, the Atombios headers from the radeon_hd are
reused, but no atombios code execution takes place here.

Change-Id: If1981b1574822d4ce1e072dd6437a727192ce7cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4628
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-02 22:39:02 +00:00
Adrien Destugues
6a175a5ddc vesa: report BIOS manufacturer (visible in screen preferences)
Get the OEM string from the VESA info block (and also get the memory
size from there while we are at it). If the string is empty, use the
BIOS type (identified in other ways) to still report something.

Change-Id: I8cbd75d19f624a43db05e82d1e1b2a536cc418b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4625
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-02 22:39:02 +00:00
Adrien Destugues
1005a27603 vesa: live BIOS patching for Intel video devices
The VESA standard does not define any way for software to set a custom
video mode, which means normally we would be constrained to whichever
modes the video card manufacturer decided to provide. However, since we
run the BIOS in an emulated environment, it is possible (and even quite
easy) to patch it and inject any video mode we want, provided we know
the format to use and where to put the info in.

This approach was used in the NewOS VESA driver, as well as in
915resolution (a tool that predates the availability of native drivers
for Linux for Intel videocards). Later on it was also used in Chameleon
and Clover, bootloaders that are used for hackintoshes (running MacOS on
unsupported hardware).

This commit implements full support for Intel cards only, AMD and NVidia
will be added later (but there is preliminary code to detect them)

Change-Id: I2c528ba18b3863f486da694860a10761efcbfb3f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4624
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-02 22:39:02 +00:00
David Karoly
6804f6c764 kernel/arm: implement entering userspace
Change-Id: Icf3945db979a8f4444856fc7157649f48b297c29
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5037
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-02 22:38:25 +00:00
Augustin Cavalier
6acf0b3e21 freebsd_wlan: Reduce -O0 to ieee80211_scan_sw.o.
This is the only file that seems to be affected by whatever the problem is.

Part of #17458.
2022-03-02 16:28:59 -05:00
Augustin Cavalier
84f45724fc kernel/Jamfile: Remove invalid character. 2022-03-02 15:05:31 -05:00
David Karoly
289b735673 arm: fallback to icu-57.2 for haikuportscross
Change-Id: Iad87ab9675314d52cf1748afb1bd9017ec911178
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5036
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-03-02 19:28:50 +00:00
Adrien Destugues
455468cbfd sdhci_pci: remove (incomplete) use of MSI
MSI was never implemented in this driver and only used for a log during
initialization. Remove it for now.

This makes it easier to use the driver on non-x86 systems where there is
no MSI.

Change-Id: I39ccbb82b78ea98c0d045ef07ee9bb28c775e292
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4847
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-03-02 09:13:33 +00:00