Commit Graph

63868 Commits

Author SHA1 Message Date
Adrien Destugues
f0a8e7e247 Tracker: don't call debugger if a file has an invalid resource
This is a bit excessive: a file with a B_MINI_ICON resource of the wrong
size should not result in crashing Tracker, the resource should simply
be ignored.

Fixes #17668.

Change-Id: I55a210eb829e568d254d8ab569720145c0ea5a09
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5115
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-03-20 12:28:15 +00:00
Augustin Cavalier
d5ff3cd050 kernel/system_info: Address review comments.
* Combine "i" and "firstCPU" iteration variables.
 * Use better variable names.

Change-Id: Ifc6fcaea6519dc4a791600f4a8bcdd38f02434f3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5111
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2022-03-18 17:02:30 +00:00
Jérôme Duval
c0ab9f51b2 intel_extreme: handle generic DTD block found in the VBT
Change-Id: Id27180b3a33778d4da66ab45b330839ae90c6382
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5110
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-03-17 07:24:11 +00:00
Jérôme Duval
d5137e7776 intel_extreme: find VBT in OpRegion version 2.0 and from 2.1
we check the OpRegion version and use the rvda pointer when available.
from 2.1 the pointer is relative.

Change-Id: I64d8aea65368aa3c5597f63a2b96b6a430e04315
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5109
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-17 07:24:11 +00:00
Alexander von Gluck IV
8fed6717a7 mkdos: Drop from image. Use mkfs -t fat
Change-Id: If79f67126e23bea6c8dbb348f075832cd0bf8360
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5107
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-03-16 01:00:39 +00:00
Alexander von Gluck IV
d188fff30b kernel/fs/fat: Fix volume label of newly created filesystems
* solves #17659
* We assigned the volume label to the root, but not the boot
  sector (partition boot sector, not MBR)

Change-Id: I9c53204c18709c2d225cc8ea338290aa89d42083
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5106
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-16 00:48:49 +00:00
Andrew Lindesay
f67e053883 HaikuDepot: Size Package Files
Obtain the size of local package files.

Fixes #17445

Change-Id: Ica15d3f7c1e80bcf9b3b23d6af851cc33b5b6253
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5016
Reviewed-by: Andrew Lindesay <apl@lindesay.co.nz>
2022-03-16 00:31:52 +00:00
Adrien Destugues
2d80f9e236 EFI: add support for dw-apb-uart used on Allwinner A10 SoC
Yet another 16550 clone under a different name. Why does device-tree
have a "compatible" setting if everyone puts a different name for the
same thing?

Change-Id: Ia889a527a36739df747ba48d4606c09764703607
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5103
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-03-15 18:26:18 +00:00
Adrien Destugues
ef41059432 EFI: get address-cells and size-cells from the device tree
They were hardcoded to 2, which is not correct on all devices. As a
result, getting addresses and sizes on pure 32bit devices would fail.

Change-Id: Icf542c9e8d6b7136219014fe08dd601387de4762
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5102
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-15 18:26:18 +00:00
Jérôme Duval
f37f79066c intel_extreme: add IDs for Jasper Lake
tested with Acer Swift SF114-34
2022-03-15 16:51:13 +01:00
Adrien Destugues
7b7cc2944b Allwinner A10 docs: fix broken link
Change-Id: I40d3bebd2f70def0a4074f2bec74c574f44d46cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5101
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-03-14 21:35:41 +00:00
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