Commit Graph

10212 Commits

Author SHA1 Message Date
Augustin Cavalier
bb2808d615 bootloader: Implement TSC calibration via hypervisor CPUID leaf.
While debugging some problems on the HaikuPorts build VMs, mmlr
noticed their clocks had an alarming amount of drift. This prompted
an investigation into TSC calibration mechanisms, and the discovery
that there is a VM-specific one which we did not implement.

This mechanism is more accurate than counting cycles on VMs where
cycles can be "stolen" (the probable cause of the aforementioned
clock drift.)

Tested in VMware (works out of the box) and on QEMU/KVM
(may need TSC frequency specified or a host with invariant TSC.)

Change-Id: I4ccfdb2e4e2621404ec9026e7106c02bf96faf18
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7063
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-10-25 00:53:55 +00:00
Jérôme Duval
6d42b430d1 virtio: support modern devices
fixes #17239 #17238

Change-Id: Ia5b6347110a60fab18852079b30dca6301010474
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6995
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-10-15 13:02:41 +00:00
Alexander von Gluck IV
518e9cb9f2 radeon_hd: Add missing USB C connector type
* Solves a few "Unknown connector" errors on newer cards.
* It's just another physical name for DisplayPort

Change-Id: I37a6f1bb1db66279b305bdbce3c200612eac1130
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7042
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>
2023-10-14 17:19:12 +00:00
Augustin Cavalier
5c32c5ef2f condition_variable: Reorder members for optimal sizing.
Class size now 48 instead of 56 bytes (on x86_64.) No functional change.
2023-10-09 21:08:53 -04:00
Augustin Cavalier
788b1b12b6 Get rid of kernel_c++_structs mechanism.
This undoes fc7864091e.

It was only ever used by the FreeBSD compatibility layer,
only supported one structure, and created problems with
concurrent builds.
2023-10-09 20:26:21 -04:00
Yn0ga
cbb88108d5 Various PowerPC fixes
* Removed atomic operations placeholders for modern ones
* Fix chrpscript & hfsmaps location for CDBootImage (haiku-boot-cd target)
* add of_blocks & of_blocksize openfirmware call

Change-Id: Iaaddc2c566d108976ac5e5e08caea1fc59523e06
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6987
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-10-06 20:38:24 +00:00
X512
98895d0417 riscv64/mmu: use struct bitfield for flags and std::atomic
Fixes some PTE concurrent access bugs.

Change-Id: I09ec56861fae389a8a3e228b17a3921b85202c8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6949
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2023-09-25 15:50:59 +00:00
X512
f83058d1ed elf: add PT_RISCV_ATTRIBUTES program header
Attribute is ignored for now.

It is supposed to check ABI compatiblity and reject loading incompatible images.
Haiku currently do not use multiple ABIs for RISC-V so it is safe to ignore attributes.

PT_RISCV_ATTRIBUTES program header is produced by default in GCC 13 and Clang 17.

Change-Id: I4659e9bacbf34a2a0bc16b34c2aaa37232d700fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6948
Reviewed-by: David Karoly <karolyd577@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2023-09-25 15:20:13 +00:00
Andrew Lindesay
4b347fccb2 HaikuDepot: Token Based Authentication
This switches the application over from using basic
authentication to using token-based authentication in
preparation for later using Open-ID based
authentication flows. The application version is also
bumped in order that the server can detect this version
at some later date in the future when it no longer
supports basic authentication itself.

Change-Id: I7addde1d57503c58d6bcd54908f22f66830c0c59
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6944
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-09-25 06:20:32 +00:00
Augustin Cavalier
76681bd900 kernel: Rewrite B_DEBUG_SPINLOCK_CONTENTION.
* Replace count_low/count_high with bigtime_t fields plus an int32.
   sizeof(spinlock) is now 32 bytes with the debug option enabled.

 * Adjust and clean up all spinlock code to use the new fields.

 * Fold DEBUG_SPINLOCK_LATENCIES into the new code. Remove the bootloader
   option and other flags for it (these were not compiled in by default.)

The new code should be much easier to understand and also more powerful.
However, the information transmitted to userland isn't as useful now;
the KDL command output will have the interesting information.

(Things could be reworked to transmit more interesting information to
userland again if desired, but as this code clearly hadn't been compiled
for many years, as it referred to global spinlocks that have been gone
for a very long time.)

Change-Id: I2cb34078bfdc7604f288a297b6cd1aa7ff9cc512
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6943
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-09-23 18:41:04 +00:00
Augustin Cavalier
ef9e2f627b kernel/arch: Make arch_debug_get_caller() a macro implemented by a builtin.
Only the x86 and PPC implementations look like they would have worked,
while the builtin is available and will work across all architectures.
We already use it unconditionally in some parts of libroot.

Change-Id: I2dffb3b2c7cdd605092382b9d649151adb921bb4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6942
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-09-23 18:41:04 +00:00
Augustin Cavalier
f759ab2733 headers/compatibility/bsd: Update headers to remove BSD advertising clause.
Rewrite link.h entirely.
2023-09-21 18:38:10 -04:00
Augustin Cavalier
2e0e70b5bb libroot: Delete some old private math headers.
These haven't been needed or used in a long time.
2023-09-21 18:31:22 -04:00
David Karoly
dc3b3e172d m68k: VMTranslationMap.h is not needed in arch_vm.h
Change-Id: Ica0efdeabaa73be0030e0522352c0c3bf311a9ad
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6913
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-09-17 19:12:33 +00:00
Trung Nguyen
ea2870c839 headers: Define static_assert for C11
Defines the `static_assert` macro in `assert.h` as required by
the C11 standard.

Change-Id: Ic25dc99537f995404b7b4280b72c6000a293a1df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6916
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2023-09-04 05:58:31 +00:00
Augustin Cavalier
efdfb84038 signal.h: Look for _DEFAULT_SOURCE not __USE_GNU for sighandler_t.
Our features.h does not define __USE_GNU, and so applications trying
to use this GNU-ism would have to define it for themselves, even if
_GNU_SOURCE had already been specified.
2023-08-30 17:31:31 -04:00
Augustin Cavalier
8e8c7a073f Tracker: Reimplement BSlowContextPopup as BPopUpNavMenu.
BSlowContextPopup was mostly a duplicate class of BNavMenu
only on top of BPopUpMenu instead of BMenu. Now, BPopUpNavMenu
just subclasses BNavMenu and adds the few features of BPopUpMenu
neccessary.

Drag-and-drop of files using the pop-up nav menu seems to still work fine.

Change-Id: Ic1f49c5bed60fff7a3076a22f74aebc6eba51d57
2023-08-30 17:04:24 -04:00
Leorize
e86afc8f75 libs/bsd: add arc4random(3)
Change-Id: I86e67484f04b062a4496cb63ccb34b990868b693
Reviewed-on: https://review.haiku-os.org/c/haiku/+/32
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-08-29 19:42:27 +00:00
Augustin Cavalier
6bde05aebd libs/bsd: Implement getentropy(2).
With generic_syscall to avoid using a FD.

Change-Id: Id1702118bb673f06a861e4f0ad3401ce3d45cbd0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/31
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-08-29 19:42:27 +00:00
Zardshard
c6c2c04284 Icon-O-Matic: Add perspective transformations
As part of adding perspective transformations, agg_trans_perspective.h
was patched to fix a multiple definitions error. This change has been
submitted for review to the "upstream" repositories at [1], [2],
and [3].

Also includes various other improvements such as VertexSource being
split into its own file, code style improvements, and documentation
improvements.

[1] https://sourceforge.net/p/agg/patches/6/
[2] https://github.com/ghaerr/agg-2.6/pull/9
[3] https://github.com/aggeom/agg-2.6/pull/7

Change-Id: I4bffd2f87354bde10155e23145a232a925be6ff3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6801
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-08-22 09:44:49 +00:00
Zardshard
a1c86e7ada agg: Pull in updated perspective transformation
The new version has many more features than the old one. This update
is necessary for an upcoming update to Icon-O-Matic adding perspective
transformers.

This update is pulled from https://github.com/ghaerr/agg-2.6 at commit
e7db22bd12700118257b4cb780539c421e01aa51 with our changes applied on
top. Note that this repository isn't necessarily the chosen upstream
that all future updates should be pulled from. See the discussion
starting at [1] for more information.

This also updates the affine transformation since the newer perspective
transformation requires the newer version.

[1] https://discuss.haiku-os.org/t/gsoc-2023-progress-on-perspective-transformation-haiku-project/13594/34

Change-Id: Ic578eec15fbb9131338b3c605c737ce1bfb252ca
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6808
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-08-22 09:44:20 +00:00
Jérôme Duval
efbeada748 gnu: add sched_getcpu()
on x86_64 implemented with rdtscp or rdpid, generically with a syscall.

Change-Id: I8f776848bf35575abec8a8c612c4a25d8550daea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6866
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-08-21 17:55:16 +00:00
Trung Nguyen
303ff56a5f unix: Implement SO_RCVBUF
Implemented `UnixBufferQueue::SetCapacity` so that `setsockopt`
with `SO_RCVBUF` will not always return an error.

Change-Id: I2d9be84633f84474fac64b379e9f89ef2751a094
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6816
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-08-13 21:14:51 +00:00
Jérôme Duval
b761f9250a unix: respect MSG_DONTWAIT on recvmsg
fix #18548

Change-Id: I33f502c2a376be6dbdf913f9613aab9d4c5a3644
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6802
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-08-09 17:10:28 +00:00
Jérôme Duval
3487453788 unix: respect MSG_DONTWAIT on sendmsg()
fix bug #18539

Change-Id: Id21362028287d1cbdac469226e6b52f4547a276f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6796
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-08-07 13:24:45 +00:00
Augustin Cavalier
9b28ebf997 DoublyLinkedQueue: Rework Remove() function.
Equivalent to the changes done to DoublyLinkedList
(in 904e9f5512305dbc0eed9146e8a0b2d597269b71.)
2023-08-04 13:25:56 -04:00
Augustin Cavalier
74662b662d DoublyLinkedQueue: Adjust API to match that of DoublyLinkedList.
It appears nothing actually uses this method anyway.
2023-08-04 13:17:18 -04:00
Augustin Cavalier
5d8502cb2b bluetooth: DoublyLinkedQueue is not actually used. 2023-08-04 13:16:57 -04:00
Augustin Cavalier
65c74c6474 DoublyLinkedQueue: Adjust whitespace.
No functional change.
2023-08-04 13:11:52 -04:00
Augustin Cavalier
904e9f5512 DoublyLinkedList: Rework Remove() function.
* Check fFirst/fLast instead of previous/next. Avoids
   list corruption when trying to remove already-removed
   elements, instead will cause null-dereference KDL.

 * Always set next/previous to NULL even when DEBUG is not
   enabled.
2023-08-03 13:18:26 -04:00
Augustin Cavalier
5ae1a17908 Revert "DoublyLinkedList: Add a RemoveAllBefore convenience function."
This reverts commit c6cd9b51a2.

This wound up being unnecessary for the event_queue implementation,
and furthermore is of dubious value in general.
2023-08-03 12:45:36 -04:00
Augustin Cavalier
3386b8b785 libbsd: Add a basic kqueue implementation.
It only supports file descriptors and processes (threads),
and a few flags (not all) to go with them.

This has been tested extensively against libuv.

Change-Id: I6fc5930fa7273698172c9c695965842b5df44f03
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6746
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-07-29 15:53:15 +00:00
Augustin Cavalier
f66d2b46a8 kernel: Add event queue implementation to wait for objects efficiently.
Based on hamishm's original patch from 2015, but heavily modified,
refactored, and reworked.

From the original commit message:

> When an object is deleted, a B_EVENT_INVALID event is delivered,
> and the object is unregistered from the queue.
>
> The special event flag B_EVENT_ONE_SHOT can be passed in when adding
> an object so that the object is automatically unregistered when an
> event is delivered.

