Commit Graph

63848 Commits

Author SHA1 Message Date
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
David Karoly
fdb459132e boot/efi/x86: implement SMP detection and bootup
* move common SMP initialization code to x86/arch_smp.cpp

* factor out arch-specific SMP initialization to
  arch_smp_32.cpp resp arch_smp_64.cpp

* implement smp_trampoline for x86 32-bit EFI loader

* rename SMP trampoline for x86_64 to long_smp_trampoline

* add new argument virtKernelArgs to arch_smp_boot_other_cpus
  as the kernel args are not identity mapped on 32-bit architectures

Change-Id: I30d0bb1fa9bfb08f6784a2af34eb83d6b64afa57
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4869
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-03-01 17:39:19 +00:00
Rudolf Cornelissen
456e6f33dd intel_extreme: added more pipeC support, fixes for eDP on DDI systems 2022-02-27 22:25:04 +01:00
Zakero
11dc1393cf Minor Terminal fixes
In the Terminal settings window, the pop-up help text for
"Tab title:" had two entries for "%% - The character '%'.".
Removed one of the entries.

Fixed the spelling of some constants: kTooTip* vs kToolTip*

Changing the window title and tab title directly will now
show the same tool-tips as the Terminal settings window.

Change-Id: Ic36cc1f8af0305b757105a229203115efee870c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4989
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Máximo Castañeda <antiswen@yahoo.es>
2022-02-27 19:10:39 +00:00
Humdinger
7753e163c9 Mixer: Remove option to refuse format changes from audio mixer GUI
The options "Refuse in/output format changes" were meant to prevent
format changes of connections on the fly, without tearing down and
establishing a new connection.
The mixer does not support such format changes for input.

With this patch input format changes are refused - the former
default setting.
Output format changes are at least mostly implemented, so we are
allowing format changes here.

Both options get removed from the Audio mixer setup panel of the
Media preferences. The code those settings themselves is kept.

Thanks Máximo Castañeda for the investigation, see
https://www.freelists.org/post/haiku-development/Explain-the-Audio-Mixer-Setup-options-of-Media-preferences,26

Change-Id: Idb2d0674a4701014249bc5252a7e4ccedc4f532f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4934
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-02-27 06:51:38 +00:00
David Karoly
4c6e7a4bca kernel/arm: implement prefetch abort handler
Change-Id: I39c330a44ad36ede41c7727017dd733d07288be9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4983
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-02-26 22:08:57 +00:00
David Karoly
883858e60b implement TLS for arm
Use the User Read-only Thread ID Register aka TPIDRURO to store
TLS pointer.

The User Read-only Thread ID Register is read-only in User mode,
and read/write in privileged modes.

see: ARMv7 Architecture Reference Manual,
section B3.12.46 CP15 c13 Software Thread ID registers

Change-Id: I7bff2fd66f41d7bf1a8a247151bcd02b32733c1b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4994
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-02-26 11:41:40 +00:00
Autocomitter
8a2698fe28 Update translations from Pootle 2022-02-26 08:07:32 +00:00
Augustin Cavalier
0463bae558 realtekwifi/rtwn: Synchronize with FreeBSD trunk as of today.
A few changes ommitted (e.g. NET_EPOCH) as they are not needed.
Adds support for a variety of USB devices and one PCI device.
2022-02-25 15:37:50 -05:00
Augustin Cavalier
4e02cb0d87 freebsd_network: Add stub epoch.h.
We don't have a need for these APIs, so we can leave them as dummies.
2022-02-25 15:36:56 -05:00