Modifications to the original change include:

 * Removed the public interface (syscalls remain private for the moment)

 * Event list queueing/dequeueing almost entirely rewritten, including:
  - Clear events field when dequeueing.

  - Have B_EVENT_QUEUED actually indicate whether the event has been
    appended to the linked list (or not), based around lock state.
    The previous logic was prone to races and double-insertions.

  - "Modify" is now just "Deselect + Select" performed at once;
    previously it could cause use-after-frees.

  - Unlock for deselect only once at the end of dequeue.

  - Handle INVALID events still in the queue upon destruction,
    fixing memory leaks.

 * Deduplified code with wait_for_objects.

 * Use of C++ virtual dispatch instead of C-style enum + function calls,
   and BReferenceable plus destructors for teardown.

 * Removed select/modify/delete flags. Select/Modify are now the same
   operation on the syscall interface, and "Delete" is done when 0
   is passed for "events". Additionally, the events selected can be fetched
   by passing -1 for "events".

 * Implemented level-triggered mode.

 * Use of BStackOrHeapArray and other convenience routines in syscalls.

Change-Id: I1d2f094fd981c95215a59adbc087523c7bbbe40b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6745
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-07-29 15:53:15 +00:00
Augustin Cavalier
f64c46e636 kernel & libroot: Implement per-team unnamed semaphores.
This requires breaking syscall ABI to add the "flags" parameter
to _kern_mutex_sem_release.

Resolves a TODO.
2023-07-25 16:26:22 -04:00
Augustin Cavalier
aca21731ff kernel/condition_variable: Return the count of unblocked threads from Notify.
No reason not to, and it's needed in user_mutex to avoid a very rare
potential race, anyway.
2023-07-25 15:27:40 -04:00
X512
0235c04759 util/Bitmap: add more utility methods
Change-Id: I021c2fafa01266e8a38c1cb2fd748fd89a4b75bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6742
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-24 21:00:56 +00:00
Augustin Cavalier
c6cd9b51a2 DoublyLinkedList: Add a RemoveAllBefore convenience function.
Extracted from hamishm's event queue patches.
2023-07-24 16:09:42 -04:00
Augustin Cavalier
a2efc7ec03 AVLTree: Unify removal implementations.
Extracted from hamishm's eventqueue patches.
2023-07-24 16:09:21 -04:00
Trung Nguyen
8e8250e9dd headers: Explicitly hide BAlert functions
Explicitly hide some BAlert functions that ought to have been
deleted. This prevents binding generators from thinking that these
functions are available, causing undefined symbol errors during
link time.

Change-Id: I56f53808851b82a10f31015d2351d4e2c29b6f33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6718
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-07-18 16:43:33 +00:00
X512
da70563f7f interface/Size: fix -Wdeprecated-enum-float-conversion warning
Change-Id: I8ca131f57495f974a79292a42ba5ce42a47d2437
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6702
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-15 13:10:33 +00:00
X512
1d9ad3fad7 mmu/riscv64: implement global page mapping support
ASID allocation is not supported yet, so always use ASID 0 for user pages for now.

Change-Id: I021e77dae692c22984bc625dd0588362bece45b7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6698
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2023-07-11 17:34:31 +00:00
Trung Nguyen
3cb845283e headers/os: Make headers generator-friendly
Make Haiku headers a bit more friendly to binding generators by:
- Giving some `enum`s names (especially those that appear in
default arguments).
- Converting an internal `inline` function into a macro so that
the result could be evaluated in compile time.

Change-Id: I770674ad8fa7b24ac30b6b447d52a4b4c2530b8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6716
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-11 14:40:02 +00:00
PulkoMandy
899e0ef82b userlandfs: use std::bitset for FSCapabilities
gcc 13 is confused by the custom bitset implementation, so use the C++
standard one instead.

However, this results in including the C++ <string> header in kernel
code. This doesn't work for gcc2, because of two problems:

- That header includes a declaration of atomic_add that doesn't match
the one in SupportsDefs.h (which can in some cases replace the function
with a #define for an inline version). Adjust the header to use the
be a problem because it creates a risk of circular inclusions.
Standard C++ headers shouldn't depend on BeAPI ones.
- It also leads to the inclusion of iostream which defined lock and
unlock functions in the global namespace. We don't want these, and they
are not part of the C++ standard, so just remove them.

Ideally we could use std::hash for the GetHashCode implementation, but
that doesn't work because it depends on an helper function that's in
libstdc++, and we can't link that from kernel add-ons.

Change-Id: Iee07280beb4dddf7a9b6160e37f3b816e4de89ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6663
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-10 06:27:18 +00:00
Augustin Cavalier
30fda09a95 kernel: Rewrite KDEBUG_RW_LOCK_DEBUG.
Previously this just turned the rw_lock into the equivalent of a
recursive_lock, which meant that reader vs. writer assertions
were of no use.

Now, we have a per-thread static array which stores the held read
locks, allowing ASSERT_READ_LOCKED_RW_LOCK to work properly,
and allowing multiple readers to be active at a time.

This probably should still remain disabled even on nightly builds,
but at least it's much more useful as a debugging tool than it was
beforehand.

Change-Id: I386b2bc2ada8df42f4ab11a05563ef22af58e77f
2023-06-29 21:04:40 -04:00
Niels Sascha Reedijk
3fb092979e kernel: provide kernel-level equivalents for math.h and stdlib.h
GCC 13 is more strict about what C++ features are available in a freestanding
(= build without standard library) build. The `stdlib.h` and `math.h` headers
are redefined as part of libstdc++. If the object is built as freestanding, it
should be assumed that none of the standard library functions are available.

The solution in Haiku has been to add part of the standard library into the
kernel shared object. The method of exposing them has been to allow the
use of `stdlib.h` and `math.h` in the kernel and in kernel add-ons.

This change allows that approach to continue. What it does, is that it defines
specific headers which will be picked up when a module is built using private
kernel headers. When building for the kernel (or for the boot module), it will
bypass GCC 13's libstdc++ default behaviour of not including the POSIX/platform
header with all the function definitions.

An alternative to be considered for the longer term is to specifically define
the parts of the C/C++ standard library that is available in the kernel in
these headers, or create custom headers when building kernel modules (which is
how Linux approaches it).

Change-Id: Icab4614f642219fa77732b02401570708ee9a963
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6645
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-06-28 07:11:17 +00:00
Augustin Cavalier
513f86c7de user_mutex_defs: Add note that the flags area is shared with timeout flags.
No functional change.
2023-06-19 16:40:33 -04:00
Augustin Cavalier
70e8eacb35 kernel: Implement realloc_etc and make use of it. 2023-06-19 16:33:22 -04:00
Trung Nguyen
bdcc293fa8 kernel/vm: handle page protections in cut_area
- Resize the `page_protections` array in `cut_area` and also shift
the bits if necessary.
- Set the correct protection array as well as the real page
protections for the second area produced by `cut_area`.

Change-Id: I62293480487e869420ebe5a3bc729cec2a14c687
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6395
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-06-19 15:59:11 +00:00
Augustin Cavalier
93d7d1c52c user_mutex: Per-team contexts.
This requires the introduction of the flag B_USER_MUTEX_SHARED, and then
actually using the SHARED flags in pthread structures to determine when
it should be passed through.

This commit still uses wired memory even for per-team contexts.
That will change in the next commit.

GLTeapot FPS seems about the same.

Change-Id: I749a00dcea1531e113a65299b6d6610f57511fcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6602
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-06-19 14:56:10 +00:00
David Karoly
b799d160f2 kernel/arm/paging: implement Modified Flag
* Introduce SWDBM flag similarly to the arm64 port
* Reuse TEX[2] for SWDBM flag which should be availble
  to be used by the operating system if TEX remap
  is enabled.
* Introduce SetAndClearPageTableEntryFlags for updating
  accessed and modified flags atomically
* Startup sequence is handled similarly to accessed flag, i.e.
  set Modified flag in initially mapped pages in bootloader and early map.
* Once the kernel initialization has progressed enough,
  pages are mapped as read-only and modified flag handling is done
  in the page fault handler.

Change-Id: I8f761e2c6325d1b91481abd569d5e8befded0761
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6518
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-06-18 11:18:24 +00:00
Augustin Cavalier
6554d7448d kernel: Print the first 4 chars of cvar names in KDL "threads" command.
Condition variables are now a pretty common way the kernel blocks threads.
That means the "threads" command was getting difficult to navigate, since
at any given time, a lot of threads could be blocked on "cvar".

Now we try (carefully, because it could fault!) to fetch the first 4
characters of the "type" name and display then. This suffices to
distinguish the most common object block types in the list at a glance
(e.g. "cvar:port" for port reads, the most common.)

Change-Id: I94f4b59fd78b7ebdce913944551a5e98f0ca2e33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6605
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-06-13 19:41:07 +00:00
PulkoMandy
37e1b12911 framebuffer: report display EDID data
This allows to see the display in Screen preferences, and know its DPI
and physical size (as much as EDID data can be trusted). This
information could be used to compute the default font size, for example,
so it's important that all drivers provide it whenever possible.

Change-Id: Ic3d04e53cf5fcb24e22d35661d2b364a257947da
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6576
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-06-11 11:23:01 +00:00
Augustin Cavalier
6f3f29c7dd user_mutex: Refactor locking and unblocking mechanism.
Suppose the following scenario:

1. Thread A holds a mutex.

2. Thread B goes to acquire the mutex, winds up in kernel waiting.

3. Thread A unlocks; first unsets the LOCKED flag.
   As WAITING is set, it calls the kernel; but instead of processing
   this immediately, the thread is suspended for any reason (locks,
   reschedule, etc.)

4. Thread B hits a timeout, or a signal. It then unblocks in the kernel,
   which causes the WAITING flag to be unset.

5. Thread C goes to acquire the lock. It sets the LOCKED flag.
   It sees the WAITING flag is not set, so it returns at once,
   having successfully acquired the lock.

6. Thread A, suspended back in step 3, resumes.

Now we encounter the problem. Under the previous code, the following
would occur.

7. Thread A sees that no threads are waiting. It thus unsets the LOCKED
   flag, and returns from the kernel. Now we have a mutex theoretically
   held by thread C but which (illegally) has no LOCKED flag set!

8. Some other thread tries to acquire the lock, and succeeds, for LOCKED
   is not set. We now have one lock owned by two separate threads.
   That's very bad!

The solution, in this commit, is to (1) switch from using "atomic_or"
to lock mutexes, to using "atomic_test_and_set", and (2) mandate that
_kern_unblock_mutex must be invoked with the mutex already unlocked.

Trying to solve the problem with (2) but without (1) produces other
complications and would overall be more complicated. For instance,
all existing userland code expected that it would set LOCKED, but then
check LOCKED|WAITING. If _kern_mutex_unlock does not unset LOCKED,
then whichever thread sets LOCKED when it was previously unset is
now the mutex's undisputed owner, and if it fails to notice this,
would deadlock.

That could have been solved with extra checks at all lock points, but
then that would mean locks would not be acquired "fairly": it would
be possible for any thread to race with an unlocking thread, and
acquire the lock before the kernel had a chance to wake anyone up.

Given how fast atomics can be, and how slow invoking the kernel is
comparatively, that would probably make our mutexes extremely "unfair."
This would not violate the POSIX specification, but it does seem like
a dangerous choice to make in implementing these APIs.

Linux's "futex" API, which our API bears some similarities to, requires
at least one atomic test-and-set for an uncontended acquisition,
and multiple atomics more for even the simplest case of contended
acquisition. If it works for them, it should work for us, too.

Fixes #18436.

Change-Id: Ib8c28acf04ce03234fe738e41aa0969ca1917540
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6537
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-06-08 16:49:05 +00:00
Augustin Cavalier
b24cc7ca75 pthread: Use 1 for PTHREAD_BARRIER_SERIAL_THREAD.
pthread_barrier_wait can return errors, which on Haiku are negative
and so -1 is an error condition, it should not be reused for a magic
constant.

This breaks ABI. However, until the recent fixes, barriers were so broken
that I doubt any application was using them seriously (Mesa, for instance,
has them disabled.)

Change-Id: Ica23921de012a33e9e7aded816bb1347bd157b31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6517
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>
2023-06-07 15:12:11 +00:00
David Karoly
f61fb770f0 kernel/arm: don't set Accessed Flag when initially mapping a page
Pages should not be marked as accessed when initially mapping them.

However, there's a short interval during kernel startup when new pages
are mapped but the fault handler is not installed yet.

Therefore, we set Accessed Flag to 1 in early_map.
Once the kernel initialization has progressed enough, we start mapping
new pages with Accessed Flag set to 0.

The chicken and egg problem of initially mapping the vector page is
tackled by preallocating the vector page in the boot loader.

Change-Id: Ie3be4f81812d7a090af57e8c79420598d16182b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6450
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-06-06 18:49:56 +00:00
Augustin Cavalier
0450e7b802 USB: Acquire the device manager lock before Explore.
We must do this to prevent lock order inversion: when busses are
initialized, they are started by the (locked) device manager, and
then acquire the explore lock. We must do the same in Explore itself,
for when called by the explore thread, we would otherwise first acquire
the explore lock, then (when publishing new nodes) acquire the device lock.

Should fix #18421 and #18393.
2023-05-31 16:49:41 -04:00
Augustin Cavalier
cb1df90e30 Revert "kernel/vm: handle page protections in cut_area"
This reverts commit de07bc3fa5.

That's what I get for fixing bugs on test branches.
2023-05-31 14:48:23 -04:00
Trung Nguyen
de07bc3fa5 kernel/vm: handle page protections in cut_area
- Resize the `page_protections` array in `cut_area` and also shift
the bits if necessary.
- Set the correct protection array as well as the real page
protections for the second area produced by `cut_area`.

Change-Id: I62293480487e828970ebe5a3bc729cec2a14c687
2023-05-31 14:47:40 -04:00
Trung Nguyen
bfd3d33765 strace: Print detailed signal information
- Add support for retrieving the `siginfo_t` structure of a signal
event from the Debugger API.
- Add code to `strace` to display this information every time a
signal event occurs, similar to the Linux `strace` tool.

Change-Id: If4e92bbae049ee0b52efaf9fc911d66511da62f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6393
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-05-31 16:34:12 +00:00
Augustin Cavalier
55a468820c USB: Support physical-vector bulk requests.
Introduce a new utility method, "generic_memcpy", which takes
generic_addr_t plus indications of whether these specify virtual or
physical addresses (and potentially user addresess) and calls the
appropriate memcpy variant depending.

All bus drivers adjusted to support this at once. We don't actually
take advantage of the physical addresses in any way (yet), as USB
controllers have some pretty specific requirements that would have
to be carefully validated to use these directly.

All bus drivers tested and confirmed to still be working.

Change-Id: I66326667e148091147bb2b3d0843a26fb7e5bda6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6479
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-05-30 17:54:28 +00:00
Augustin Cavalier
65cdc13e7d kernel: Migrate struct generic_io_vec to a private header outside src/.
This way it is more easily accessed from drivers outside the kernel,
which it soon will be, without having to add an explicit UseHeaders.
(The drivers that use it already all use the IOScheduler.)

No functional change.

Change-Id: Ibc2d2678e37d9d7ab73391cb17b72cca86f92132
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6477
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-05-30 17:54:28 +00:00
Augustin Cavalier
e223e8e94b kernel/x86: Initialize IO-APIC only after PCI enumeration is complete.
Before the PCI refactor, PCI initialization/enumeration occurred
immediately after the PCI module was loaded, and so by the time
we got to IOAPIC initialization, it was already complete.

After the refactor, PCI enumeration is deferred until slightly later,
and so we would try to initialize IO-APICs without knowing PCI
information. This would fail, as read_irq_routing_table needs to
have that available.

Hopefully fixes #18425, #18393, #18398.

Change-Id: I1e4b06367da26eeb10085a1c6322ed39885b632b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6476
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-05-29 19:44:32 +00:00
PulkoMandy
4dbd474753 Add BIconUtils::GetSystemIcon
Allow to easily access the alert icons and anything that's added to app_server
resources.

Fixes #10887.

Convert BAlert, Debugger AlertWithCheckbox and Keymap ModifierKeysWindow
to make use of it, removing the duplicate code to locate app_server
resources.

The resources are initialized only once (per application), so there is no need
to reload them for every access to the icons.

In the ticket there is discussion about putting this in BControlLook,
but I think this should in fact be moved fully into app_server with
special drawing commands for well-known icons. That would avoid loading
and rendering the icon on the application side to then send it to
app_server (especially in remote_app_server case)?

In any case, this simple API can serve as a base for applications to
use, and we can change how it is implemented later on.

Change-Id: Id370526ae5cf165cfb8bc277bc8a7f46c26f542d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6463
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-05-24 10:58:48 +00:00
Augustin Cavalier
605bd3f09d termios.h: Undefine/remove some unimplemented BeOS extensions.
We did not ever implement these, it seems, and so they are just
cluttering up the global namespace.

Change-Id: Ib37c3a31663525a18268c9bfe326bfba9afbc794
2023-05-22 18:20:17 -04:00
Trung Nguyen
b809279cd8 kernel/team: Allow retrieving more attributes
- Stored the additional start time of each team, expressed by
milliseconds since boot.
- Added more fields to the `team_info` structure. These field
include those provided by the `get_extended_team_info` syscall as
well as the newly introduced `start_time`.
- Extended the `_kern_get_team_info` system call to receive an
additional `size_t` argument. If this size is smaller than or
equal to the size of the old `team_info` structure, the newly
added attributes will not be retrieved.

Change-Id: I22ee6b91ad2ee3b66a7f770036c79a718c5f115c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6390
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-17 11:07:14 +00:00
David Karoly
84745ade1b kernel/arm/paging: use simplified permission model
Change-Id: Ie0ed357ee9ca5bee4c10c6cbf74eaba77acdd179
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6435
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
2023-05-16 18:07:45 +00:00
Trung Nguyen
b197dcbafa tty: Implement exclusive mode
Implemented exclusive mode on Haiku and added the related `ioctl`
operations (`TIOCEXCL` and `TIOCNXCL`).

Change-Id: Iaa201ea20eec0e45d02dd5db9ba6aa35fd27dfb2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6387
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-13 00:41:16 +00:00
Trung Nguyen
d97ad7c4dc termios: New ioctl: TIOCOUTQ
Change-Id: I86f2a7b007137e22cf7d6fc8ad6675ff5de267d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6386
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-11 02:57:36 +00:00
Trung Nguyen
568b8f9395 headers/posix: Add TIOCM_RNG as a synonym for TIOCM_RI
dotnet uses it.

Change-Id: Ie5658263a0fd9c0aa833cc468ddcafe08116a30d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6385
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2023-05-11 02:55:38 +00:00
X512
6550124ea0 riscv64: implement memory barriers
Change-Id: Ied9e6dad38968cee6e828dff6ec413e6281086cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6436
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-05-10 20:55:18 +00:00
David Karoly
6c58b765f3 kernel/arm: use inline functions for accessing coproc registers
Change-Id: I626ef5722f4ae043de9e8b0c37dbde97ac0513be
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6422
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-05-09 20:50:42 +00:00
David Karoly
c13766fc00 kernel/arm: check for access flag fault in page fault handler
Change-Id: Icc782a692e5dcd861958ffea934386b4d4e569c7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6428
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-05-09 20:10:12 +00:00
Augustin Cavalier
0c2a5bb5ea Replace the "tty" driver with a "pty" driver.
This new driver uses the "generic" TTY layer, unlike the old driver
which had its own implementation (which the generic module was derived
from, originally.)

The remaining bits of support for controlling TTYs is added to the kernel &
generic layer at the same time, which should allow for serial interfaces
to be controlling terminals now, as well.

Tested with bash, nano, vim; all seems to still be working as expected.
2023-05-09 16:04:09 -04:00
David Karoly
3d2b8a2045 remove unused header arm920t.h
Change-Id: I288e083857b6da30788be3f902dedd07e3e54d9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6426
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-05-09 18:27:46 +00:00
Alexander von Gluck IV
d9642c25bb headers/os: Bump max gcc to 13.x
* riscv64 builds fine
* x86_64 builds and boots fine

Change-Id: I98b72a9d57b1a6ea0fae5c113a4c24b32fd68a52
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6425
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-05-09 13:58:07 +00:00
Trung Nguyen
f967e2c0c7 headers/bsd: Export pthread_attr_get_np
Exported `pthread_attr_get_np` under `_DEFAULT_SOURCE`. Otherwise,
the presence of this function in `libroot.so` without a definition
would confuse some configuration scripts.

Change-Id: I623ebefc98800e9528dc48859c2aefc828821f27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6383
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-05-08 01:38:41 +00:00
David Karoly
19537d01d1 kernel/arm: adjust function names for getting/setting SCTLR
Change-Id: I28d6101c772a5065beec5af20f6d2a0c1855ae6c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6421
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
2023-05-07 17:35:21 +00:00
PulkoMandy
d1aa4a4295 Fix typo
Change-Id: I38b5496f8f1afac24e41f3408b10371e932a47f5
2023-04-29 22:46:03 +02:00
PulkoMandy
0ba60bc743 Move BarberPole from HaikuDepot to libshared
I want to use this in at least 2 third-party applications. I think it's
time to make it shared?

Change-Id: I855a59aab4ad6d47d77cf2901cb3dfc34c108059
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6296
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-29 16:11:43 +00:00
Augustin Cavalier
d8e4f52b78 kernel/condition_variable: Add a ConditionVariable::EntriesCount() routine.
Will be useful in changing the XSI subsystems to use condvars.
2023-04-26 17:08:15 -04:00
Augustin Cavalier
557f0446b3 kernel: Introduce THREAD_BLOCK_TYPE_OTHER_OBJECT.
THREAD_BLOCK_TYPE_OTHER implies the "object" pointer in the
wait information is a string. But sometimes we want to pass
through objects which are not strings, for inspection in KDL.
2023-04-26 15:33:53 -04:00
Augustin Cavalier
f5e531e92e kernel/thread_types: Remove Thread::condition_variable_entry.
Unused, and "struct PrivateConditionVariableEntry" no longer exists, anyway.
2023-04-26 15:32:20 -04:00
Máximo Castañeda
e6a598a2f4 ControlLook: fix clipping
Remove ConstrainClippingRegion calls as they do not take into
account view transformations.
Clip drawing to the drawing rect, not the updated area.

Fixes #12890

Change-Id: Ie76cb83e0af03213008da78407de25261daea5df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4457
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-26 10:41:04 +00:00
Augustin Cavalier
69929490eb locale_t.h: Add missing newline at end of file.
Fixes #18369.
2023-04-25 12:38:37 -04:00
Jérôme Duval
bd7bb43761 PCI_x86: remove
Change-Id: I54335b6390dc5e312225a3100fd88d4e49838d35
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6331
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-04-25 15:54:32 +00:00
X512
a23ac85fa9 bus_managers/pci: split PCI controller to separate add-on
busses/pci/x86: add
Other add-ons are in following commits.

Change-Id: I7a77bfaef0e8995917b4b54c8369d7075533ec26
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6220
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-25 15:54:32 +00:00
X512
97b7c7719d bus_managers/pci: move MSI handling to generic code
Change-Id: I6194838b7b46222f720fc328bb4512fdb88a9c8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6222
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-04-25 15:54:32 +00:00
X512
e942269a1f pci: generic MSI interrupts support
Change-Id: Ib4fd23f6bca867a2b428bf2651234d719ee08672
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6221
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-04-25 15:54:32 +00:00
wszdexdrf
a2755521d5 Rewrite header ISA.h
partially fixes #1576

Change-Id: I245f55ab466222279e74df7f206a609d3b913ed5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6298
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-04-11 16:32:56 +00:00
Augustin Cavalier
d9e8ef7f66 threads.h: Fix value of ONCE_FLAG_INIT.
Fixes #18348.
2023-04-10 11:50:33 -04:00
Augustin Cavalier
3e1163d6af libroot: Disambiguate parameters of ICUCollateData::Strxfrm.
Same thing that was done for wcsxfrm in 218604196a.
2023-04-08 14:17:15 -04:00
Augustin Cavalier
fcd82d3dc3 math.h: Change definition of FP_ILOGB0 to match the specification.
See #18351 for details on the specifications.

This is the same thing NetBSD does. BeOS R5 defined these values
differently than we did even before this commit, and it does not
seem to have caused problems then, so this should be fine.

While technically an ABI break, in practice these values are not
always differentiated on other platforms, and it appears musl's
code triggers divide-by-zero exceptions on purpose before it
returns this value, anyway.

Fixes #18351.
2023-04-08 12:30:15 -04:00
Augustin Cavalier
0f67b2ac2e uchar.h: Add missing include of stdint.h.
Fixes #17040.
2023-04-08 12:30:14 -04:00
Augustin Cavalier
d0b67fcc80 kernel/util: Clean-ups to DoublyLinkedList insertion routines.
* Make some code common in Insert.

 * Remove unneeded logic from InsertAfter and just call the base Insert.
   InsertBefore does this, already.

 * Synchronize Insert code and APIs in the fs_shell DoublyLinkedList.
2023-04-01 12:31:39 -04:00
Augustin Cavalier
3d3b89c8cc kernel/util: Privatize the deprecated DoublyLinkedList::Insert() variant.
Removing it outright would cause implicit conversions and then the other
variant being called, which would create invalid lists. So make it private
so that any attempts to use it will create errors at compile-time.
2023-04-01 11:34:44 -04:00
Augustin Cavalier
ff6e777d28 kernel/util: Clear list links on removal under KDEBUG.
This way, if someone tries to double-remove an item or do other
invalid things to it, this will crash instead of (silently) corrupting.
2023-03-30 12:46:31 -04:00
Augustin Cavalier
15ff8d64b6 BNetworkDevice: Remove GetNextNetwork.
As far as I can tell, it has no consumers whatsoever outside the tree.
(wpa_supplicant did not even use it.) So, remove it altogether.

If that turns out to be mistaken, we can reinstate it temporarily
as a private class function or ABI-only symbol.
2023-03-29 20:15:32 -04:00
Augustin Cavalier
c650846d9e vm: Replace the VMAreas OpenHashTable with an AVLTree.
Since we used a hash table with a fixed size (1024), collisions were
obviously inevitable, meaning that while insertions would always be
fast, lookups and deletions would take linear time to search the
linked-list for the area in question. For recently-created areas,
this would be fast; for less-recently-created areas, it would get
slower and slower and slower.

A particularly pathological case was the "mmap/24-1" test from the
Open POSIX Testsuite, which creates millions of areas until it hits
ENOMEM; it then simply exits, at which point it would run for minutes
and minutes in the kernel team deletion routines; how long I don't know,
as I rebooted before it finished.

This change fixes that problem, among others, at the cost of increased
area creation time, by using an AVL tree instead of a hash. For comparison,
mmap'ing 2 million areas with the "24-1" test before this change took
around 0m2.706s of real time, while afterwards it takes about 0m3.118s,
or around a 15% increase (1.152x).

On the other hand, the total test runtime for 2 million areas went from
around 2m11.050s to 0m4.035s, or around a 97% decrease (0.031x); in other
words, with this new code, it is *32 times faster.*

Area insertion will no longer be O(1), however, so the time increase
may go up with the number of areas present on the system; but if it's
only around 3 seconds to create 2 million areas, or about 1.56 us per area,
vs. 1.35 us before, I don't think that's worth worrying about.

My nonscientific "compile HaikuDepot with 2 cores in VM" benchmark
seems to be within the realm of "noise", anyway, with most results
both before and after this change coming in around 47s real time.

Change-Id: I230e17de4f80304d082152af83db8bd5abe7b831
2023-03-24 10:53:52 -04:00
David Karoly
60b19d7eac kernel/arm: implement signals, fork, restart syscall
Change-Id: I24219b83d90710ef719190183ba6f069f82dae61
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6198
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-03-20 17:28:20 +00:00
X512
6d13693a78 kernel/int: increase max interrupt vector count
Change-Id: Ia16e66a7bdac37019e6256405b9f10024909c69a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6215
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2023-03-20 14:23:54 +00:00
David Karoly
434aab5a4d headers/kernel: remove alpha folder
Change-Id: I057cb53ad68113e9dce2bb13f172d4c3eb1406af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6196
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
2023-03-12 10:36:01 +00:00
David Karoly
0aeb55c8ac arm: remove unused variables from arch_kernel_args
Change-Id: Ice2be644142b646205648f44fb5bce5e9848e69d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6192
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
2023-03-11 21:05:49 +00:00
David Karoly
f964790bcc headers/kernel: remove sh4 folder
Change-Id: I71e52b0f4e81c872b9bc14490bf7c38b261120b0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6194
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
2023-03-11 21:05:20 +00:00
Augustin Cavalier
0ecd7516de Package Kit: Use an object_cache in kernel mode for decompression buffers.
The kernel heap only uses object caches for objects up to size 8192.
Larger allocations have to go through the raw allocator. That can
get pretty expensive.

Adding instrumentation around the malloc/free calls in this function
showed that on my machine, some 596ms during boot were spent on
*malloc/free alone*, all else aside. After this change, we are at
around 110ms, or a >5x improvement. Running an fgrep -R on /system/
after boot increased the cumulative time in memory functions to over
5 seconds, while after this change it is "only" 1170ms.

Honestly, it seems like the object depots should be able to be faster
than that, even if this function is called thousands of times. But that
is a problem for a different investigation.

It would be even faster for every consumer of this data in
packagefs just allocated one set of buffers up front, or at least
for a single "read session", but plumbing that all the way
through the myriad abstractions of the Package Kit will
not be easy, and is left for another time, as well.
2023-02-28 13:49:00 -05:00
Augustin Cavalier
79bc16ba6e Rewrite <netdb.h> and drop a lot of non-standard stuff.
While the BSDs and glibc seem to have various _r functions,
they all return int for errors instead of a pointer, making ours
exactly backwards of theirs for error reporting and thus useless.
So, remove them from the header entirely. They are left in
for ABI backwards compatibility for the time being.

A few constants not used by anything in the tree (i.e. not actually
implemented by libnetwork/netresolv) were also dropped. Some deprecated
or non-standard functions were placed behind _DEFAULT_SOURCE or deleted
entirely.

The header itself is now organized approximately as the BSDs do,
although with various Haiku-isms instead of BSD-isms where appropriate.
2023-02-27 22:51:17 -05:00
Augustin Cavalier
6d36f6bfad netdb: Drop definitions for getipnodeby...
We do not actually export them, or even have source for them in-tree.
2023-02-27 21:11:49 -05:00
Augustin Cavalier
36e200e2e0 sys/uio: Add preadv/pwritev.
Fixes #18243.

Change-Id: Ib5867f86100430f5e5c43ce4b2d6d561f546cc1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6068
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-02-24 16:31:51 +00:00
PulkoMandy
5f88744263 BMenuField: allow to use non-fixed size in combination with layout mode
In fixed size mode, the menu field always uses all the available width.
In non-fixed size mode, the menu field will resize itself to be as small
as possible.

With layout, usually the difference isn't noticeable, since the layout
will already try to resize the control to the smallest possible size.
But there are a few cases where it makes a difference, when the layout
is over-constrained and the menu field can't be made as small as
possible. In that case, the menu field would be forced to fill its
allocated space, where we can instead make it a little smaller.

Change-Id: I911d497218a09aab3824865968558df5d4b3cf98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6076
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-02-21 10:47:46 +00:00
PulkoMandy
fc2f1a3247 BMenuField: remove deprecated constructors
These were introduced by mistake during the addition of the layout
system. They have been private since 2011. It seems safe to assume that
nothing uses them anymore and they can now be removed safely.

Change-Id: I98d030096f9cb06fccc25233fe4da17d0213050e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6075
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-02-18 17:20:27 +00:00
vaibhavg20comp
ba9ce9c13b termios: Added cfsetspeed function.
BSD extension to set both the input and output speed of a termios
structure.

Fixes #18220.

Change-Id: I8c4a06b4be4aa55b8ce35cb7f62552fc47a8e8d0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6049
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-02-17 16:16:39 +00:00
Augustin Cavalier
5e9fd9f60d libroot_build & fs_shell: Provide _kern_ functions for readv/writev...
..instead of readv_pos/writev_pos. This way, we can be sure that we
are remapping them properly even under Haiku, as well as remove some
potential confusions.

bfs_shell seems to still work fine on a regular build.
2023-02-14 00:49:52 -05:00
Augustin Cavalier
478c8c847d Drivers.h: Rename device_{read|write}_pages back to device_{read|write}v_hook.
They are not about reading and writing pages, but just iovecs.
As the passed iovecs use void*s, it can't possibly be working with
physical pages on 32-bit systems with PAE.

It appears nothing uses or implements these functions anyway,
as there was nothing else in the tree I had to adjust after making
this change...
2023-02-13 23:05:16 -05:00
David Karoly
125b262675 libroot: introduce crypt_r
Change-Id: Ieacd1b383ac078a440227c7954f5531a36fbbd62
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5827
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-02-10 18:00:44 +00:00
Dale Cieslak
4f52a155e6 BFont: Minor code cleanup and autolocking for AppFontManager
* changed explicit locking to use Autolocker for gFontManager/fAppFontManager
in ServerApp, per comments in https://review.haiku-os.org/c/haiku/+/4790
* changed BFont::LoadFont (memory version) to use size_t for size and offset
* no functional changes

Change-Id: I438a4975d5bb1b2fa17bc54e9e171c31dadfeec5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6003
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-02-06 09:21:12 +00:00
Augustin Cavalier
5d41cee816 WeakReferenceable: Clear fUseCount when it is 1.
Otherwise, if there are remaining weak references, they could
potentially try to acquire the object and trigger a use-after-free.
2023-01-31 22:36:59 -05:00
Augustin Cavalier
d891ca1119 headers/build: Drop Drivers.h and Select.h.
As far as I can tell, these are no longer needed after the previous commit;
fs_shell does not reference them, anyway.
2023-01-31 17:15:14 -05:00
Augustin Cavalier
1e860e07ee BPrivate::WeakReferenceable: Move implementation to a .cpp.
No functional change to the implementation, just getting it
out of a header.
2023-01-31 15:36:15 -05:00
PulkoMandy
49efa33dd0 ps2 synaptics: implement 'extended W' mode.
"Newer" synaptics touchpad support a new mode where they can report more
information to the host. In this mode, there is a different packet
format for tracking extra data from the touchpad, including a wheel
encoder (mousewheel) if available, and multitouch finger tracking.

This mode is documented in the Synaptics touchpad interfacing guide
(Synaptics document 511-000275-01 Rev. B), but was not yet implemented
in our driver.

It should help with detecting multiple fingers, or finger position on
clickpads to determine right or left click.

This change implements the following items from the Synaptics
interfacing guide:

- Cleanup and clarify the code for features detection to properly report
  clickpads
- Enable "extended W" mode if supported
- Process extended W values 0 (mouse wheels, reported in the
  touchpad_event structure and could be used by input_server for
  scrolling), 1 (secondary finger), and 2 (finger count)
- Fix handling of wValue, which is not always a finger width
- Add handling of vValuen which indicates the finger width when wValue
  doesn't

Overall, this should provide the movement_maker with a better picture of
what's happening.

Also improve tracing to show received packets and the corresponding
WValue since that's an important value in identifying which type of
packet it is.

Unfortunately I currently don't have a laptop with synaptics touchpad to
test this with.

Change-Id: If334392f4eb2a146955f6c8c897f0ab64d79b8d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4425
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: nephele <nep@packageloss.eu>
2023-01-28 14:57:53 +00:00
Augustin Cavalier
35b40030a7 file_systems/fs_ops_support: Add open_mode_to_access.
This is duplicated across multiple filesystems, and could probably be
used in more still.

Adjusted only BFS, EXT2, and NTFS in this commit, as they are the ones
which make use of fs_ops_support.h already and thus need to be modified
to avoid duplicate-definition errors.

Also tweak next_dirent to support being built under fs_shell.
(Possibly we should define ASSERT there, though?)
2023-01-27 23:53:53 -05:00
Augustin Cavalier
dc95ec5777 file_systems/fs_ops_support: Add comment for next_dirent and mark "inline."
This way, anything which includes the file will not trigger a warning
if it does not use the function.
2023-01-27 23:48:00 -05:00
Pascal Abresch
322be3bee0 StatusView: compute font size based on scrollbar size
Compute a font size that just fits the available space, instead of using
an arbitrary scaling. This makes the code adjust to any font and any UI
size.

Select the appropriate font using a binary search, which will need only
a few attempts (I think 6 font sizes will be tried at the default
config)

Change-Id: Ie3b8678678c0d940981f1785418aa8ab354d01c5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3893
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-01-15 08:45:06 +00:00
Jérôme Duval
37223744b7 kernel/x86: add a hybrid type per cpu, to be dumped when the feature exists.
for AlderLake CPUs

Change-Id: I4beba04e3ac95d7564684ee86de99c894b57a15c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5988
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-01-10 20:40:11 +00:00
X512
f6c51a5dc4 BBitmap: add ability to specify client-defined area
Change-Id: Iae1550b3088b0f6c26b0b91d9acb7f7cbcc721d3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4369
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>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-01-02 18:07:53 +00:00
Oscar Lesta
59b54f3810 poke: use phys_addr_t for mem_map_args's physical_address field
This is needed to fix usage of POKE_GET_PHYSICAL_ADDRESS on
x86 32 bits (with PAE).

Change-Id: Ic00185ec7fcf9b6666ad6169a752d8b8edd2b61b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5975
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-01-02 15:02:32 +00:00
Semion Dimov
d53856a1b6 Added missing posixoptions and sysconf constants according POSIX.1-2017 standard
Change-Id: I2721ea4f2c3dbe0ef6a11c3a61da6034b4a7fd48
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4371
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-12-23 01:57:05 +00:00
Jérôme Duval
2c08dd5bc5 bus/USB.h: header for usb device items
Change-Id: Ic36733af169948f54d7d938dfab1cb5aeb34ab9a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5956
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-12-22 17:43:32 +00:00
Jessica Hamilton
a764093ca8 shared: add ColorItem from Gravity screensaver.
* A useful utility class that will also be used by Terminal later

Change-Id: I23020a401fbab7d4116df31f965ae61ecaf2a6cd
2022-12-22 11:07:28 +13:00
Dale Cieslak
85b82f8524 BFont: allow loading of user fonts from disk or memory
This patch adds an API call to BFont, called LoadFont, that
takes a string path to a font file. The user fonts are managed
via a new class called AppFontManager that inherits from the base
class FontManagerBase but adds the methods to add and remove user
fonts from disk or memory. There is also a new method called UnloadFont
to remove a user font, but on exit of an app all user fonts should be
automatically cleaned up.

Global/system fonts are managed by the GlobalFontManager, which is
a new class that also inherits from the base class FontManagerBase,
replacing the old "FontManager" class.

A maximum of 128 user fonts may be loaded, and memory fonts
may not exceed 20MB.

There's also an overloaded version of LoadFont that accepts
an area_id and loads the font from memory. A size and offset may
optionally be provided to allow for an area that contains more
than just a font.

Change-Id: I6add42bdf0c0cefc0e2e2a4984fd848c3e7269e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4790
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-12-17 12:32:09 +00:00
Jérôme Duval
76ddb69a3a usb_raw: abort transfers cleanly on kill, fix use-after-free
* aborted transfers will release the notify semaphore when the cancel is notified.
* the allocated buffer would be freed on return, while the usb stack eventually copied
data in the buffer in our back, leading to KDL crashes, because the freed buffer would
be right reallocated for some kernel team structures.
* regression introduced by hrev55806, the transfers didn't need to be cancelled before.

Change-Id: Ifb6e941f71d05c37c36f878059c33883bb72a67c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5905
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-12-14 04:53:09 +00:00
X512
215b685f7f kernel: Drop non-standard GNU inline assignment syntax
* We needed this previously due to our gcc2 compiled kernel.
* Now that our kernel is always latest gcc, we can move to the
  c++20 syntax for inline assignment.
* Improves compatibility with clang, less GNU-specific stuff

Change-Id: Ib7272a0a52554a31e9a0e788fd3f031db9049795
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5898
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-12-13 20:49:53 +00:00
X512
fa557843f2 riscv: use atomic CSR bit set/clear operations, refactor
Fix race conditions that cause broken timer interrupts.

Change-Id: I78e13a18d394b1566977e894a1def16a66c9ca5f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5883
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-12-11 18:43:15 +00:00
Jérôme Duval
fb69e06195 kernel: load cpu amd microcode update if loaded by the bootloader
we detect basically the cpu info before loading the microcode,
to be able to detect the vendor, and avoid any update on hypervisor.

I couldn't test because my cpu doesn't have any update available.

Change-Id: I6aea830158423b3ee13b640be8a788fc9041e23c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5859
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-11-30 08:50:59 +00:00
Jérôme Duval
652d5f6347 ccp: driver for the RNG part of CCP on AMD
the entropy source is read every second and pushed to the PRNG.
the PCI device is tested, not the ACPI.

Change-Id: I9bb6b21c7189b28a1d8a624d83b33ff6682152dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5825
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-11-28 13:33:01 +00:00
Jérôme Duval
3a42882e0f intel_extreme: check another register when finding out hw_cdclk on Haswell/Broadwell
doesn't help with #18084

Change-Id: I6f3cc8b50fc5742fab3021f01b90dfebe484b336
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5830
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-11-26 12:56:08 +00:00
Jérôme Duval
739d4da07b amd_pstates: introduce a AMD P-states driver for Ryzen with the CPPC feature
tested on Zen2 (Ryzen 3 5300U)
This support was submitted in October for inclusion in Linux.
Haiku supports only two profiles. We could probably add some more, and let the driver says which it supports.

Change-Id: Id7754b445bc32a691d58a1e4af630351562abc22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5826
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-11-24 06:26:13 +00:00
Jérôme Duval
34e9243872 random: always use the PRNG, and use entropy sources to feed it
remove the yarrow module. the hardware modules can push entropy with queue_randomness().
virtio_rng will now push entropy every 300 seconds.
helps with #14937

Change-Id: If76c5deabf61dc616a0e051332f44b89deb6b8a1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5824
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-11-21 18:28:41 +00:00
Máximo Castañeda
241f109ccb View: provide the transform between different coordinate spaces
There's currently no way for an application to convert between view and
drawing coordinates with a drawing states stack without keeping track of
all the transformations itself, which is not very convenient for helper
or library functions.

Handle other spaces too, for good measure.

Change-Id: Ic8404a1c111e273fff1eebf2f9f59f58246b796c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5775
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-11-13 04:04:30 +00:00
Rudolf Cornelissen
ea959da4df intel gfx: fixed SMAP faults, added 2 G98 IDs to kerneldriver. 2022-11-12 20:16:10 +01:00
PulkoMandy
32a71a00aa stdint.h: fix definition of UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C
C99 chapter 7.18.2, Limits of specified-width integer types:

"This expression shall have the same type as would an expression that is
an object of the corresponding type according to the integer promotions."

C99 chapter 6.3.1.1:

"If an int can represent all values of the original type, the value is
converted to an int; otherwise, it is converted to an unsigned int.
These are called the integer promotions."

Therefore, UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C should be signed.

This prevents building WebKit with -Werror.

Change-Id: Ib2a2c15acc2c761cccf8caa016c7ff163e3fdc0d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5806
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-11-08 16:11:40 +00:00
Jérôme Duval
cedd85556c kernel/x86: init the tsc frequency and clock speed from MSR when available
only for AMD newer CPUs. tested on R5300U

Change-Id: I44be2efca37b1738a759a15140e5fd8d3b5ac7b0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5804
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-11-07 09:03:52 +00:00
Jérôme Duval
af136a21bd graphics/edid: add support for the CTA extension block
Change-Id: I2799496faf2f9383c703384a419d8d9fcffc75ab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5803
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-11-07 09:02:42 +00:00
Augustin Cavalier
9fc6234686 Versioning: Add BETA_4 and PRE_BETA_5 version constants.
PRE_BETA_5 is now the default in master.
2022-11-03 20:30:10 -04:00
X512
ede527512e bfs_shell: fix gcc2 build
Fix regression that building Haiku on 32 bit Haiku become not possible.

Change-Id: I527a8c3bc3ad4744d5515a76888d5cac06293cbe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5750
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-11-02 16:21:43 +00:00
Jérôme Duval
c95c18768b POSIX: wchar.h and wctype.h don't need the locale.h but locale_t.h
* missed in hrev56270.
* mentioned on IRC: <dwa> please ask them if wchar.h isn't meant to include locale_t.h instead of locale.h

Change-Id: Ia9b7553480430c2fefb4a3659ad525322152582b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5797
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-11-02 14:09:08 +00:00
Niels Sascha Reedijk
1111dda699 NetServices: Add libnetservices2.a from dev/netservices into master
The overall design does not deviate much from my proof of concept [2] and that still makes a good read to
understanding the overall architecture. If you want to get a sense of how it is built up, the API comes with
full doxygen documentation for the public API [3], and I have also done a PoC change for HaikuDepot which is
useful as an illustration on what the impact for the user of the new library is. [4] There is also a test suite
that may give some insight into the day to day ergonomics of the API [5].

The current state is that I am fairly confident that many HTTP requests will actually work, but I do expect
rough edges with a protocol with this many diverse implementations. There is also a list of features yet to be
implemented on Trac [6]. Additionally, I still want/need to do performance testing.

The goal of merging the kit right now is to start making it available for more uses, and through that also give
a chance to shape its future. There are also some design decisions that need review, most notably I expect some
discussion around the uses of C++ 17 idioms (like std::optional and std::string_view) and around the use of
exceptions for error handling.

The impact of merging right now should be near zero: the netservices2 kit lives in its own header space, and
builds into its own static library (libnetservices2.a). It is not yet used in any of the apps in our
repository.

The branch does remove the deprecated services kit from the libnetapi.so library, though it leaves
libnetservices.a intact. After our previous announcement to remove it after beta 3, this should be expected.

[2] https://github.com/nielx/haiku-netservices-rfc/tree/exceptions
[3] https://git.haiku-os.org/haiku/tree/docs/user/netservices?h=dev/netservices
[4] https://review.haiku-os.org/c/haiku/+/5692
[5] https://git.haiku-os.org/haiku/tree/src/tests/kits/net/netservices2?h=dev/netservices
[6] https://dev.haiku-os.org/wiki/Development/NetServices2

Change-Id: I5d0b7e2619699f39a2506588417b57391f0f5cc2
2022-11-02 01:37:17 +00:00
Augustin Cavalier
8672fc2739 InterfaceDefs: Adjust and introduce new spacing/insets constants.
* Nothing in the tree and few things outside it used BIG_{SPACING|INSETS};
   it seems a value of 15px (at default font size) is not that useful.
   There are, however, a lot of things around the tree that use multiples
   of 20px. So, make BIG be that, with the intent to replace those
   with BIG directly.

 * Introduce CORNER_{SPACING|INSETS}. There are a lot of applications
   (e.g. Tracker, Terminal, Debugger etc.) which use scroll bar width/height
   to metrically align controls with the window frame or with some other
   control which contains scroll bars. Rather than have to invoke
   BScrollBar or BControlLook directly to get the value, we should just
   derive the size of scrollbars from a spacing constant instead
   and get rid of the custom function. (For now it is just replaced.)
   This reuses the old values for BIG, as it is equal to 14px at default.

 * Introduce BORDER_{SPACING|INSETS}. This is equal to the typical border
   size of 1px at default font size (or lower) and uses floor() instead of
   ciel() to compute what the size should be (i.e. it will remain 1px
   at 150%/18pt and only go up at 200%/24pt.) This will allow a lot of
   the hardcoded border sizes around the tree and elsewhere to use
   ComposeSpacing() instead.

Change-Id: Iaea3fa30364859888e816a9d61ac156268d70758
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5702
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: nephele <nep@packageloss.eu>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-11-02 02:23:32 +00:00
X512
b71020b095 util/DoublyLinkedList: make GetPrevious/GetNext methods static
This methods do not need DoublyLinkedList class state.

sGetLink field that actually implement GetPrevious/GetNext methods is already static.

Change-Id: Ie0b40f7f1b72d640d75403905b8944666874dc87
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5796
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-11-02 02:12:41 +00:00
Niels Sascha Reedijk
2710b4f5d4 Merge remote-tracking branch 'origin/master' into dev/netservices
Change-Id: I48c8cf4f03e281a5caeb9f27bf052285961529ff
2022-10-29 22:58:24 +01:00
Niels Sascha Reedijk
71e29bbeea NetServices: format code using haiku-format
This commit formats all the netservices2 code with the `haiku-format` tool from
https://github.com/owenca/haiku-format (commit aa7408e), with the following
customizations:
 * SpaceBeforeRangeBasedForLoopColon is set to false
 * Braces before a catch block are not wrapped
 * Most headers, except for ExclusiveBorrow.h, have been manually reformatted
   to adhere to Haiku's header format (issue #19 in the repository)

Change-Id: I693c4515cf26402e48f35d1213ab6d5fcf14bd1e
2022-10-29 22:53:57 +01:00
Augustin Cavalier
b2c77ad27a Network: Add a BNetworkDevice::GetNetworks() method and use it in the GUI.
The GetNextNetwork() method is really inefficient: it fetches all the
networks at once from the kernel every single time and then winds
up returning only one of them. In parts of the GUI that iterate over
all networks more than once per refresh (sometimes within a loop, even!)
this was often a noticeable lag on the GUI, especially with OpenBSD
drivers which have extra overhead to do struct translation in the
ioctl handler.

Now, we have a way to fetch all scan results at once and just iterate
over them as many times as we need, and this is what NetworkStatus
and Network preferences now do, saving lots of time and effort.
2022-10-25 23:34:42 -04:00
Augustin Cavalier
65c155bede BNetworkAddress: Make the first SetToLinkLevel() take a const pointer.
Technically breaks ABI. However to the best of my knowledge,
nothing uses this method outside of the tree.
2022-10-25 23:34:42 -04:00
Alexander von Gluck IV
967cfb4d56 radeon_hd/atombios: Sync up to latest published atombios
Change-Id: Ic0b80da7fb88fabcc1a7e87fb055351a06aa4e68
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5528
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-10-25 22:45:46 +00:00
Han Pengfei
44cceee67e pthread: add pthread_{getname_np,setname_npp}
- These two functions imported for Linux/BSD compability.

Signed-off-by: Han Pengfei <pengphei@qq.com>
Change-Id: I3e9cada26f1ed043bfaed83e8185dcfff3bd71e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5746
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-10-18 16:30:54 +00:00
Jérôme Duval
8e17b43da6 kernel/device_manager: Implement B_GET_DRIVER_FOR_DEVICE
for legacy and new drivers.

This is an opcode for ioctl that can be used on almost any device entry found in /dev.
When used, ioctl will fill a buffer with the absolute path to the driver file that is
being used by the device.

This opcode was available in BeOS R5, though remained unimplemented in Haiku since
the introduction of the Device Manager almost two decades ago.

Original change by Jacob Secunda.

Change-Id: Ic49141b677b4158a63918459d4048450c825447c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5078
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-10-17 06:13:07 +00:00
Axel Dörfler
97739603d1 kernel: Added operator delete(ptr, nothrow_t)
* This seems to be required when building the DriveEncryption kernel
  driver with gcc 11.2 on x86-64, at least.

Change-Id: Ie1ae09435dd912021957e64d4b9a3e7b05913c33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5742
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-10-12 20:35:55 +00:00
Jérôme Duval
edeaa9c0c7 listusb: generate class code table from usb.ids, and use it
Change-Id: I43b79c5abc74306aba9a69991aeb5e110b2d790b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5737
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-10-10 21:28:37 +00:00
Jérôme Duval
e065d697fb Disk Device Manager: checks the raw content_name when editing a partition
also only provide a default name for partition containing a file system
fix #17958

Change-Id: Ib5a8928dc5272a400a99aa05b792201f3a6a2c7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5705
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-09-30 17:10:39 +00:00
Augustin Cavalier
78ee50a272 InterfaceDefs: Specify INSETS constants in terms of SPACING constants.
They already used the same numeric values. Also reorder for consistency.
No functional change.
2022-09-28 19:47:38 -04:00
Augustin Cavalier
e285b3071d Introduce a utility function for moving to the next dirent in read_dir.
This takes care of making sure the dirent buffer is properly aligned,
which it needs to be on some platforms (SPARC, ARM, etc.)

Change-Id: I9a6352b1e654c090a200770d51f96511ee024a99
2022-09-28 16:30:00 -04:00
Jérôme Duval
fbca1c4088 kernel/x86_64: configure LFENCE as a serializing instruction on AMD
Change-Id: I152bf41c3479f81fc458abdf8d89874ffa3a08d7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5691
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-09-25 08:15:15 +00:00
Niels Sascha Reedijk
a0b75afc0f NetServices: add missing include 2022-09-24 09:49:51 +01:00
David Karoly
cec78ae332 kernel/arm64: introduce virtual_ranges_to_keep
Change-Id: I6de950cb18892ebf2dd2aefa34b65b90a17e3f2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5682
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: David Karoly <karolyd577@gmail.com>
2022-09-23 13:57:43 +00:00
David Karoly
a0c8f15f33 kernel/arm64: implement iframe stack and unwinding
Change-Id: I1587c1f57bd73777a188bb8f1bc58263de82fcb9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5684
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: David Karoly <karolyd577@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-23 13:56:16 +00:00
Jérôme Duval
688acf41a3 add physical_block_size field where applicable
only scsi_disk checks the actual value, other drivers take the logical block size.

This change reports the physical block size from the disk rather than the block
size used by IDE/SATA/SCSI commands. On typical modern SATA disks, the SATA
commands will use 512 byte blocks, but the disk will actually read and write
4K blocks internally. This is only of importance for partition alignment for DriveSetup,
and is independant of file systems or partitioning systems. This could also influence
the recommended block size for some file systems.

Change-Id: Id0f2e22659e89fcef64c1f8d04f81cd68995e01f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5667
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-09-23 06:56:01 +00:00
Jérôme Duval
146d687026 cpu_type.h: remove vendor string at any place
fix bug #17951

Change-Id: Icc0ac964ff9c6322612dadb459d28a97ac69e91a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5686
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-09-21 19:02:08 +00:00
PulkoMandy
e3d5904751 Disk Device Manager: generate a name for nameless volumes
This will give the same result as fs_stat_dev, so the filesystems will
have the same name everywhere.

Change-Id: Ic684142efaeb2c16b393f3f3e5c9c3010a054b30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5636
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-09-21 16:14:32 +00:00
X512
74a5cb7bbc shared: move ScopeExit from riscv64 arch kernel code
this file is c++11 only.

Change-Id: Ibff7acec00337a9f56f9b8e29ea262c8d64c2446
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5292
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-09-21 16:09:33 +00:00
Jérôme Duval
799ab823bb libroot: Add support for C11 Threads missing parts (except gcc2).
The respective files can be found in the FreeBSD source tree at:
- lib/libstdthreads/call_once.c
- lib/libstdthreads/cnd.c
- lib/libstdthreads/mtx.c
- lib/libstdthreads/threads.h
- lib/libstdthreads/tss.c

Missing is support for PTHREAD_DESTRUCTOR_ITERATIONS.

Change-Id: I7a6c79954f36195eadd1351d308c21a001192232
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5675
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-19 19:45:45 +00:00
David Karoly
ef89435316 boot/x86: unify KERNEL_LOAD_ADDRESS for BIOS and EFI
Change-Id: Ia3157c7c0908698da94c1aa85cb6366fb00fb7f1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5670
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-09-19 14:51:58 +00:00
David Karoly
303283fb7a kernel/arm64: implement stack trace
Change-Id: If5627fb4d37bdb7260d7e14c0c3e8cf7bcbee53d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5672
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: David Karoly <karolyd577@gmail.com>
2022-09-19 14:51:18 +00:00
Niels Sascha Reedijk
da8162be21 Merge branch 'master' into dev/netservices
Change-Id: Ic4c065b9a76fcabd6450dd1ab5882510f922a128
2022-09-18 16:16:37 +01:00
David Karoly
f9be2680d9 x86: use elif defined(__x86_64__) in arch_kernel.h
Change-Id: Ibad5f34d73d48c5d1af870131f20ae9b52d88eb8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5664
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-09-15 04:33:47 +00:00
PulkoMandy
49a00a128a userlandfs: implement get_fs_info using ioctl
This avoids introducing an entirely custom hook in FUSE.
It uses the ioctl hook in an unconventional way (calling it with no
valid fuse_file_info) but this can be fixed if a filesystem requires it
(by opening a file handle on /, doing the ioctl, then closing again).

An updated version of fusesmb-haiku is available and confirmed working:
https://github.com/haikuarchives/fusesmb-haiku

Change-Id: If1268113874363fa035e5340be75e9f5198216d6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5199
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-13 18:51:12 +00:00
PulkoMandy
d469ab6d6c libroot: Remove unused files
Not referenced in any Jamfile, does not compile, untouched since
2003 except for a few coding style and cppcheck fixes. The functionality
is implemented elsewhere in the disk device manager and userland
filesystem add-ons for DriveSetup.

Change-Id: I5ebe125931c8d4410c2d335f9d6c0e32008f038b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5637
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-09-13 18:43:55 +00:00
Michael Brumbelow
950809231f Removed 'register' storage class compiler warnings
Change-Id: Iba89a9d0845bf7e816983f903281d33e273f6e35
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5558
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-12 14:03:28 +00:00
Augustin Cavalier
66af664352 Drop the unused TTY bus_manager.
Just stubs and not actually used.
We have a TTY module (and driver) which supplant it.
2022-09-09 17:14:12 -04:00
Alexander von Gluck IV
b6b61bd39f general/logs: Ensure all logs start with THING:
* 90% of our logs start with some context on what is
  generating a log message (thing:)
* Things following this logging model however do "thing [time"
  which is inconsistent
* Being consistent will allow us to start scanning logs in a
  smart way and try to analyze patterns of what is throwing
  errors, etc in an automatic way.
  aka /^(service/driver/etc)\:/

Change-Id: I1ef2df4f17f70f858a485554a4e8a3f87f1a69c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5568
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Oscar Lesta <oscar.lesta@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-09-08 17:59:21 +00:00
David Karoly
3bfbf2fb53 kernel/arm: check for PXN and alignment fault in page fault handler
Change-Id: I2a863b57b1252343c9c029d1bb5af8d328558576
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5620
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-09-05 17:29:49 +00:00
David Karoly
17569c02ff kernel/arm: clean up arch-specific defines
* align fault syndrome and fault address register naming with
  ARM Architecture Reference Manual (i.e. IFSR, DFSR, IFAR, DFAR)
* move PSR bitfield defines to arch_cpu_defs.h

Change-Id: I813045eec335ffbdd75270ad5a1afb2f222f73c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5618
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-04 19:11:05 +00:00
David Karoly
67406e5145 kernel/arm: save FPU registers on context switch
Change-Id: Icb62688338d3a3083f8f6d1874cae3218ba042e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5614
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-09-04 17:33:49 +00:00
Niels Sascha Reedijk
97f11716bf Merge remote-tracking branch 'origin/master' into dev/netservices
Change-Id: I588c4a840523995f820161d63741c137bc5c719c
2022-09-04 07:30:59 +01:00
Niels Sascha Reedijk
27196c4068 NetServices: use BBorrow<BDataIO> for custom body targets
Change-Id: Ib2d4b0ca3689338d906f943295278c086c6f2c83
2022-09-04 07:27:08 +01:00
Niels Sascha Reedijk
1e22817dfb NetServices: add the BExclusiveBorrow<T> smart pointer
This smart pointer is designed to help with putting some explicitness and
safety around the case where someone will use their own object that implements
the BDataIO interface to store the body of a network request. By default,
BDataIO objects do not require or enforce thread safety. Since accessing these
unsynchronized objects between two threads is undefined behavior, it should be
explicitly discouraged.

The BExclusiveBorrow/BBorrow smart pointer helper helps solve that by enforcing
the limitations on using an unsynchronized object in two threads. When used
correctly, there is a runtime check on incorrect use by the developer. This
should help write better code.

The design is based on shared_ptr, including having an admin block akin the
control block, that manages the internal object. This type-erased admin block
has the advantage that it allows the owner to have a different type than the
borrower. It also handles cases where the lifetime of the borrower is longer
than the owner: the borrower can continue to use the object until they want to
return it, after which it will be cleaned up. This will make it possible to do
some fire and forget pattern in the network services kit, where someone may
just wants to create a file and borrow it to the network request, and care
about further processing the file in the future.

Change-Id: Ie9b7e7472c868b60f663b4db4fa449d421e447eb
2022-09-04 06:54:37 +01:00
David Karoly
3d79cd3332 kernel/arm: set PXN for user memory
* set PXN for all page tables below KERNEL_BASE
* also set PXN for physical page mapper

PXN, Privileged execute-never

When the PXN bit is 1, a Permission fault is generated if the processor
is executing at PL1 and attempts to execute an instruction fetched from
the corresponding memory region.

Change-Id: I3056cbed151004ac9edfbc81ebeada328aeb603c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5607
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-09-02 16:24:08 +00:00
David Karoly
c0a7601219 kernel/arm: store current thread pointer in TPIDRPRW register
Use the Privileged Only Thread ID Register aka TPIDRPRW to store
the current thread pointer.

The Privileged Only Thread ID Register is only accessible
in privileged modes, and is read/write.

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

Change-Id: I5273bee8a80b78cdc547b2f6c96632d120eb3d55
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5608
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-09-02 16:23:53 +00:00
Augustin Cavalier
1f0c87711b shared/IconView: Add a variant of SetIcon which directly accepts a BBitmap. 2022-08-31 16:16:43 -04:00
Augustin Cavalier
90d62fd900 TLS.h: Drop inline assembly from the header.
This was a holdover from BeOS, which did this as inline assembly.
We do not on any platform other than 32-bit x86, and even there
we may have preferred to do things a little differently on non-BeOS
ABIs.

Most things ported from other systems, or even native apps, are going to
use _Thread_local variables anyway, which will bypass this system
altogether.
2022-08-30 00:00:04 -04:00
Augustin Cavalier
da9dee377d HaikuControlLook: Scale the width of the popup dropdown region.
Instead of hardcoding it.
TODO: Other ControlLooks in the tree should also be fixed for this.
2022-08-26 14:42:17 -04:00
Augustin Cavalier
3efde1bfba Tracker: Use BControlLook::ComposeIconSize.
One computation was functionally equivalent to the new method,
other places were not scaling icons at all.

Fixes #13177.
2022-08-25 16:48:56 -04:00
Augustin Cavalier
874a2a7287 BControlLook: Introduce ComposeIconSize().
This takes an int32 (e.g. B_MINI_ICON or another constant) and
then returns a BSize scaled appropriately, the same as ComposeSpacing()
does already for the *_SPACING constants.

This will be used to replace icon size computations throughout the tree.
2022-08-25 16:45:48 -04:00
David Karoly
c34046ba70 arm: increase number of io vectors to 1024
GICv2 can use interrupt numbers up to 1019:
* 0-15 are SGIs aka ICIs
* 16-31 are PPIs
* 32-1019 are SPIs

Change-Id: I1c19be77105683da3f6988a5607b14dc10a899db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5565
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-08-25 00:46:31 +00:00
David Karoly
226dd60a57 arm64: initialize PCI interrupts from FDT
see:
https://www.devicetree.org/open-firmware/practice/imap/imap0_9d.pdf

Change-Id: I4158b022fd4404e3126f92ee844743e39a9b6646
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5560
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
2022-08-24 09:41:35 +00:00
Augustin Cavalier
a028a54e52 libroot: Replace strftime/strptime/wcsftime implementations with musl's.
Now that we have locale_t, we can use the musl versions of these functions.
This also fixes a licensing issue: the strptime implementation had an
advertising clause (although in upstream *BSD it was removed, so we
likely could have managed to remove it anyway.)
2022-08-18 15:31:38 -04:00
Jérôme Duval
013719cfc6 kernel: get_iovecs_from_user(): checks total iovec length against SSIZE_MAX
* the return type for recvmsg(), sendmsg(), readv(), writev() is ssize_t.
* check required by POSIX.
* fix memory leaks on failure introduced in 00f1e7c5e4

Change-Id: Ibf74ae2035b7e9c7a3db3613f60e06672ded4db0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5542
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-08-17 19:44:30 +00:00
milek7
6bef283b50 arm64: Discover PCI from ACPI.
Change-Id: I2e40c8a531f319cce25363ab83d4d0fe9f8702d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5274
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-08-17 19:23:51 +00:00
Niels Sascha Reedijk
8a16ecbce9 NetServices: Add debugging constants and messages
These allow for additional messages about the progress/status of the request.
For now, the messages are sent unconditionally, though it may be reasonable to
in the future switch to sending them only when enabled.

Change-Id: Ic45a0055037af02c689494fa5ce0acd03592ad7e
2022-08-14 14:53:48 +01:00
David Karoly
079db739a6 virtio-mmio: discover devices from ACPI
https://www.kernel.org/doc/Documentation/arm64/arm-acpi.txt
https://wiki.linaro.org/LEG/ServerArchitecture/ACPI/LinaroRegistry

Change-Id: I330a497173c0a82b789a43720e3d86e1513a661b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5506
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2022-08-13 09:43:41 +00:00
David Karoly
fe2b6d7706 arm: detect SoC timer from FDT for OMAP3 and PXA
Change-Id: Ib03a11f016cb937d748d2696a17158e17c86e317
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5522
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
2022-08-09 18:15:55 +00:00
John Scipione
3ef6915cf3 IK: Propagate B_WORKSPACE_ACTIVATED to child views
... and B_WORKSPACES_CHANGED too.

hrev50148 propagated B_SCREEN_CHANGED messages to
children allowing them to respond to screen changes
fixing #8035 back in 2016.

This does the same thing for workspace messages only
I spelled propagate correctly this time.

Add private _PropagateMessageToChildViews() convinience
method to BWindow to do this work.

Call PostMessage() instead of calling MessageReceived()
directly which can work better in certain circumstances.

Change-Id: I5978c3fe674bbe75d9eafb7afb654a49ee3e0c11
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5516
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-08-08 15:32:47 +00:00
Niels Sascha Reedijk
7b1d966cf2 NetServices: Rework parsing of content-length and move to HttpParser
This fixes a bug in the HttpAuthTest, and in general, moves responsibility of determining
the shape and size of the content to the right place.

Still to do is to fix the case where there really is a variable length content. This will
now probably error out as a connection closed error.

Change-Id: I13c20028e834cc9af8c7bc1d7d7613bf60838e64
2022-08-08 07:58:45 +01:00
Niels Sascha Reedijk
9cb56a4881 NetServices: Add custom error message to BNetworkRequestError
Change-Id: I03970762531a689e25cd78a1091aecf755ee87ce
2022-08-07 08:47:19 +01:00
Niels Sascha Reedijk
6d1bb0e7ad NetServices: Remove BHttpRequest::SerializeTo(BDataIO*)
The private version that serializes to a HttpBuffer is now used.

Change-Id: I034933a641e98b3a8f918470a024ba32ea7c8663
2022-08-07 07:17:38 +01:00
Niels Sascha Reedijk
c7f925c3ee NetServices: add the HttpSerializer helper to help serialize requests
Change-Id: Ide1e2d387884ce4cf2d406057960cd0732d61f38
2022-08-07 06:47:15 +01:00
Jérôme Duval
265899da3a radeon_hd: from Cedar, memory sizes as bytes only for PALM/SUMO/SUMO2
should help with #17664
register change from Tahiti for #17377

Change-Id: I52b9691cd6a04b58b70e905bc29e803f06936789
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5526
Reviewed-by: John Scipione <jscipione@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-08-05 12:42:57 +00:00
Trung Nguyen
d02c0bade7 libs/posix: Fix NULL pointer in uselocale
uselocale now attempts to create a backend and a databrige.

If the attempt fails due to a missing libroot-addon-icu, uselocale
does nothing (to support applications calling uselocale during
startup to enforce the C locale).

Else, uselocale will fail with ENOMEM.

LocaleBackend::CreateBackend() has been modified to return a status_t
that indicates whether NULL is returned due to out of memory (B_NO_MEMORY)
or due to being unable to load the ICU addon (B_MISSING_LIBRARY).

Change-Id: I0f62ebde5890364c64e6694ec58d38de43ec6841
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5505
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-08-03 00:16:08 +00:00
Niels Sascha Reedijk
e68284565a NetServices: move HttpBuffer and HttpParser into their own header/source
Change-Id: I5bc0d9df6f94c2cf1c39baa6206bf6f1db284705
2022-08-01 08:11:56 +01:00
Niels Sascha Reedijk
9b33a931f1 NetServices: Implement controls on the number of concurrent requests.
This change allows the user to control how many concurrent request can be done
per session. This is going to be helpful to running the tests as well; they were
all fired up in parallel, which sometimes leads to our test server refusing a
connection.

Change-Id: I4f1f40b28b8e0199ea5589b36cd8d00ecd849a63
2022-07-27 09:02:09 +01:00
Pascal Abresch
46fdf97dea Interface Kit: add default dark appearence color constants
Change-Id: I8added6ada702eb09e95f5f2d6e34b748067c6bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4571
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-07-24 14:10:18 +00:00
milek7
81e0d2d4c2 arm64: Discover GICv2 from ACPI.
Change-Id: I89f2968a756d767f3a88c002292696a725a00918
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5275
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-07-24 07:56:07 +00:00
milek7
17f0f4b68f arm64: Discover UART device from ACPI.
Change-Id: I4e97b05dcfcaf6abddff81fbbf676c38fe337775
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5271
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-07-24 07:56:07 +00:00
Niels Sascha Reedijk
60355daec9 NetServices: Implement asynchronous status update messages.
The integration PostTest has a basic test that the expected messages are sent and
have the expected data fields. The gist is documented in book.dox.

To do are the messages around SSL. However, that functionality is also not
implemented yet, so there is nothing to send.

Change-Id: Ib8f36ed32f9854d643d8256338b71af7067059f0
2022-07-24 08:56:02 +01:00
David Karoly
91ee0332c3 move acpi headers from x86 to non-arch
Change-Id: Ida6186af7a40fb7d91b4da92c36d25db30dadb33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5484
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-07-20 08:28:53 +00:00
PulkoMandy
f0ee02b25e userlandfs_fuse_lowlevel: fix opening directories in Tracker
- It is possible to call open() on a directory, but FUSE lowlevel
  filesystems don't implement that and expect it to be re-routed to the
  opendir call. BRoster uses this to read the dir/file attributes to
  identify it, so it could not identify directories properly.
- In ReadDir, make sure to not return more entries than asked, as this
  confuses the userlandfs protocol communication (the kernel does not
  acknowledge the readdir reply, and then the server hits an assert when
  receiving the next request instead of the ack).

Change-Id: I9c4e9a3f0fc6e9879d4cfbc0d5402a4733d2218a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5482
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-07-19 16:06:29 +00:00
PulkoMandy
0604d554e8 userlandfs: compatibility with FUSE 2.9 and FUSE lowlevel API
- Import latest version of files from FUSE 2.9.9 (our last
  synchronization was with 2.7.4)
- Adjust fuse pkgconfig file to use the POSIX error mapper
  automatically, since that's required for all FUSE software
- Implement the lowlevel API in addition to the highlevel one. The
  lowlevel API uses inode numbers to identify files, rather than paths,
  making it a better fit to the userlandfs architecture.

The FUSE 2.x branch is not maintained anymore by FUSE developers,
however, pretty much no one migrated to FUSE 3.x. So it is more
interesting to implement, rather than 3.x.

Confirmed still working with sshfs and curlftpfs.

Example use:

I tested this with github.com/whoozle/android-file-transfer-linux

- Build the fuse library and copy it to ~/config/non-packaged/add-ons/userlandfs/
- Start the server: /system/servers/userlandfs_server aft-mtp-mount
- Connect your Android phone and put it in USB file transfer mode
- Mount the device: mount -t userlandfs -p 'aft-mtp-mount /boot/home/MyPhone -d -o use_ino' ~/MyPhone
- You can now access your phone data

Change-Id: Ic3efda7ffbc33737e6f4958428fb3ec9939ef105
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5198
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-07-19 16:06:29 +00:00
Niels Sascha Reedijk
2b4cd81ff3 NetServices: add support for receiving incoming chunked messages
Change-Id: I1bfe22a7959c7a5fc7dc644e4e3941965edafb65
2022-07-19 06:29:36 +01:00
Augustin Cavalier
5e596efecf Refactor touchpad movement generation by migrating MovementMaker to userland.
This considerably overhauls touchpad event generation, simplifying and
cleaning it up considerably:

 * Return the touchpad specifications through the MS_IS_TOUCHPAD ioctl.

 * There is now a dedicated MS_READ_TOUCHPAD ioctl, as touchpads
   can either return touchpad_movement structures or mouse_movement
   ones depending on what mode they are operating in.

 * Event repeating on timeouts is now handled in MovementMaker and
   the input_server control thread, so MS_READ_TOUCHPAD takes
   a timeout value. This means we can drop all the EventProducers.

 * Use the real floating-point math functions in MovementMaker now
   that we are running in userland.

 * Drop unused structures, constants, headers, and other things
   related to touchpad support.

Change-Id: I28cdb28e4100393a9338a8ebb865573cec13fc1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5455
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-07-18 16:00:29 +00:00
Niels Sascha Reedijk
826afd9616 NetServices: Refactor the parsing code into a HttpParser helper class
Change-Id: Ib03aacc36d46318c8870554f794ff66db4cce063
2022-07-17 15:54:54 +01:00
Trung Nguyen
d338200e2b libs/posix: Implemented new locale functions
Implemented the missing POSIX functions in <locale.h>:
newlocale, duplocale, uselocale, and freelocale, and also
provided missing type definitions for <locale.h>.

Implemented missing POSIX locale-based function variants.

Modified LocaleBackend so that it could support thread-local
locales.

Some glibc-like locale-related variables supporting
ctype and printf family of functions have also been updated
to reflect the thread-local variables present in the latest
glibc sources.

As there have been some modifications to global symbols
in libroot, libroot_stubs.c has been regenerated.

Bug: #17168
Change-Id: Ibf296c58c47d42d1d1dfb2ce64042442f2679431
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5351
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-07-11 16:30:16 +00:00
Leorize
86fa1c21e1 Shared Kit: Introduce BMemoryRingIO, a thread-safe ring buffer
This commit introduces a simple thread-safe ring buffer implementation
based on top of BDataIO. The main use case for this class will be to
implement shared buffers between threads for the upcoming refactoring
of Services Kit.

Change-Id: I526bc044b28c91496ad996fabebe538e75647f2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2966
Reviewed-by: Jacob Secunda <secundaja@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-07-11 16:29:53 +00:00
David Karoly
2e0a9b9554 kernel/arm: use generic/user_memory.h
Change-Id: I890bdd7d6f64162416a1a80c7d8280618aaa8fb8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5429
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-07-04 16:43:39 +00:00
Niels Sascha Reedijk
a1e7583626 NetServices: add HttpBuffer to encapsulate buffered reading
Change-Id: I7ec3189c3cf459fccae4ffac44702fd6b8c12ac9
2022-07-03 12:17:10 +01:00
Augustin Cavalier
045f7a5f3a headers/bsd: Rewrite link_elf.h.
Include only the APIs we are (shortly) going to actually support.

The other structures and functions declared in this file were
never supported nor used anywhere in Haiku's tree.
2022-06-28 13:07:53 -04:00
Niels Sascha Reedijk
92357c131e NetServices: Add support for an input body in a request and handle this with redirects.
Change-Id: Id2399d49aa673469c8c04ebd13884cdbcb24112d
2022-06-23 21:13:35 +01:00
Alexander von Gluck IV
774c33c2a7 radeon_hd: Drop unused overlay, cursor registers
* Also drop unused vblank semaphore storage
* Spotted by X512. These are from intel_extreme
  which was used as a base *ages* ago.

Change-Id: I2a6baaa4849baeb8c8cf10e2046d0fbe10c3a356
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5389
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-06-20 02:46:55 +00:00
Mashijams
9c4a46b318 xfs : version 5 superblock, checksum header file
- Implemented version 5 superblock fields and necessary macros.

- Checksum functions are implemented which will be used for crc verification and crc updates.

- fssh_kernal_priv.h ROUNDDOWN macro definition is consistent with kernal.h definition.

Change-Id: I49b7c939bfd3ea1bffc85b3db42bc678dcce75cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5350
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2022-06-18 08:32:18 +00:00
Augustin Cavalier
44fa45df3a net/if: Drop ifmediareq and just use the regular ifreq for SIOCGIFMEDIA.
This was introduced into the main API in 2010 (d72ede75fb),
but was actually only fully used for the past month (c2a9a890f3)
when SIOCGIFMEDIA was supported for all *BSD drivers and not just WiFi.
Most userland consumers of this structure did not use it correctly,
as was the case in #17770, and only worked because in the fallback case
the network stack just treated it as if it were an ifreq.

Nothing actually used the ifm_count/ifm_ulist (though tentative APIs
were exposed for it) as noted by previous commits; and the fact that
Haiku's IFM_* declarations are so spartan makes most of the returned
values unintelligible to userland without using FreeBSD compat headers.

If, in the future, we decide to implement ifmedia listing and selection
properly, that should likely be done with separate ioctls instead of
having multi-function ones like this.

This is technically an ABI break, but in practice it should not matter:
ifmediareq::ifm_current aligns with ifreq::ifr_media, so the things
that used this structure like our in-tree code did will continue to work.
Until this past May, the only other field that was usually set was
ifm_active, but in the absence of setting ifm_status all non-Haiku
consumers should ignore it completely.

The only consumer of this ioctl that I know of out of the tree,
wpa_supplicant, still works after these changes.
2022-06-13 22:31:33 -04:00
Augustin Cavalier
3b4737b9e5 headers: Remove bsd_mem.h.
This is a holdover from BeOS. All the functions in here we declare
in other headers, so this is not needed.
2022-06-09 18:31:08 -04:00
Augustin Cavalier
0afb8a1b49 Move fts.h and functions from libroot to libbsd.
These are BSD extensions, not POSIX functions. They were needed
in libroot by the previous versions of the ftw/nftw implementations,
but the musl versions do not need them, and so we can move them to
libbsd.

This is a minor ABI break, but hopefully whatever was using them
in libroot also links to libbsd. If not, that's an easy enough fix.
(These were only added to libroot in 2013.)
2022-06-09 16:30:40 -04:00
Augustin Cavalier
9b2434d26f libroot: Replace ftw/nftw implemenations with their musl counterparts.
Rewrite ftw.h to be a Haiku header instead of a BSD one while at it.
2022-06-09 16:24:11 -04:00
Augustin Cavalier
7cb5a6d24f NetworkDevice.h: Make it possible to include from _KERNEL_MODE and/or non-C++.
This file contains a set of constants and flags which are already passed
between applications, net_server, and wpa_supplicant to indicate network
security, connection modes, and a variety of other things.

As the OpenBSD net80211 stack does not need wpa_supplicant for WPA2/PSK,
it only makes sense that we would pass the same information we pass
to wpa_supplicant into the stack instead. Rather than expose yet another
set of constants and flags to userland besides the FreeBSD and these
Haiku native ones, just make it so this file can be included in the kernel,
and the constants thus used directly.
2022-06-09 01:28:56 -04:00
Jérôme Duval
85344c112c intel_extreme: also set hw_cdclk on Broadwell
this needed for dp aux before skylake, only for DP A (eDP).
should help with #17771

Change-Id: I4bdcca1fdc05294fb5b56c5c96164b6936a5881e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5355
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-06-05 14:29:17 +00:00
Jessica Hamilton
f892047183 kernel.h: don't include user address tests in boot loader 2022-06-04 10:31:05 +12:00
Augustin Cavalier
eb26002b47 kernel/util: Remove kqueue.h.
It is not used anymore, and we have more advanced queuing facilities now.
2022-06-03 17:18:32 -04:00
Augustin Cavalier
00f1e7c5e4 kernel: Rework iovec copying from userland.
Create a utility function which performs all necessary checks,
allocates memory, and copies the structures, and then make use of it
in the three places in the kernel which did all this manually.

None of them were previously complete: the fd and socket code only
checked iov_base and not iov_len, while the port code did not check
anything at all.

Part of #14961.
2022-06-03 16:32:11 -04:00
Augustin Cavalier
77694f9225 kernel: Move validate_user_memory_range to kernel.h and rename it.
It has more general use than just in the VM code; basically anything
which receives buffers from userland should be invoking this if it
does anything besides user_memcpy (which alreay does it.)
2022-06-03 15:35:17 -04:00
Niels Sascha Reedijk
6cbbd9bf4e NetServices: Implement BHttpSession::Cancel()
Change-Id: Iff0a7726e57f3e6bd4e9d0ebac08a370d25a62d7
2022-06-03 13:38:28 +01:00
Niels Sascha Reedijk
2f3b9b18ac NetServices: Add/rework the MaxRedirections, Timeout and StopOnError options
Change-Id: I4e59b51c16c6777941dc92ce02505386257dad03
2022-06-03 09:40:42 +01:00
milek7
d5f2742d1f arm64: Preserve FPU registers in setjmp/longjmp and arch_context_swap.
Change-Id: If0ca2ecbfa45b663dab39d1e9cb2562f071c3b27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5268
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-29 18:51:32 +00:00
milek7
e9d04b25e6 arm64: Add thread exit syscall in commpage.
Change-Id: Ia8e7e4626add623735fefefa1af151b7338adc35
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5265
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-29 18:51:32 +00:00
milek7
d1c3213a6d arm64: Add exception handling, handle pagetables access and dirty flags.
Change-Id: I751d78eb458da16098d236f3829d0c26540fbc17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5264
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-29 18:51:32 +00:00
milek7
78ea9ffc9b arm64: Implement kernel thread switching.
Change-Id: I87cca66ad89cfa85ba98a9ec828c5e357d7406b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5263
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-29 18:51:32 +00:00
Niels Sascha Reedijk
f9d9d20245 NetServices: Add support for Basic authentication
Change-Id: I304104f7096fd935212e1bfa3e988e7945cb5cec
2022-05-29 15:13:54 +01:00
Augustin Cavalier
41faeb1df9 net_interface & datalink: Fix MTU handling.
The device is what actually controls the MTU, and it has its own
field for this, so having a second one just meant the MTU never
got updated after startup.

Remove the "mtu" field from the interface, use the "device->mtu" directly,
and then actually invoke device->module->set_mtu when updating.
2022-05-27 16:36:12 -04:00
Jérôme Duval
9e991b61fe intel_extreme: switch FDI to i915 register naming
Change-Id: Ib7382240a2bc07dbbd2aed7647b06f14a6c5cb4c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5335
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-24 15:52:46 +00:00
Jérôme Duval
59ce1ffe61 intel_extreme: check internal crt feature in VBT for analog probe on DDI
* also uses the BAR size when dumping regs (as done by the intel_reg tool).

Change-Id: Ie29768afc8f9c42bb9a03b2866db34c4b0e43b7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5334
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-24 15:52:46 +00:00
Jaidyn Ann
cc9bc8c6fb Move DateTimeEdit into libshared
BInvoker methods are now used, and input-handling is also tweaked.

Change-Id: I120cca8df9f11c11aac80911108d62fb49488f8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4927
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-20 05:19:05 +00:00
milek7
088321c119 arm64: Fix typos in arm_registers, add define for nGnRE.
Change-Id: I43aa971f2ead3a171af3c707539cbe08ff60cae5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5262
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: David Karoly <karolyd577@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-19 09:42:42 +00:00
Jérôme Duval
514c42d740 intel_extreme: improve DpAux support on HSW/SNB/IVB
hraw_clock is possibly dynamic, but for the usecase this seems good enough.
Tested on SandyBridge and Haswell laptops.

Change-Id: I045b3c03f6b37bbffb3d8688658ffaa2a97311ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5319
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-18 22:02:01 +00:00
Niels Sascha Reedijk
f751534257 NetServices: add optional fields to BHttpRequest
Change-Id: I6228419a55c81203ce2c26827d17ff6a402d86c5
2022-05-15 16:43:07 +01:00
Alexander von Gluck IV
21aaa37347 headers/NetworkKit: Drop now-private service calls from NetworkKit.h
Change-Id: I9efdeb7334606e8cd1cf6b394a19e870ff73bd70
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5309
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-05-13 16:01:15 +00:00