Commit Graph

9727 Commits

Author SHA1 Message Date
Augustin Cavalier
ffbe2ad946 libroot: Reinstate tdestroy.
It was removed in hrev55422 as we never had declared it in any headers.
But it seems some software came to depend on it anyway. Reinstate it,
and add a declaration for it, behind _GNU_SOURCE.
2021-09-17 15:34:10 -04:00
Augustin Cavalier
aa04f48dcf Remove some unused headers. 2021-09-17 15:29:00 -04:00
Augustin Cavalier
05709fe3f7 headers: Fix B_CURRENT_IMAGE_SYMBOL for GCC2.
Apparently GCC2 does not like &__func__, so just drop the &.
Fixes #17253.
2021-09-15 11:38:20 -04:00
Augustin Cavalier
64e742def3 media: Declare wildcard fields const.
This is a source compatibility break from BeOS, but should not
be an ABI one (I checked, the symbols are identical.)

Also use "= {}" in the definitions of the fields. We use this
in plenty of places in the kernel, so it should be OK for GCC2.

Change-Id: Ibe05b2236d46024d7b4563ae16e1cc7140fed965
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4434
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-09-14 20:43:29 +00:00
Niels Sascha Reedijk
530f89aa6d BString: rewrite cleanup methods
This removes the use of the destructor in the move assignment operator, as it
may rely on undefined behaviour from the compiler. Additionally, some duplicate
logic to dereference and free a shared string has been unified under
_ReleasePrivateData().

Change-Id: Ie9f51d598c734f83cd0fba49b651315c6e9c8aac
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4440
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-09-10 05:34:06 +00:00
Niels Sascha Reedijk
0b86520c4d BString: add support for move semantics with C++11 and up.
This implements the "rule of 5" for this type. While the copy operation for
BString was already using shallow copies of the underlying data, this change
further optimizes moving the data from one object to another.

While it is not the intention to implement move semantics to all types in the
legacy Haiku/Be kits, data types like BString are good candidates, because move
operations are often useful when working with data within an application.

In this implementation, the internal data of the string object will be set to
NULL, thus leaving an empty string.

Change-Id: I16bf9424f9b17f622b0b57659b80628e18760288
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4428
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-09-08 07:07:36 +00:00
Alexander von Gluck IV
7068c45485 system/uart: refactor debug_uart, fix arm uart
* Drop ArchUART8260 layer to reduce complexity. It's whole
  existance in life was to adjust the mmio alignment.
* Fold architecture mmio alignment into DebugUart
* We could potentially pass a Init(int mmioAlignment)
  arg in the future if the macros get too messy.
* Move Barrier code back a layer into DebugUART
* Fixes the arm uart and EFI build

Change-Id: I0f127d902993e9f6e6a03cac8c7c37c0363134bf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4422
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>
2021-09-06 20:37:14 +00:00
Augustin Cavalier
e755ecb584 USB: Move usb_iso_packet_descriptor to a separate header.
The USB Kit uses it, so this allows the USB Kit to stop including
USB3.h.

Change-Id: Ifde025ec41bef92013fda0440d60b7216cfdbe4a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4413
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-09-02 16:00:17 +00:00
Alexander von Gluck IV
372b901dfe riscv: cleanup architecture macro checks
* We really should get out of the habbit of making up
  our own architecture defines.
* __riscv with an additional  __riscv_xlen is the
  standard that developed... let's just roll with it.

Change-Id: Ieb777d48340ae25a6d66f66133afa0ec5c6da9b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4402
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-09-01 18:04:59 +00:00
Augustin Cavalier
1029af1793 Add missing includes following previous commit.
All these files were making use of headers included indirectly
through AutoLock.h that are now no longer following the previous commit.
2021-09-01 13:10:04 -04:00
Augustin Cavalier
057fe1910d kernel: Break thread-related AutoLockers into a separate header.
Including thread.h brings a massive array of things with it from
the kernel thread arch headers, team and thread definitions,
hash tables, linked lists, Referenceable, etc. that the vast majority
of AutoLock.h consumers neither want nor need.

So, put these in a separate header, and adjust all consumers of these
lockers to include the new file.

This change exposes the fact that a lot of files were inadvertently
making use of headers included indirectly through thread.h. Those
will be fixed in the next commit.
2021-09-01 13:08:49 -04:00
Augustin Cavalier
0ac46a4ae9 kernel/debug: Adjust range marker macros.
Previously these were just using the raw function name, which led
to markers like "Slab_begin". Now we prefix RANGE_MARKER_ so there
is absolutely no chance of confusion, and the symbols are clearly
visible in dumps.

Also add a note that the kernel must be built with -fno-toplevel-reorder
for these to work. (It seems when this was implemented, GCC had not yet
implemented top-level reordering.)

They are only used for debugging with the tracing system in a handful
of places, and -ftoplevel-reorder is enabled with optimizations for
a reason, so it makes more sense just to note this and not to enable
that option by default (i.e. in the off chance someone will want to
use these in non-debug builds, like I did.)
2021-08-31 22:00:36 -04:00
Coldfirex
e4f758ee83 Update missing arch relocations
Change-Id: I2d48b810f5e3143377fa58e1de5801ebf0be82cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4409
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-08-31 18:05:45 +00:00
Augustin Cavalier
f27a660a6a kernel: Style fixup. 2021-08-27 19:02:20 -04:00
Augustin Cavalier
9c91c3b5a2 kernel: Adjust timeout computation for syscall_restart.
If the timeout is already >= B_INFINITE_TIMEOUT, we do not need
to do any of the following math (which would usually overflow anyway)
and can leave the timeout alone.

Spotted by kernel undefined behavior sanitizer.
2021-08-27 18:57:50 -04:00
John Scipione
7f8195344a Tracker: Add thumbnail support
Define thumbnail attributes in Attributes.h:
  Media:Thumbnail to store the thumbnail,
  Media:Thumbnail:CreationTime to see if thumbs need to be regenerated.

Store 128x128 thumbnail in attribute, for icon sizes smaller than
128x128 down-scale the 128x128 thumbnail. Use B_FILTER_BITMAP_BILINEAR
to down-scale the image using the bilinear scaling algorithm which
creates nicer looking thumbnails than the default scaling algorithm.

Store thumbnails as WebP images which compress smaller than PNGs and
fit in the inode better at 128x128.

Check the file's modification time in GetFileIconFromAttr() and compare
it to the thumbnail creation time. If the file has not been modified
since the last time we generated thumbnails return the thumbnail from
the attribute, otherwise fetch a new thumbnail with GetThumbnailIcon().

Add "Generate image thumbnails" Tracker setting. Default is turned off
for now. To generate image thumbnails you must first turn this setting
on in Tracker Windows preferences.

Spawn a get_thumbnail() thread to generate thumbnails and retrieve them
later on from the window thread to fill out into the icon. This should
improve responsiveness of generating thumbnails from a folder with a
lot of images. The generator thread will write the thumbnail data to an
attribute if on writable BFS volume.

If not on writable BFS volume, the generator thread will send the data
back to the original thread through a port by calling write_port().

When the thread is finished creating the thumbnail it sends a message
back to the Tracker application thread to update the pose which
instructs the window thread to look for an thumbnail. It either finds a
thumbnail in an attribute, or picks up the thumbnail data that has been
sent through write_port() using read_port().

This works on both read-write and read-only BFS volumes but it still
depends on the presence of a BEOS:TYPE parameter to have been written
to the volume before it became read-only. Thumbnail generation does not
work on other read-only volumes for example an ISO-9660 CD, but it does
work on read-only BFS volumes for example the BeOS R5 CD.

Move BPrivate::CheckNodeIconHintPrivate() from BNodeInfo to Tracker
Model CheckNodeIconHint(). Create Model::CheckAppIconHint() and look
for a vector icon or mini and large icon in that method. Check that
the base type is directory, volume, trash, desktop, or if executable
call CheckAppIconHint().

Add 1 to temp_name to fix the following warning:
src/kits/tracker/FSUtils.cpp:2437:12: note: 'snprintf' output 3 or more
bytes (assuming 267) into a destination of size 266

Rename temp_name to tempName following our style guidelines. Use
strlcpy() and strlcat() instead of strcpy() to safely copy the string.
This fixes thumbnail generation on 64-bit Haiku.

Change-Id: I7f927a5a1f8cf65e4b1aa1e0eb55bbfae87fd969
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3163
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-08-27 11:39:13 +00:00
Fredrik Holmqvist
3b63fd000a WIP: Rewrote arm64 arch_kernel_args.h based on arm
FDT and UART is disabled until later in the port
2021-08-23 21:52:49 +02:00
Fredrik Holmqvist
5185ccdeb4 efi/arch_smp.h: use __aarch64__ for ARM64 defines 2021-08-23 21:28:15 +02:00
Fredrik Holmqvist
01dad9378b Add ARM64 arch_cpu.h header 2021-08-23 21:10:34 +02:00
Alexander von Gluck IV
a03687553b platform/efi: platform_cpu_info
* This models the CpuInfo into a cross-architecture
  platform_cpu_info
* Originally I was looking at merging this with "arch_cpu_info"
  however that is "overall cpu" while CpuInfo is "indivial core
  information" packed into an array.
* Since every dtb platform will report individual cores in fdt,
  having a common cpu core info struct with at minimum the core
  id makes sense.
* This could likely be refined further to some kind of core info
  packed inside of arch_cpu_info, but this will fix arm,arm64,etc
  for now until someone wants to dive into that.

Change-Id: Ia18a352403cd0da7130c1e637fc205d4311478ef
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4363
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-08-20 13:38:17 +00:00
X512
03fd479633 virtio_input: add new virtio input driver
Change-Id: I10af2b30c79d1e8ff890d45642988f362d3d0a1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4012
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-20 12:43:16 +00:00
Alexander von Gluck IV
d637e0bec1 system/kernel: Rework uart management
Change-Id: I6cb31760519c8ba4542d217d6e68439602eda558
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4356
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-20 03:03:25 +00:00
Przemysław Buczkowski
5855a8e350 riscv: fix typo frequrency -> frequency
Change-Id: I7a2ed220ad96a9b18bff3ac5c115592c8ba87d89
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4334
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2021-08-17 15:41:18 +00:00
Alexander von Gluck IV
950f68e3b2 kernel/uart: Fix PPC, drop needless abstraction
Change-Id: I4b8f69271ede117701725f9cce30de5bb8ba30bb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4332
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
2021-08-16 23:22:35 +00:00
Alexander von Gluck IV
1648ab5277 kernel/uart: Clean up uarts, make calling convention consistent
Change-Id: I36ef92ef13edb0b006344db74e9d1b3ae52e0127
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4327
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-08-16 23:22:35 +00:00
Adrien Destugues
c3abd58da6 BUrlRequest: reintroduce Pause/Resume API in the deprecated version
Fixes https://github.com/haikuports/haikuports/issues/6123
2021-08-15 11:47:17 +02:00
X512
f850bba8d0 bus_managers/fdt: rewrite to support device manager node tree
* Breaks previous fdt module clients.

Change-Id: I8bfdca40a77c041ddef51488e1995e5d43edb340
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3977
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-14 23:57:35 +00:00
X512
fa41d6fa7a kernel/arch/platform: implement for riscv64
Change-Id: Id1839ef39d927e6a2017c8b8ac3482d9eeb00fa1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4059
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-13 20:36:30 +00:00
X512
7b124be096 efi: add NVRAM variable GUID definition
Change-Id: Iab4e59bb4ac91ba5e9c34e1ade433b423a140b9b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4316
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-08-13 13:06:05 +00:00
X512
a748b72e3c AutoDeleter: add VMAddressSpacePutter, DeviceNodePutter
Change-Id: I705de24f6a87287943814e748d5a02e43b029e60
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3987
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 21:11:04 +00:00
X512
058b29ac34 AutoDeleter: introduce MethodObjectDeleter
It allows to call destructor function stored in struct object such as
device_manager_info::put_node.

Change-Id: If9162f2f449d2b1c52c39509fa8732f21debf04a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3484
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 21:11:04 +00:00
X512
f0e1bca09c kernel/arch/int: implement for riscv64
Change-Id: I62d9bff75d35a685983c626720514ff17b1cef00
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4052
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 17:45:26 +00:00
X512
d472f38a49 riscv64: update hardware definition headers
Change-Id: I0c84f1d5389842d4591cb1548793e08155ba3666
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4311
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 17:33:53 +00:00
X512
b87ec78210 kernel: update arch headers for riscv64
Change-Id: Iaf1c253745412614f7e4a30019d96483cb0d3a12
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4310
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 17:26:04 +00:00
X512
ec1174b442 kernel: add SiFive UART driver for riscv64
Change-Id: I37a909b5bcdb18b3fa062961eca9ff2f5187867c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4305
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 16:56:21 +00:00
X512
1deede7388 riscv64: add SBI syscall interface
Change-Id: Ifab2a65fdad1de807e2334ec94137b992d6fe19d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4300
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:51:16 +00:00
X512
c15bf9b792 kernel/arch/timer: implement for riscv64
Change-Id: Ia854b0048a86b1427e975f482325ed4d4df1a12a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4061
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:47:48 +00:00
X512
de8c1bcc32 kernel/arch/user_debugger: implement for risv64
Change-Id: I9cdf7a6a5b66cdd83133485f98067ce9a5fb819d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4058
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:42:49 +00:00
X512
d031c09ceb kernel/arch/cpu: implement for riscv64
Change-Id: Ib4dd636f9ebb62931f77c809185ea810485d801e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4057
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:41:33 +00:00
X512
62790afc9d kernel/arch/commpage: implement for riscv64
Change-Id: Id7f495896a08a237db85dcedd1174e4c181e373d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4056
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:28:42 +00:00
X512
e013897fcf kernel/arch/debug: implement for riscv64
Change-Id: Iab5cc9ef4059f968bca03683592d1ec1818a26a2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4053
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:19:22 +00:00
X512
4a32f48e70 kernel/arch/thread: implement for riscv64
Change-Id: I3effa598626b32c29606299cd0edee390d430baf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4066
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 15:01:52 +00:00
X512
7ef006297e kernel/arch/vm: implement for riscv64
Change-Id: I0b463f3d2bca9f31b0aabacbf70a9774493d3467
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4051
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-08-06 14:47:32 +00:00
Adrien Destugues
a94ee3f35a BUrlRequest: fix issues found while documenting
- Remove Pause/Resume functions. They are not possible to implement (the
  server would time out)
- Fix SetContext(NULL) to do the right thing.

Change-Id: I25ba09bb01ea0fe8a85d774611b33be7dc192028
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4245
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2021-07-26 06:28:08 +00:00
Panagiotis Vasilopoulos
bf14c4b44c libcxxrt: Remove unused library and headers
Change-Id: Id5dd5de98cbdbb274a85c6383ad3b4d6ce593ad5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4241
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-07-23 22:02:15 +00:00
Panagiotis Vasilopoulos
1aa97652e0 libunwind: Remove unused headers
Follow-up of https://review.haiku-os.org/c/haiku/+/4128

Change-Id: I6b93484ebeef1dd672a88e96dd7cbe93a619fce9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4239
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-07-23 11:26:29 +00:00
Adrien Destugues
e5fb17f0ca BCountry: add a GetPreferredLanguage method.
The APIs for this were introduced in ICU 63, so we'll need an update.
ICU 63 does not build with gcc2, so this method is disabled there.

Change-Id: Iabe49509ed6d4e578560d497d3ca336a97db4625
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1874
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-07-21 07:20:39 +00:00
David Sebek
8b1d35bdbb Improve SCSI and SATA trim support
Fixes:
* scsi: Fix a bug that caused the device capacity to be set
  to an undefined value for some large SCSI devices when
  READ CAPACITY (16) was used
* ahci: Fix VPD page reporting so that it does not return
  undefined values
* ahci: Set the write bit to true when sending a DATA SET
  MANAGEMENT (trim) command to a device. The command would
  otherwise fail and time out on some devices.

Improvements:
* scsi: Extend the READ CAPACITY (16) support to also
  include logical block provisioning information
* scsi: Prefer READ CAPACITY (16) over READ CAPACITY (10)
  on devices that are expected to support this command
* scsi, ahci: Enable trim on SCSI and SATA devices that
  are expected to support trim and which correctly report
  trim support
* ahci: Redo the implementation of the SCSI UNMAP command
* scsi: Redo UNMAP-related code
* scsi: Add support for UNMAP via WRITE SAME (10) and
  WRITE SAME (16) commands
* When copying trim ranges between different data types,
  make sure that the values don't change (detect overflows)
* Report the number of trimmed blocks even if the trim
  operation fails

Change-Id: Ie5fc993bbbc19546b4308138ba10184bf7b9986a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4157
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-07-16 18:35:57 +00:00
David Sebek
bd02d81c24 Fix trim-related issues
Fixes:
* Use uint64 instead of off_t when handling offset and size
  of the trimmed range in the fs_trim_data structure
* BlockAllocator::Trim: Correct the size of a buffer
* ram_disk, mmc: Do not trim past device capacity

Improvements:
* BlockAllocator::Trim: Because the received offset and size
  are ignored by BFS (the functionality is not implemented yet),
  return B_UNSUPPORTED if the range does not cover the whole
  partition
* ram_disk, mmc: More accurate calculation of the number
  of trimmed bytes
* devfs: Add a uint64 version of translate_partition_access()

Change-Id: I24f4c08674f123ad33a5fef6e28996a4ada6ff0d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4155
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-07-16 18:35:34 +00:00
Jessica Hamilton
d3beb376b5 boot splash: offset icons when no logo is present
* Makes the case where the loader and the install differ by
  release type, so that the icons are rendered in the same
  position

Change-Id: I01e48109ce127b202ce5e05544aa2d5a495ed53e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4162
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-07-07 13:01:36 +00:00
Jessica Hamilton
62f80a2a71 loader: fetch all potential boot partitions for device
This also keeps the functionality of hrev53848, which simplifies the
list of disks searched for bootable partitions; however, it maintains
the previous behaviour of platform_get_boot_partitions that continues
to iterate over a list of possible boot partitions, which should
allow finding a bootable BFS partition better in more circumstances.

Particularly, there are numerous reports of the UEFI loader entering
the boot menu despite it finding a bootable partition, which this
should address.

EFI's device_contains_partition is also structured such that it
compares the disk GPT table of the partition the loader is
querying of the EFI disk's GPT table, in the case that there are
multiple disks, as the most reliable method of comparison, with
a generic fallback for non-GPT disks, which will be less reliable.

This reverts commit 0d932a49ad.

Change-Id: I5fac8608035d56b8bb4dc6c3d495ec6db42fa9b7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4149
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-07-04 23:31:18 +00:00
Rudolf Cornelissen
3334d6fba1 intel_extreme: gen4 displayport now sets modes, dualhead clone works. 2021-07-02 14:19:58 +00:00
Rudolf Cornelissen
b3bafaf695 intel_extreme: displayport now scales to BIOS set mode. 2021-06-30 00:47:10 +00:00
Rudolf Cornelissen
13a4e5a056 intel_extreme: haswell+ has DDI, no DP, so block scanning that for screens. 2021-06-27 17:47:04 +00:00
Rudolf Cornelissen
def51fb910 intel_extreme: don't pgm pipes, follow BIOS for now. Two screens on now i.e. 2021-06-25 10:40:08 +00:00
Alexander von Gluck IV
ce5993fdb7 version: add BETA_3 and PRE_BETA_4 constraints.
Change-Id: I65b4889042c4c92086fade535622ef12b368a968
2021-06-21 11:38:54 -05:00
Jérôme Duval
ddffdd2506 C11: define __STDC_NO_THREADS__ as threads.h is not provided
Theorically we could define __STDC_NO_THREADS__ internally in GCC, but
threads.h probably will be added in the future, and the compiler won't
notice.
Using this stdc-predef.h header and including it in GCC would solve this
nicely, and saves us from hardcoding.
The header can eventually be removed when obsolete.

Change-Id: I29aa58686e3c45449dc63e02e5a9e13a960b9090
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4097
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-06-21 12:31:53 +00:00
John Scipione
7912dad947 BTextView: Fix Tracker edit name
Don't resize text view in FrameResized() if resizable, this is done
in _AutoResize() instead. Set text rect width to width of max line when
word-wrap is off. Text rect width shrinks to the width of the text
matching behavior of BeOS R5 and previous Haiku. This fixes Tracker
Edit name.

Limit max width to column width in list mode or 30em in icon mode.
Filter paste messages limiting to max width in Tracker Edit name.

General BTextView fixes:

As a consequence of the text rect shrinking to fit the text, adjust
highlighting to go at least to edge of the view even if text rect width
is narrower. Extend the invalidation area beyond text rect when
redrawing to include highlighted areas.

Text views behave properly when overflow occurs i.e. when you type
text off the end of the text view. The text is nudged over as you
type/scroll so that the previous text is visible. This sorta worked
before but now works better.

Fix text rect centering by replacing switch with
BLayoutUtils::AlignOnRect().

Coalesce consecutive draw calls when inserting and deleting text to
prevent flashing for example when resizing the window. Redraw text
when the text view scrolls fixing a bug I noticed in StyledEdit.

Workaround negative height Beezer bug.

Fixes #16642, #16476

Change-Id: I2d32d6039944d2dc3218ce4de71f2966cc98c866
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3642
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-06-20 14:46:53 +00:00
Jérôme Duval
7d961f9746 sys/resource.h: add rusage compatibility fields, set to zero
POSIX defines this structure but specifies only two fields (which we
already implement). However, both the *BSD and Linux have agreed on
some more fields, which are often assumed to be there by applications.

The benefice of having compatibility fields is
greater as having to patch every other software at HaikuPorts.

Change-Id: Ie28ca2e348aa16b4c57eb3498eb62175100d9b9d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4083
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-06-20 12:50:24 +00:00
Jérôme Duval
c6fe367365 POSIX: introduce ppoll
will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: I38014ad910881df260f0ec762831491e143328c4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4099
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-06-19 18:09:25 +00:00
Rudolf Cornelissen
16ea5aac34 intel driver: added panelfitter pgmming. 2021-06-14 22:49:31 +00:00
Rudolf Cornelissen
aca9888e37 Intel_extreme: fixed hrev55115 regression and added FDI data/link M/N programming. 2021-06-08 09:30:38 +00:00
X512
d407b17b18 kernel: riscv64 patches
Change-Id: I8ebcbaa395cbccb50af08fd2f1b049b5cbb949c7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3883
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
2021-06-07 07:14:23 +00:00
X512
a7ed58868f virtio: add interrupt declarations
Change-Id: Ifd68f69599a8313615c31b85828aa5b96c68c165
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4069
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-06-06 19:03:30 +00:00
Fredrik Modéen
329ae20bac Make Bluetooth Pref use BMessage to save data.
* This will break previus ways to store settings (as it only stored a struct)
* Now we use BMessage to save data.
* Added some stuff to SettingsMessage.
* Fix a bug in BluetoothSettingsView::_GetClassForMenu() and SettingsMessage::SetValue

Change-Id: I6a0fa1564e78460258f480947592eb4007985007
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3887
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-06-02 13:44:13 +00:00
Adrien Destugues
599789de1e Pulse: add Risc-V logo
This may become useful soon.

Change-Id: I5c2d57981a04aacea5d8a0cf555ed06b72be48da
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3913
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-06-02 08:48:36 +00:00
Jérôme Duval
b25103cc9c kernel: generic user_memcpy() should clear_ac after the fault handler returns
the AC flag in eflags/rflags, pushed in the iframe by the CPU, is kept intact after handling the exception, since the fault handler is run with the faulted iframe and does a simple jump. The AC flag would otherwise be set until the syscall returns to userland.

Change-Id: I24f763032ab98029dd162fb411e1541586451606
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4040
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-06-01 12:24:54 +00:00
X512
af435dd1c9 libroot: remove delete_driver_settings
It is not present in BeOS R5 and it just call unload_driver_settings.

Replace delete_driver_settings usages with unload_driver_settings.
Keep the symbol on x86 for binary compatibility.

Change-Id: I1382710e3a4cb5c65d1249ea0e5880891e6800e4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3485
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-31 06:51:45 +00:00
X512
7806eafaa3 AutoLocker: add BHandler support
Change-Id: Ifaee00664eab78f0b6f67a8b716e3db8af710acd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4008
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-30 16:38:43 +00:00
X512
d00fc0e3e6 BTextView: fix Text field scripting
Change-Id: I2048d7f01fa3694d5687447cf7058fecf03ae15d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4007
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-29 12:17:24 +00:00
Rudolf Cornelissen
c7d83a174c Intel_extreme: fixed DPLL pgming (Sandy+), prevent black display by not killing PIPE (Ivy+). Chkd GMA(Q33G/Q45) OK. Added defines. 2021-05-29 08:41:32 +00:00
X512
0b4660ae5a BeBuild: add ALWAYS_INLINE macro
only available on gcc 4 and upper.

Change-Id: Ifc059d5fedd15a5aeda1514312fbbf98a72d3128
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4005
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-28 11:32:48 +00:00
X512
44a8696dc5 add VirtIO header
Change-Id: I938e80fe156a0a1d49e0eef330cbfc0cf22f0995
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4002
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-05-27 17:33:00 +00:00
X512
b8b1ad6fc4 introduce RISC-V headers
Change-Id: I9a8b6a1011cbefd4bd173852e7111e92efd0c730
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4003
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-05-27 15:43:19 +00:00
X512
5fcf71f504 Remove unneeded iostream includes
It cause adding new entry to executable init array for each translation unit.

Change-Id: I1e2d7946da03c001de7721948bc9af8188e8b317
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3981
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-05-25 11:50:45 +00:00
Murai Takashi
d272f61263 cpu.h: Fix size of array element is not a multiple of its alignment
Pointed out by gcc11.
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1937076

Change-Id: Ia76204f759710651340bc09fa6bc163d776b2ab4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3902
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-11 15:56:06 +00:00
Alexander von Gluck IV
ad284e7acb ifconfig: expand 10Gbps media knowledge
* These are pretty much the 10G standards that have
  any potential for usage on a desktop system.

Change-Id: I2cb49f41ca61e82e091d042f877ee2f1acb9c4ec
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3900
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-05-05 12:52:12 +00:00
Jérôme Duval
7065a89fc6 POSIX: ioctl(fd, op, arg) equals ioctl(fd, op, arg, 0)
The ioctl call cannot know the expected number of arguments
because it depends on the specific ioctl being used, and the
same value could be used to do different things by different
devices. Without knowing that, it is not safe to use va_arg
(at best a random value will be read from the stack, at worst,
it will just crash).

This changes the implementation of ioctl in two ways:
- For C++ code: a 4 argument function with default values
  for arguments 3 and 4.
- For C code: wrap arguments 3 and 4 in a struct with the
  help of a macro, providing something that behaves like the
  C++ version.

So, with this new code:
- Calling ioctl with only 3 arguments sets the 4th one to 0
- Calling ioctl with only 2 arguments sets the 3rd and 4th to 0
- Calling with 1 or 5+ arguments is a compile time error

The existing ioctl symbol is preserved for ABI compatibility.

Change-Id: I6d4d1d38fccd8cc9bd94203d3e11aeac6da8efc3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3360
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-05-04 19:21:48 +00:00
Zoltán Mizsei
144f45a030 features.h: enable ISOC11 definitions for _GNU_SOURCE and C++17
this is needed for GCC to build after the aligned_alloc introduction

Change-Id: Ieae32a050cc000561107c4a07cf10c912a196152
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3896
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-05-04 05:25:52 +00:00
Jérôme Duval
04be20a75a Implement stack protection support
this adds kernel & libroot stack protector hooks. it uses /dev/random in userspace.
A configure option --enable-stack-protector is added to activate -fstack-protector
on selected system components (ATM apps, kits, servers).

Change-Id: If3a2920ba9aa0a85eaff4ba6778947f8c76ade31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3895
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-05-03 17:52:31 +00:00
Pascal Abresch
409d65c0d6 Decorator: Introduce Scroll bar size call
Change-Id: I07f08c2893d832e431c29ae753e0a93d6e619701
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3892
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
2021-05-03 16:42:32 +00:00
Fredrik Modéen
6cd4da00c0 SettingsMessage: Add uint16 and uint64 support
* Thanks to kottan I notices something was of..
* Added uInt16 and uInt64, I was missing UInt16.

Change-Id: Id136dbb5a81392a7a694ac1fbbd9aefbd7f77af3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3888
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-05-01 12:58:34 +00:00
Jérôme Duval
20308ad6a7 build: follow-up for hrev54993
should help with bug #16929, untested

Change-Id: Ia7b9b6cc8e84e2377d79c0edd1c278cdf74d869b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3891
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-04-30 10:42:21 +00:00
Zoltán Mizsei
13e1bb0e0d Enable GCC11 as GCC4 compatible ABI
Change-Id: I55faec61f9f3162108c5ad4da11bad588663c9d1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3890
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-04-30 06:11:02 +00:00
Han Pengfei
2db2b2123b headers: Make structure padding explicit in efi_memory_descriptor
The EFI memory descriptor 64-bit aligns PhysicalStart on both 32- and
64-bit platforms. Make the padding explicit for arm efi and referring
32-bits platform.

- Same fix in FreeBSD: https://reviews.freebsd.org/rS320234
- Confirmed with NetBSD: https://github.com/NetBSD/src/blob/trunk/sys/external/bsd/gnu-efi/dist/inc/efidef.h#L191
- Confirmed with Linux: 5ee96fa9dd/include/linux/efi.h (L137)
- Confirmed with Zircon: https://github.com/vsrinivas/fuchsia/blob/master/zircon/kernel/lib/efi/include/efi/boot-services.h#L34

The Early Zircon/Fuchsia version has the same problem we have, apparently they did not
test their header on 32bit platforms either, now They have got it fixed.

Signed-off-by: Han Pengfei <pengphei@qq.com>

Change-Id: I0c685d41420c4a63773a7bb39b7d2fdd61e932c4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3875
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-04-21 09:28:45 +00:00
Han Pengfei
d3b7fb5a1d headers: Update efi headers from current versions in Zircon
- Add device path message macros
- Add serial terminal defines

Signed-off-by: Han Pengfei <pengphei@qq.com>
Change-Id: I9760c506eae49a7d0c474a13b2d2a97a369be3b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3878
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-04-21 07:16:43 +00:00
Rudolf Cornelissen
375a70e9fd Fixed I2C buses not working on C51 (some Geforce 6100/6150/Go cards). DDC/EDID should now work on all supported cards. 2021-04-18 00:51:46 +00:00
Fredrik Modéen
6375ef053d Move SettingsMessage to a central location
* Move SettingsMessage
* Remove SettingsMessage from MediaPlayer and WebPositive
* Use the central SettingsMessage in MediaPlayer and WebPositive (Later Bluetooth)
* Fix a Jam file.

Change-Id: I3bb82a40082c5ece5c2aea2468a77bcd9f15ce77
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3856
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-04-11 08:53:18 +00:00
Fredrik Modéen
91cbfa855e Bluetooth Pref: Inactiveate button and things that don't do anything.
* Inactiveate button and things that don't do anything.
* Those button and controlles that hade any actions in the Bluetooth Pref now saves in settings.
* Fix some windows/views.
* Fix Copyright in last Bluetooth commit.
* Last commit before we move saving settings with BMessage.
* Changed PoupMenu to BOptionPopUp

Change-Id: I32b85f1985b558d24b294a184665e08e6ce18a7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3829
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-04-10 20:28:43 +00:00
Fredrik Modéen
16196fd3b7 Bluetooth Pref: Updating view of incomming connection when Paring
This is not my code but from ticket #9265
* Made a picture of how it looks, old left andnew right. https://imagebin.ca/v/5wIe6TIMzw4C
* Think we have a bug somewhere and don't store the name of the Bluetooth device (shown i the image).
* I have made som small changes but other than that it's the same code as in the ticket
* Ran the src/tools/checkstyle/checkstyle.py to get som style stuff, probably missed some anyway.

Change-Id: Ifeb75c8ad890f541e100cdcf78b394675a48ada9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3825
Reviewed-by: Fredrik Modéen <fredrik@modeen.se>
2021-03-30 17:25:13 +00:00
Murai Takashi
560961ee2a Bootloader: replace blacklist with blocklist
Various projects, both commercial and OSS, began to use inclusive
terminology. There is no reason to not do it.

In Haiku, bootloader uses Blacklist, which is recommended to replace
with Denylist or Blocklist. I think Blocklist is appropriate here,
since it's a list used to block offending driver at boot.

Some strings remain unchanged for compatibility with previous naming,
but this change prepares for later removal of these (once everyone has
updated their kernel and bootloader).

Change-Id: Id9105ff5e9fcb866000355089b5ef97bf63ee854
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3145
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-27 10:47:33 +00:00
Niels Sascha Reedijk
f97357a6ed Fix building on Haiku after hrev54993
Build tested on Linux.

Change-Id: I911ac42d99a0c1e94cab77dc29bf43d8f7f91093
2021-03-24 11:19:25 +00:00
Jérôme Duval
45872f7f9c kernel/vm: restrict permission changes on shared file-mapped areas
a protection_max attribute is added in VMArea.
a read-only opened file already can't be mapped shared read-write at the moment,
but can later be changed to read-write with mprotect() or set_area_protection().
When creating the VMArea, the actual maximum protection is stored in the area,
so that it can be checked when needed.
this fixes a VM TODO.

Change-Id: I33b144c192034eeb059f1dede5dbef5af947280d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3804
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-23 17:40:31 +00:00
Niels Sascha Reedijk
9335a062be Revert "Fix building on Haiku after hrev54993"
This breaks the build on other platforms, so it needs a bit more thought and testing.

This reverts commit d0834b34d5.
2021-03-22 22:52:50 +00:00
Niels Sascha Reedijk
d0834b34d5 Fix building on Haiku after hrev54993
Change-Id: I052aad6374ae7ab7b4bcbf47bd88cd84193a9879
2021-03-22 21:10:09 +00:00
Dancsó Róbert
2cba2d5642 Added localization support for Cortex app.
* Fixes #7530.

Change-Id: I238c4c8fe32b181a8e1a4bd688bcbe9f3a87f79f
Signed-off-by: Kacper Kasper <kacperkasper@gmail.com>
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3169
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-22 18:50:39 +00:00
Jérôme Duval
267c6a9b0d Locale: correct fix binary compatibility for BNumberFormat
fix HaikuDepot build after hrev55006

Change-Id: I3c275e1b0f23f936db448ad82639458535617d6a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3809
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-03-20 09:30:14 +00:00
Jérôme Duval
e3c3983827 Locale: fix binary compatibility for BNumberFormat
Issue: https://github.com/HaikuArchives/Album/issues/15
Change-Id: I1f8d5055f929957adb0cca20a8f6b13bcccabfab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3807
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-19 10:53:15 +00:00
Jérôme Duval
b2b83ad10f runtime_loader: dlopen() should respect RPATH of the loading module
Change-Id: Ic58edb53114dfff30cc7188957cd32508fa8bd48
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3798
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-03-18 08:19:55 +00:00
Jérôme Duval
3592432e9b utmpx.h: add ut_host for compatibility (not posix)
Change-Id: I27e8f7b6dbc29232542e3749d8e194efa2ef5209
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3799
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-16 16:55:44 +00:00
Niels Sascha Reedijk
fc03b45a71 POSIX: make readv() and writev() conform to IEEE Std 1003.1-2001
The standardized version of readv() and writev() take an int as the third
parameter. Arguably a size_t makes more sense, but the standardization bodies
decided otherwise.

The non-standard functions of readv_pos() and writev_pos() have been updated
for consistency. The corresponding _kern_readv() and _kern_writev() internal
functions continue to take the size_t parameter.

The ABI will not change, even though on 64 bit machines the size of the count
parameter will change from 8 to 4 bytes.

The actual use will be slightly different. Like with the size_t argument type,
it will not be possible to give a count lower than 0. If the value is less than
0, then the B_BAD_VALUE/EINVAL error will be set.

Change-Id: I949c8ed67dbc0b4e209768cbdee554c929fc242e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3770
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-03-16 12:03:02 +00:00
Alexander G. M. Smith
3376ed1a72 Package Kit: Proper Installation for First Boot Packages
Do the final installation operations for all the packages in the
/system/packages directory when the OS is booted for the first time.

This will run their post-install scripts, create users, groups and generate
settings files (marked with a package version attribute).  Previously we just
ran all the shell scripts found in the /system/boot/post-install directory
(don't do that as much now).

Fixes bug #14382

This patch has simpler code flow in CommitTransactionHandler::_ApplyChanges
Tested on 32 and 64 bit systems.  Once it's official, need to remove the
open_ssh redundant post-install script that creates users etc. from HaikuPorts.
Now we can notice bugs like package version attributes on settings files aren't
fully working. :-)

Didn't remove special case for add_catalog_entry_attributes.sh since it
still does stuff that the build system doesn't do.  Might be able to add
that script as part of the Haiku.hpkg.  See change 3751 for removing it,
https://review.haiku-os.org/c/haiku/+/3751

Change-Id: I3807b78042fdb70e5a79eca2e2a45816ece0236f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2342
Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-14 09:10:18 +00:00
Andrew Lindesay
564de1924a Locale: Support for Percent Formatting
Updates BNumberFormat to be able to format
percentages.  Also re-introduces some unit
tests and updates the BNumberFormat ones.

This doesn't actually fix #16312 as the
defaults for percentage formatting don't seem
to track the selected language, but goes part
way there.

Related to #16312

Change-Id: Id6ddf426ce5571f4e8513c0eb1663cf42ac53cb1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3767
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-03-13 00:29:32 +00:00
Leorize
78b1442051 libbnetapi: BUrlRequest now outputs to BDataIO
Previously, BUrlRequest returns data received via a callback that can't
return any value. This approach have several issues:

- It's not possible to signify failures to the request.
- Users have to implement custom listeners just to handle the common
  case of outputting to a buffer/file/etc.
- The received data has to be serialized into BMessage when
  BUrlProtocolDispatchingListener is employed. This can cause a
  noticible slowdown in real-world scenarios as evident by #10748.

With this change, BUrlRequest will output directly into a BDataIO, which
exposes a richer API for request handlers to work with (for example a
BitTorrent client can request a BPositionIO for non-linear data
delivery), as well as simplifying common cases for users.

The adaptation only requires one additional API:
BHttpRequest::SetStopOnError(). This API simply instructs the HTTP
request handler to cancel the request if an HTTP error is occurred.

Change-Id: I4160884d77bff0e7678e0a623e2587987704443a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3084
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-02-28 20:39:31 +00:00
Leorize
3e27f8d5a7 libbnetservices: BUrlResult is no longer a BArchivable
The switch to make BUrlResult serializable was debuted in
f9e1854f19 with the rationale is that
BHttpRequest auto-redirection might cause the headers to become
obsolete by the time a client process the BMessage received from
BUrlProtocolDispatchingListener.

With the change to BHttpRequest to not notify listeners when
auto-redirection is enabled, this is no longer the case and the
serialization code can go away now. This simplifies BUrlResult and its
subclasses, and gain us some performance for clients using
BUrlProtocolDispatchingListener as the result object no longer has to be
serialized.

This also change the ABI of BUrlProtocolListener::HeadersReceived to no
longer passing a BUrlResult.

Additionally, BUrlResult and BHttpResult now express the size of the content
as an off_t, thus allowing results larger than 4 GB.

Change-Id: I9dd29a8b26fdd9aa8e5bbad8d1728084f136312d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3082
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-02-28 20:39:31 +00:00
Jérôme Duval
c1e6e51a05 libroot: implement timegm calling the ICU backend
Change-Id: Ib4de4288e061670acbc2edea3671cee029305d33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3748
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2021-02-24 05:51:44 +00:00
Jérôme Duval
99bd3b947f SupportDefs.h: remove the unichar type
irssi uses the unichar typename with a different type.

Change-Id: I2ee9dcf685f4832dd1b3c7d68f4686d69de50fb7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3656
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-02-09 16:47:55 +00:00
Andrew Lindesay
d75b4d610d HaikuDepot: Remove Custom List
Further removal of the use of custom list class;
this time with the package lists.

Relates To #15534
Change-Id: I1f01ed9d5ddbd7754097ce0adbf505d6ba17fd2f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3732
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-02-06 19:45:53 +00:00
Jérôme Duval
acdafb571d Debugger: fix build after hrev54931 2021-01-29 21:38:10 +01:00
Adrien Destugues
6f3a5c9ab0 Debugger: add AVX support
- Unify storage of "FPU" registers between debugger and signal handler
  to use xsave format on both sides
- Handle YMM registers in Debugger (they are the same as XMM, but wider)

Tested:
- The system still boots with and without AVX
- The hello_avx test program can be debugged and the full value of YMM is visible

This changes the API of vregs in signal.h but not the ABI (structure are
declared differently but memory layout is the same). This changes the
API and ABI of arch_debugger.h for x86_64, but I don't think anything
outside Haiku uses it (did we ever have a 64bit compatible gdb?)

Change-Id: If93680ffa0339c19bab517876b4e029f5d66b240
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3038
Reviewed-by: Rene Gollent <rene@gollent.com>
2021-01-29 13:29:10 +00:00
Niels Sascha Reedijk
e95af9e0ef libnetservices.a: final cleanup after progress size change to off_t
Final fallout of the hrev54936 change

Change-Id: Id4836359f49dffbef76916db7fb7b51dd1e490d8
2021-01-28 11:08:10 +00:00
X512
626466daa4 Network kit: use off_t for download and upload size
This change only applies in libnetservices.a. The implementation in
libbnetapi.so will use the original definitions.

Change-Id: I0aaa5a40af5fbcafaf233c32206cb4af862f8141
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2465
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-28 09:50:23 +00:00
Niels Sascha Reedijk
2a7090df71 libnetservices.a: move BGeoLocation from libshared.a
The BGeolocation class uses the network interface in libnetservices.a, so it
is moved here for now.

This will break any out of tree projects that depend on it, but it is a source
incompatible change only.

Change-Id: I6f5b1332eb87ad37dd33fbe09fdb11b16f7f26e4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3670
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
ce64ffdb90 libnetservices.a: Put the experimental API into BPrivate::Network namespace
In order to prevent classes between libnetapi.so with the legacy API and
applications using the libnetservices.a library, the latter will have the
classes in a distinct namespace.

In the implementation, both libbnetapi.so and libnetservices.a will use the
same header and source files. If LIBNETAPI_DEPRECATED is defined during build,
the headers and source will have binary compatible behavior. Otherwise, the
classes and other objects will be put in the HaikuExt namespace.

In order to build the libbnetapi.so and libnetservices.a with the proper
build configuration, there is a stub `src/kits/net/libnetapi_deprecated` folder
that applies the special configuration to the source files.

Currently HaikuDepot, Webpositive, libshared.a and the http_streamer add on
use the compatible API in libbnetapi.so.

Change-Id: Ic73e9f271ef75749adda46f6f72e9a0b2851b461
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3667
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Niels Sascha Reedijk
603e0bdf62 libnetapi.so: make headers of deprecated classes private
These classes have been moved to the public API too soon, and they need some
more time to mature before they can be declared stable.

Change-Id: I9c52a8e6cc103922abde7a6b911fe0c3e6bf5700
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3665
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-27 19:53:11 +00:00
Adrien Destugues
f1d4377609 Build fix. 2021-01-26 20:05:05 +01:00
Lt-Henry
52a54e1b51 usb_hid: Enable digitizers to produce button events from tip and barrel switches
Change-Id: Ifcf542e6b04f2f210c80528279e70e0fdd1bb4e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2685
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-26 18:56:32 +00:00
Jérôme Duval
9a7acbdbcf posix: protect EOF being parsed as operator and 1
see 7d095c7453/dev-libs/jsoncpp/patches/jsoncpp-1.9.4.patchset

Change-Id: Iaedb67eb51e86cbc5b73a21a86b6b0b6b70209b0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3679
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-25 18:53:43 +00:00
Adrien Destugues
2028d6386c mmc_disk: implement B_TRIM_DEVICE
Change-Id: Ib08a1e196441f35550fe221b912332b4803a04b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3641
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-23 12:20:59 +00:00
Adrien Destugues
cef80a1fb7 devfs: translate partition offsets in B_TRIM_DEVICE
Fixes bfs part of #10336. Untested on SATA (don't have a testing drive
to sacrifice) but working fine on SD/MMC.

This requires moving the copy from kernel to userland into the devfs. As
a result the code in the disk drivers becomes a bit simpler.

Also add some documentation for the common ioctls to implement for a
disk device.

Change-Id: Ie84b6a1d293828d33902a64b3c9d4b19aa6eacb1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3640
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-23 12:20:59 +00:00
Adrien Destugues
5ec64c5cdd sd/mmc: Cleanup and improve reliability
Store the bus cookie in the mmc_disk driver and pass it to the bus
manager when executing commands. This avoids calling into the device
manager at each read and write operation. The code to get the cookie
from mmc_disk isn't so nice since it needs to access the grandparent
device (the mmc bus root), it would be simpler if this cookie would be
available directly from mmc bus devices.

We can get card removal and card insertion interrupt at the same time
due to insufficient hardware debouncing (the SDHCI spec says we
shouldn't, but it happens on Ricoh controllers. Can't blame them, they
don't advertise themselves as compliant with the spec). So, check the
card status from the interrupt handler and ignore the incorrect
interrupts.

Fix unreliable card initialization: power must be turned on before
starting up the SD clock. Remove a now unneeded delay that was added in
an attempt to avoid initial instability.

Change-Id: Ibd8d051da1a1d859f3924ee535f4a05d9b6398d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3639
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-20 19:02:38 +00:00
Adrien Destugues
34552f8e66 sd/mmc: enable 4-bit data transfers
It works, but performance is still unexpectedly low (getting about
50kB/s write speed) with almost no CPU load.

Change-Id: I7da3ee70c8b379c4e6c2250d67f880c78635874f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3630
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-20 19:02:38 +00:00
Jérôme Duval
29536a2334 kernel/thread: restore signal mask just before returning to userland
* otherwise the signal to be handled might be blocked. fixes #15193
* also remove automatic syscall restart on _kern_select, to match Linux and
BSDs behavior: this fixes parallel build with newer gnu make, which happens
to use pselect.
* also remove automatic syscall restart on _kern_poll.

from https://man7.org/linux/man-pages/man7/signal.7.html
"The following interfaces are never restarted after being
       interrupted by a signal handler, regardless of the use of
       SA_RESTART; they always fail with the error EINTR when
       interrupted by a signal handler: ...
	select(2), and pselect(2)."
from https://notes.shichao.io/unp/ch6/
"Berkeley-derived kernels never automatically restart select."

Change-Id: I3e9488f60c966b38d427f992f06e6e2217d4adc5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3636
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2021-01-16 18:56:03 +00:00
Jérôme Duval
6ff344d7c6 Revert "kernel/thread: restore signal mask just before returning to userland"
This reverts commit 837f4f48db.

Reason for revert: breaks DNS resolution

Change-Id: If6f2a0f60dbfb24121616a9f3879ce226ea4a09a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3519
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-16 16:50:43 +00:00
Jérôme Duval
837f4f48db kernel/thread: restore signal mask just before returning to userland
* otherwise the signal to be handled might be blocked. fixes #15193
* also remove automatic syscall restart on _kern_select, to match Linux and
BSDs behavior: this fixes parallel build with newer gnu make, which happens
to use pselect.
* also remove automatic syscall restart on _kern_poll.

from https://man7.org/linux/man-pages/man7/signal.7.html
"The following interfaces are never restarted after being
       interrupted by a signal handler, regardless of the use of
       SA_RESTART; they always fail with the error EINTR when
       interrupted by a signal handler: ...
	select(2), and pselect(2)."
from https://notes.shichao.io/unp/ch6/
"Berkeley-derived kernels never automatically restart select."

Change-Id: I7f86d221eae1ad93d8a308a75581d2c30a369c9e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3627
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-15 17:41:33 +00:00
Adrien Destugues
522c141d53 [WIP] sd/mmc: enable high speed transfers
- Switch to 25MHz clock
- Switch to 4bit transfers mode (the default is 1bit)

Reading and writing SD cards do not seem to work anymore with these
changes. I get invalid data on read, and on write, an interrupt is never
called in some cases.
2021-01-12 22:01:43 +01:00
Adrien Destugues
2413679304 sdhci_pci: support for inserting cards after boot.
Change-Id: Ic67ea38bb80b35528ebb1a150d1a916a56184e69
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3617
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2021-01-11 08:11:37 +00:00
Adrien Destugues
f15516ff92 Package Kit: re-use downloads from unfinished transactions
There are three parts to this change:
- In FetchFileJob, if the request fails with a timeout or IO error
  (probably because of unstable connection) attempt to resume the
  download with a range request. No limit on number of retries
  currently, maybe we should add one.
- In PackageManager, before downloading a file, look around in other
  transaction directories in case it's already there. Partial and
  complete downloads are differentiated by an attribute which the
  fetch file job maintains. For complete downloads, no fetch job is
  scheduled, for partial downloads, the fetch job will request the
  remainder of the file.
- In BHttpRequest, the implementation of SetRangeStart() and
  SetRangeEnd() have been added, along with some refactoring to
  handle listener notifications consistently. This also fixed a
  bug where the final notification for download progress was not
  emitted for compressed data.

Fixes #12414.

Change-Id: I3e285741ed0e5651594a7c2e1c7170644a9d297d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3404
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-09 15:20:09 +00:00
Adrien Destugues
437df0a3fb x86_64: fix build
This code was accidentally removed but is still needed.
2021-01-08 13:38:29 +01:00
Adrien Destugues
68d37cfb3a Fix definition of PAGESIZE and B_PAGE_SIZE
On sparc, the minimal page size we can use is 8K. Since B_PAGE_SIZE and
PAGESIZE defines were hardcoded to 4K, this resulted in a lot of
confusion in all code trying to manipulate pages.

- Remove cpu.h from headers/private/kernel/arch/*. It dates back from
  NewOS and was not used anymore since our kernel uses B_PAGE_SIZE
  (PAGE_SIZE was the only thing defined in this header).
- Add posix/arch/*/limits.h with the arch specific page size and include
  it from the main limits.h.
- Adjust bios_ia32/debug.cpp which was the only place using the
  PAGE_SIZE constant from the deleted headers.
- Change OS.h to define B_PAGE_SIZE to be the same as POSIX PAGESIZE.
- Define PAGESIZE in the build header if the host OS doesn't.

Change-Id: I8c3732cf952ea3c2f088aa16d216678fbf198b96
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3558
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-08 12:02:16 +00:00
X512
c46f51fb45 BReference: add IsSet method
Change-Id: Ibc34dbde3b81faecdc7fe66a2c07fc33d7871ce2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3487
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-08 09:56:38 +00:00
X512
d1ca0fcc6a AutoDeleter: add IsSet method
Change-Id: I70eb43a288ec9c02471aa21ce5618f0fa2399bd7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3486
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-08 09:56:38 +00:00
Jérôme Duval
0db785d66c features.h: undef before define
Change-Id: Iba98e3a8352801345acefe963917471992f70281
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3606
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-07 09:14:57 +00:00
Adrien Destugues
d1fee57dee mmc_disk: add SDHC support.
The main differences:
- The initialization sequence requires an additional command (this was
  already done)
- The layout of the CSD register and the way to compute the device
  geometry from it changes
- The read and write commands parameter is a sector number instead of a
  byte position

Change-Id: Ie729e333c9748f36b37acd70c970adfd425cf0b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3512
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-05 02:06:44 +00:00
Adrien Destugues
9a37366b51 mmc_disk: add write support
Change-Id: I77cf1612569c43e79917ac5a1493b7ab4a04cb47
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3504
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-05 02:06:44 +00:00
Adrien Destugues
7a160a8629 mmc_disk: read using "simple DMA"
The SDHCI spec also offers an "advanced DMA" mode where we can use
scatter-gather lists. It would allow to remove several of the DMA
restrictions, but hardware support for it is optional, so we need this
version anyway.

The geometry is retrieved on demand in the first read or write or in a
call to the get geometry or get device size ioctl. It is not possible to
retrieve it from the device initialization because that is called as
part of the mmc_bus scanning, which needs a specific sequence of
commands and keeps the bus locked to prevent drivers to insert their own
commands in the middle of that sequence.

TODO:
- Move the DMA restrictions definition to sdhci_pci and forward it up to
  mmc_disk (which is the one creating the IOScheduler)
- Decide if we want to keep non-DMA support (probably should, but it
  makes things more complex, because it uses virtual addresses)

Change-Id: Ib1dd14eacf62052d747bfb3ef7820bc5a34d3030
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3471
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-05 02:06:44 +00:00
Adrien Destugues
cc2642c124 sdhci/mmc: add to the image.
Change-Id: Ic43965efea2c62b6e731c7552e4f27d6d20fc26b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/448
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2021-01-05 02:06:44 +00:00
Alexander von Gluck IV
6b49a15b64 media_kit: Dynamic allocation of ChunkCache based on media
* The "default" of 3MiB wasn't enough for modern larger media
  formats, resulting in inability to play 4k video no matter
  how much horse power you threw at Haiku. (4k is ~8MiB)
* This dynamically calculates the ChunkCache based on the
  video framesize * 2.
* 4k video now plays smoothly on my Ryzen 1800x.

Change-Id: I65bf6bd6fa60ac3196ea70eeeb5e655d43c10bcd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3598
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-03 20:51:37 +00:00
PulkoMandy
76fed28ab1 sparc: implement elf relocation
Needed to load the kernel properly.

Change-Id: Iab520398271be2ee3a740af4104960367c3b4ea9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3585
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-01 22:10:43 +00:00
PulkoMandy
b992c828cf sparc: add kernel debug output
Mostly the same as PowerPC, using OpenFirmware.

Change-Id: I197cc181e92da92c272ee9cfa20c8ad2d2c63d41
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3579
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-01 22:10:43 +00:00
PulkoMandy
0da81fed54 sparc: fix interrupt enable/disable code
The manually written code was all wrong (missing branch delay slots,
wrong type of return instruction used, probably more bugs). Use the same
approach as x86 to have inline functions instead, which is much better
for performance and simpler to write.

Change-Id: Iac0fc814c15311658f983da58ac7f9d3edd75b81
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3595
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-01 22:04:13 +00:00
PulkoMandy
6f743e6853 sparc: remove unneeded atomic implementation
The definition in SupportDefs.h using gcc builtins is sufficient. No
need for a custom one. The same approach is used on x86 with gcc8
already, but other platforms had not been adjusted to use it.

Change-Id: I3973ff723a31f90cc8d19ac098eb1e85d471d610
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3594
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-01 22:04:13 +00:00
PulkoMandy
6fd0953545 sparc: implement thread local storage support
The sparc ABI reserves the g7 register for this.

Change-Id: I93b81ecef72cde859972ef7b7f6b9991d35f9f29
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3583
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-01 00:45:13 +00:00
PulkoMandy
19024bc416 openfirmware: synchronize number of memory range with bios and efi
It was bumped for bios and efi from previously very low values, but
other architectures did not follow.

Change-Id: I6ce92e2cdb0261d4d0637753e77d555d407073fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3575
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-12-31 02:58:10 +00:00
Alexander von Gluck IV
9f3ba01bd3 file_system/fat: Rework driver for fs_shell support
* Introduce fat_shell for build system fat manipulation
* Will theoretically let us do away with mtools when we
  have another internal tool for partition manipulation

Change-Id: I661be556e79009842f157a9402c8f85da85d6336
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3556
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-30 14:10:19 +00:00
Adrien Destugues
db7dcab7b1 asprintf should be available if _GNU_SOURCE is defined
As documented in the Linux manpage:
https://man7.org/linux/man-pages/man3/asprintf.3.html
Change-Id: I855b3310ae9111ddf48c13c26b9eb496c200accb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3554
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2020-12-28 23:09:21 +00:00
Adrien Destugues
99f2b96894 elf.h: add some missing defines
Needed for ghc.
2020-12-28 22:20:43 +01:00
Jérôme Duval
1f8a8d2b48 boot/bios_ia32: basic support la57 aka 5-level paging for x86_64 kernels
la57 kernel support is required. we simply add a 5th level and enable the cr4
feature. the safemode option "256tb_memory_limit" is named after the 4gb one,
but the current support is limited to 512GB as before (this can be later extended).

Change-Id: I922774473c4a6112a0e4ff74162285ad58aa53af
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3552
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-12-28 18:21:11 +00:00
Alexander von Gluck IV
569564c02d efi/dtb: Find potential FDT on UEFI
* Makes our UEFI bootloader somewhat FDT/DTB aware on all
  architectures.
* Will report when an FDT is found, and provide it to kernels
  that want it.

Change-Id: I90324fc0579a9c835e60568fa9b654c2df0aba27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3543
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-23 13:51:25 +00:00
Fredrik Holmqvist
da93a24811 efi_guid struct gets equals, simplify EFI acpi_init
Change-Id: Id4bc985dc1e6f44b594f6ca5dabd3fdac8e1cac2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3545
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2020-12-22 22:12:13 +00:00
Adrien Destugues
8a72ba1b54 Tracker: improve algorithm to decide desktop text color
Fixes #16673
2020-12-19 10:17:55 +01:00
X512
553f3f2309 AutoDeleter: add delarations for common types and destructors
Change-Id: I74b75a54038d5af370696302f33b5c0abab4820c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3481
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-13 19:14:13 +00:00
X512
84b1893b73 AutoDeleter: introduce HandleDeleter
It allow to use arbitrary handle type, null value and destructor function.

Change-Id: I87c444cb7ef1b08d1dbed7fe4171700171d651d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2977
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-12-13 19:14:13 +00:00
Anarchos
74b6097078 sd/mmc: read, naive method
First implementation of reading sectors from an SD card.
This is not the best performance for many reasons:
- No DMA
- Reads only one sector at a time
- Cannot read more than 512 bytes per syscall

Also there are major limitations:
- Cannot read less than 512 bytes. The hardware of course works in full
  sectors. The mmc_disk driver should go through the io scheduler to
  make sure requests have a reasonable size and offset, and nothing
  tries to read just a few bytes in the middle of a sector.
- SD cards only (no SDHC, no MMC)

Architecture problems:
I think too much of the implementation is done in sdhci_pci and should
be moved to the upper layers. However it is difficult to say without
having implemented DMA (which indeed will be at the low level of the
sdhci controller). It doesn't help that the order of operations is a
bit different depending on wether there is DMA or not. In DMA mode you
first prepare the buffer, then run the command. In non-DMA mode you
first send the command, then read the data into the buffer. We need an
API at the mmc_bus level that doesn't care about that low-level detail.
There are other things that the MMC bus should be doing however, such
as switching to different clock speeds depending on which card is
activated and how fast it can go.

At least the following should be done:
- The read method for mmc_bus and sdhci_pci should use a scatter-gather
structure as a parameter instead of a single buffer
- See if can be integrated into ExecuteCommand at sdhci level (it's
essentially a command with an additional data phase)

Change-Id: I688b6c694561074535c9c0c2545f06dc04b06e7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3466
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-13 18:56:19 +00:00
Adrien Destugues
e46898932c Initial work for the mmc_disk driver
No read and write support for now. But we implement getting SD card
capacity. SDHC is not supported yet (it uses a different layout for the
CSD register which will be rejected by this version of the code)

Change-Id: Ife844a62f3846c0a780259e9a3a08195e2fd965e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1068
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-13 18:56:19 +00:00
Andrew Lindesay
5b1ae51c6b HaikuDepot: Memory Leak Fix
Change-Id: Ibd311d10009484ba834843149740c5a11f283202
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3500
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2020-12-13 10:07:22 +00:00
Adrien Destugues
5b627acb33 Build fix.
Desynchronisation between fs_shell and normal autodeleter files
2020-12-10 18:01:22 +01:00
X512
76ab85671d AutoDeleter: fix AutoDeleter size
C++ don't allow zero size class fields. If field with empty class field
is used, it's size will be 1 byte.

Create DeleteFunc instance as local variable at each use instead.

Fixes #16638.

Change-Id: Ifb76c45ea02e9fed014751542ee5f16f41e11d15
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3458
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-10 11:39:49 +00:00
X512
aecba91311 AutoDeleter: move destructor function in MethodDeleter from constructor to template argument
The same as CObjectDeleter.

Change-Id: I85c4cb3635f01f13e529ca087324cc2fcb42cfc0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3456
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-10 11:39:49 +00:00
X512
7d775e7925 AutoDeleter: move destructor function in CObjectDeleter from constructor to template argument
It allows to make typedef of pointer types and declaring pointers in headers.

Store of destructor function pointer in CObjectDeleter is no longer needed.

Change-Id: Ic629fd10b28b09f4190edf8ba6b911ca3108ab0e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3455
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-10 11:39:49 +00:00
Alexander von Gluck IV
9adc70887e efi: Call console-control to enter text mode
Change-Id: Ife1df3415bc5a31801bcb3d925f1b7c3a105f51b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2250
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-07 11:32:28 +00:00
Adrien Destugues
a959262cd0 implement mlock(), munlock()
Change-Id: I2f04b8986d2ed32bb4d30d238d668e21a1505778
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1991
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-12-03 07:58:05 +00:00
Jérôme Duval
c5ff1f14c6 syslog.h: add LOG_PRIMASK and LOG_PRI macros
Change-Id: I9ae0c3165cea831e329e49211ff738cbb89a65de
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3408
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-22 09:28:57 +00:00
Jérôme Duval
2982d9819f fcntl.h: define O_DIRECT directly
coreutils wants to undefine O_NOCACHE, this shouldn't affect O_DIRECT though.

Change-Id: Id00316a78eb91b2c7f692bb46eca65b3a7983c6f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3398
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-20 18:23:35 +00:00
Murai Takashi
cb5156f081 LayoutBuilder.h: Fix use after free
Fix 'item' is used after delete.
Pointed out by Clang Static Analyzer.

Change-Id: I8eca3084c97b37015a2da1b96119a458d4eb9aa7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3392
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-11-19 07:17:29 +00:00
Jérôme Duval
a1999d3b8a POSIX: add tcsetsid()
Change-Id: Ia8f41e417379dcaf4f976933cf91bb2de157bc72
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3376
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-17 07:53:28 +00:00
Jérôme Duval
e04970ad6f POSIX: add utmpx.h and function stubs
OpenJDK 14 assumes symbols and headers are available.

Change-Id: I21038e92afcfd2000ee95712bce874afd29611b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3371
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-17 07:46:30 +00:00
Andrew Lindesay
027d608682 HaikuDepot: LRU Cache for Icons
Only keep a fixed number of icons in memory at once.

Completes To #15370

Change-Id: I23e3a4fa7559894034f45afb3b536910ea037078
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3367
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-11-15 20:16:14 +00:00
Jérôme Duval
a9c09fcaae POSIX: lseek: support SEEK_DATA and SEEK_HOLE constants
this is queued for issue 8: https://www.austingroupbugs.net/view.php?id=415
this implementation calls the ioctl hook of the filesystem with BSD-like constants
FIOSEEKDATA and FIOSEEKHOLE. if the hook doesn't know the constants, we use the stat size
to return the last hole (as proposed in the draft spec).

Change-Id: I5d052eed87e29b70491a7ff534e244896469d03e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3385
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-12 10:42:11 +00:00
Jérôme Duval
fe357eb9c9 POSIX: add posix_fallocate and a preallocate syscall
the preallocate syscall will call the preallocate filesystem hook, if available.

fix #6285

Change-Id: Ifff4595548610c8e009d4e5ffb64c37e0884e62d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3382
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-11-12 10:41:21 +00:00
Jérôme Duval
b05d6f0af0 POSIX: asprintf and vasprintf are BSD/GNU extensions
fix #16259

Change-Id: Ia16bb6e1944b87b25d1a940bbdaaf6e236db1abf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3381
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-07 08:49:34 +00:00
Jérôme Duval
6878792ae4 C11: add aligned_alloc()
Change-Id: If648c0e27ed946874d393e8e33a4548b70c8ecdb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3377
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-04 21:01:42 +00:00
Jérôme Duval
b48159dce2 POSIX: add tcgetsid()
Change-Id: If58141b4e56b7fe444460b6808e33abc5ea71f37
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3374
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-11-04 06:18:17 +00:00
Jérôme Duval
7335fb0d5c in6.h: declare in6_addr with a union and extra fields
According to https://tools.ietf.org/html/rfc3493:
3.2 IPv6 Address Structure
"The structure in6_addr above is usually implemented with an embedded
union with extra fields that force the desired alignment level in a
manner similar to BSD implementations of "struct in_addr"."

Change-Id: Ibe0ee685366398c143cdf9573dcb77566a12888b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3348
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-10-23 08:13:03 +00:00
Jérôme Duval
d504f219f4 POSIX: add _SC_TTY_NAME_MAX
Change-Id: Ifa24f68535d7a4a4c5fe3f01e63fe2c87adcc429
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3340
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-10-23 07:08:03 +00:00
François Revol
ad22267906 m68k: Add missing disklabel.h for NeXT support
Currently used by fixup_next_boot_floppy.

Change-Id: I47c10657b5280f00e470a3171ad11744859ce76c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3310
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-12 06:36:15 +00:00
Leorize
e67a4284c0 libbnetapi: Disallow instantiation of BUrlRequest subclasses directly
This API change forces all creation of BUrlRequest to be done via
BUrlProtocolRoster::MakeRequest(). This allows the structure of protocol
addons to be altered without breaking ABI for client applications.

Change-Id: I1785c9136c50d19eaa9e57cb9d259ed8d88a5b56
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3080
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-10-12 06:36:00 +00:00
Adrien Destugues
62eaf4c0e1 mmc_bus: add execute_command function
For now it just forwards the command to the SDHCI controller.
The bus will gain more features and functions as work advances (tracking
which card is active, arbitration of DMA transfers, etc).

Change-Id: I094eb84f27e7789387a3f8fb65fba1e5fcfa3e8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3094
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-10-11 16:02:22 +00:00
Adrien Destugues
dedbe94e46 mmc: register devices for detected cards
Change-Id: I90891ead9a425e0e8bd25c2190fe3d430d49411b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1067
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-10-11 16:02:22 +00:00
John Scipione
7c095f4709 BeControlLook: Fix app integration drawing issues
Update BTab::DrawTab() to pass the current index, the index of the
selected tab, and the index of the first and last tabs into
BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab().
This allows you to draw tabs differently in your BTab or BControlLook
subclass in many different circumstances.

Modify BControlLook API to add indexes to DrawActiveTab() and
DrawInactiveTab() like so:

void DrawActiveTab(..., int32 index = 0, int32 selected = -1,
	int32 first = 0, int32 last = 0);
void DrawInactiveTab(..., int32 index = 0, int32 selected = -1,
	int32 first = 0, int32 last = 0);

These extra indexes are not used by HaikuControlLook which relies only
on if the tab is active or inactive to draw.

Add IndexOf(BTab* tab) method to BTabView and document it to get the
index of the current tab in BTab::DrawTab(). Also add a warning in the
BTabView::DrawTab() method not to use the position and full parameters
anymore, use BTabView::IndexOf(), BTabView::Selection(), and
BTabView::TabCount() to get the info you need.

Using a dynamic_cast to a BTabView in BeControlLook to determine if the
view is derived from a BTabView didn't work in the case of WebPositive.
Furthermore, WebPositive does custom tab drawing which needed to be
updated for alternative control look. These index parameters passed from
BTab to BeControlLook allow us to draw the tab like BeOS without relying
on a dynamic_cast to BTabView to get the info.

Reproduce the functionality described above for BTab in WebPositive's
custom tabs. Eliminate no longer needed code in favor of using indexes.
Update WebPositive custom tabs to use BControlLook::DrawTabFrame()
instead of BControlLook::DrawInactiveTab() matching the update made in
BTabView.

In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive
doesn't draw any tab background, so it expects this work to be done for
it.

Eliminate hasFrames variable from WebPositive.

Rename TabSelected(index) to UpdateSelection(index) in WebPositive to
better reflect its purpose.

Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more
selectively. Only draw border if left border is set for top and bottom tabs
or top border is set for left and right tabs. Undo no longer needed frame
manipulation border drawing workaround in HaikuControlLook::DrawTabFrame().

Draw scroll bar triangle without using DrawArrowShape().

Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in
BOutlineListView and menus distinctly from how it draws arrows in scroll
bars. Draw our distinct arrows in DrawSrollBarButtons() instead.

This fixes overflow of time edit up-down arrows in Clock prefs and the
collapse-expand arrow in Deskbar not being vertically centered.

In DrawBorders() only inset if we actually draw the border.

Fix alignment issues with DrawSliderThumb dots for example in
MediaPlayer volume knobs.

Draw using line arrays calling AddLine instead of StrokeLine in
several places.

DrawMenuBar() extends to draw final pixel which eliminates an extra
lines at the end of menu bars.

Truncate button labels better fixing a few issues for example keymap
keyboard layout button labels. Button insets has been updated a bit
to fix drawing issues with buttons missing a border.

Using a dynamic_cast to a BButton to determine if a view is a button
in BeControlLook didn't work in the case of the keymap label. Look for
B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel()
to draw the label inverted on click. Pass the B_FLAT flag from Keymap
keys when drawing using BControlLook so that the label is inverted.

Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-11 15:50:18 +00:00
Augustin Cavalier
64b46b706b headers: Adjust GCC2 stdbool to be usable by modern GCC.
musl's allocator needs to be built with GCC 8, but we need to link
it into GCC 2 libroot, which uses GCC 2 headers.
2020-10-10 16:36:59 -04:00
Jérôme Duval
06ed32b8c4 BCursor: add a constructor with bitmap and point
* enhancement #15169
* get_mouse_bitmap(): also reads the colorspace from app_server.
* docs and tests

Change-Id: Iba63f8a2789530ae596c30b92f14828f31761d98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3292
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-08 08:23:31 +00:00
Jérôme Duval
db9d2a6f14 POSIX: add dprintf
Change-Id: I577d5283a9be04924a8dd05c3be3969b41da60db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3282
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-04 19:34:40 +00:00
Jérôme Duval
513955e6c0 GraphicsCard.h: remove declarations for dprintf and set_dprintf_enabled
Change-Id: Ie8bbfcf2f23cf0ee36dc74e76062f21c99effc96
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3281
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-10-03 11:52:37 +00:00
Jérôme Duval
64331e96ca kernel/x86: extend CR4 flags
Change-Id: I4861f6cd61d0daeeb2403d07e703b83cd6a00666
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3280
Reviewed-by: Rene Gollent <rene@gollent.com>
2020-10-02 17:12:06 +00:00
Alexander G. M. Smith
a22fa0c977 package kit: Add pre-uninstall scripts feature.
Just like post-install scripts which run shortly after a package is
installed, pre-uninstall scripts are run just before a package is
removed.  Implements enhancement #13427

* Fix script exit code handling vs script launch errors.
* Bump package and repo file version numbers due to new attribute,
  unfortunately makes new .hpkg files not backwards compatible.
* Add pre-uninstall functionality, mostly cloning the post-install
  except in a few places.
* Discover that _RunQueuedScripts() is never called, a future TODO:?
* Update package documentation for pre-uninstall scripts, and use of
  the boot/post-install directory.

Change-Id: I45596255ce74bc102f6e5b606cbf83e4e4347a17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1504
Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-21 10:47:57 +00:00
CodeforEvolution
5c32512076 GNU Compatibility: Implement qsort_r
This is a version of the qsort function allowing you to pass a "cookie" to the function.

Change-Id: I60c645213b9c9590e38b112634fcac1d7969b6d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2449
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-18 06:25:20 +00:00
Jérôme Duval
e632208b79 kernel/scheduler: enable cpu load tracking after boot
when the cpufreq module is loaded, we let the scheduler update its policy.
Improve assert report
CoreEntry::GetLoad() could return more than kMaxLoad.

Change-Id: I127f9b3e8062b5996872aae30b4021b9904fa179
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3216
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-17 15:45:25 +00:00
Alexander von Gluck IV
0558674126 efi: fix pointer width on non-64-bit platforms
Change-Id: I041238af87df3e1e3a967216685413801fd49877
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2450
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2020-09-17 13:58:55 +00:00
Jérôme Duval
357b9d3cbb x86: identify Hygon vendor
it's a Zen-based CPU: rely on AMD support code.

Change-Id: Ia980a42457575bf8d1130d813310a285bf137691
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3217
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-15 20:43:45 +00:00
Jérôme Duval
7c1bcc9cae kernel/x86: add MSR for HWP and extended CR0 flags
Change-Id: I9e5d5421dabbdf7d4ecf6334509178f8f892591f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3215
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-15 20:43:17 +00:00
Jérôme Duval
22fdfc4428 kernel/cpu: add cpu_frequency()
implement on x86 with APERFMPERF.

Change-Id: Ia484854c76dee76c5447983de15800a25d791d39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3213
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-09-15 20:42:14 +00:00
Jérôme Duval
026c8b9c04 kernel/smp: add call_single_cpu()
to call a function on the target cpu. Early mechanism not available.

Change-Id: I9d049e618c319c59729d1ab53fb313b748f82315
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3212
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-09-15 20:42:14 +00:00
Jérôme Duval
eb7ac342a0 kernel/x86: detect power subfeatures
Change-Id: Id159f0d7fc7816b6a40b9cf28f53dfdbebd04a73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3211
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2020-09-14 19:24:25 +00:00
Adrien Destugues
a52008cb44 tty: implement TCFLSH to flush buffers
This is probably incomplete. Is locking needed? Should we notify the
next writer (if any) that the port is writable when flushing the output?

Change-Id: I2566e2d036a61af4819894a44f57603179aa27df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2516
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-14 13:35:23 +00:00
John Scipione
fe88ae51ec AppKit: BMessage Add/Find/Get/Has/ReplaceNodeRef
This allows you to pass node_ref's around like you can entry_ref's.

Added node_ref_flatten(), node_ref_unflatten() and node_ref_swap() to
MessageUtils. These are close cousins to entry_ref_flatten(),
entry_ref_unflatten(), and entry_ref_swap() but for node_ref's.

Added B_NODE_REF_TYPE to TypeConstants.h in the Support Kit.

Added B_NODE_REF_TYPE to Debugger and ByteOrder in Support Kit,
B_NODE_REF_TYPE is treated the same as a B_REF_TYPE (entry_ref).

Add documentation for new NodeRef methods and B_NODE_REF_TYPE.

Change-Id: I32c6ed276bf1a7894a835b9fc9de5a882c35883c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3182
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:18:09 +00:00
Preetpal Kaur
02ad22d6c8 Input: declare BString to get the Mouse Name
Change-Id: I3476f58839202a6fd8c93e325a15045963a9b7b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3125
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
Preetpal Kaur
37d793236c Added get_set_mulitple_mouse_type() functions
Change-Id: I95f85a15a77c3a548bb672cb966ae7b13fcefcc8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3127
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-10 17:15:09 +00:00
John Scipione
d9385a9d38 IK: align BTextView text rect/fix alignment
Recalculate line breaks in FrameResized() if word-wrap is on, otherwise
only move the text rect into position. StyledEdit was recalculating line
breaks before on resize (we have to in this mode) and the frame offset
updates for non-wrapping text views are inexpensive. This makes resizing
text view's work like StyledEdit everywhere.

Scroll to cursor when word-wrap setting changes if text view is editable.
If you are viewing a long document changing word-wrap can move the cursor
quite far, so scroll back to it.

Fix _ActualTabWidth() pen location for right and center-aligned text views
so that tabs widths are calculated correctly.

Reset fTextRect horizontal limits to bounds minus insets in
_RecalculateLineBreaks(), then grow fTextRect based on alignment when
wrap is off.

Fixing insets also fixes right and center-aligned BTextViews.
Left-aligned text view's grow right, right-aligned ones grow left,
and center-aligned ones grow out.

Make extra scrolling space for all aligned text views go the other way
from how it did in hrev24130 (and on left-aligned text view's too) so
that half the text is visible when you edit past the end or before the
beginnning of a text view instead of none of it.

Fixes #1651 #12608 #13796 #15189

Do not _RecalculateLineBreaks() if text view bounds are invalid.
In SetText() detect invalid text view bounds and resize the view to the
width and height of the first line. Then recalculate line breaks.
This fixes BAlert text view size issues.

Fixes #16481 (regression from hrev54496.)

Remove useless and heavy computation. There is no point in computing line
breaks for a 10px wide text view and it takes a long time because it needs
a lot of linebreaks. The view eventually gets laid out properly.

Fixes #5582 (which was not locale-related, after all.)

Only apply default insets if text rect is set to bounds. This ensures
that apps that manipulate the text rect can continue to do so without
the default insets interfering while apps that don't can benefit
from the defaults. If you want to set the text rect to bounds and
not use the default insets you must override the default by calling
SetInsets(). This prevent the default insets from being applied once
apps have changed the text rect fixing a bug in Icon-O-Matic where the
text rect insets were being applied incorrectly.

Fixes #16488 (regression from hrev54496.)

Reduce left and right insets inside text views from full label spacing
to half label spacing. Unify padding between BTextControl and BTextView.

Move fLayoutData->UpdateInsets() to private BTextView::_UpdateInsets()
because we need access to BTextView member variables when deciding
whether or not to add the default padding or not.

_UpdateInsets() changes:
* Don't update insets if BTextView::SetInsets() was called.
* Don't add default insets unless fTextRect is set to view Bounds().
* Do not set the right and bottom insets to left and top if negative,
  set them to 0 like we do to left and top -- DeskCalc bug otherwise.

Fixes #15688

Other BTextView fixes:
* Replace max_c and min_c with std::max and std::min respectively.
* Remove scrolling from one instance of BTextView::SetText() as it
  produced undesired results while editing a scrolled text view.
* Add default insets in _UpdateInsets()
* Fix scrolling when entering and deleting text so that some part of
  the text is always visible. Make visible scroll width depend on font
  size.
* Allow scrolling to a negative offset in x but not y. This allows you
  to scroll the entire contents of right and centered-aligned text views
  whose content does not fit in the box.
* Change _Refresh() to take an offset instead of a bool so that you can
  scroll to any offset.
* Replace TextLength() with fText->Length() in a couple of places.

TextControl changes:
* Set text rect in BTextControl::DoLayout().
* Remove AlignTextRect() from TextInput.

Fix the following problems in apps:

ScreenSaver: Set text rect in PreviewView::AddPreview().
Tracker: Set "Edit name" text view insets to 2. Tweek text rect position
  to be on top of label in icon, mini-icon, and list mode. Add a TODO that
  the text rect is a pixel off from the name on some files.
Mail: Remove _AlignTextRect() and FrameResized() from AddressTextControl.
  Use default insets on the text view, defaults are fine here.
DeskCalc: Set insets based on font size in ExpressionTextView
  SetTextRect() instead of manipulating the text rect.
  Remove _CheckTextRect() and related methods from InputTextView.
Icon-O-Matic: Remove _CheckTextRect() and related methods from InputTextView.
WebPositive: Remove _AlignTextRect() and FrameResized() from URLTextView
  and call SetInsets().
StyledEdit: Word-wrap and FrameResized() changes ported to BTextView.

Fixes #16476 #16480 #16488 (regressions from hrev54496.)

Change-Id: Ifeca6077f8815ccd86d5a3880f99556298aaf0fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3152
Reviewed-by: John Scipione <jscipione@gmail.com>
2020-09-07 22:10:36 +00:00
Niels Sascha Reedijk
331889d067 Kernel/Threads: remove limit on number of dead threads in a team
When a thread is created, it is expected that some other thread (usually the
creating thread) will want to make sure it completes. This is done using the
pthread_join() or wait_for_thread() calls.

It is possible that threads end before another thread waits for its completion.
That's why there is a dead thread list for each team, which holds thread ids
and their exit status so that a call to pthread_join() or wait_for_thread() in
the future can complete succesfully.

The dead thread list was limited to 32 threads per team. If there would be
more, the oldest thread would be kicked off. This could cause issues in
situations where a team would create more than 32 threads, and would start
waiting for their result after they have finished. Some of the calls would fail
because the threads would no longer be in the dead list.

This specifically caused problems for cargo (the Rust package manager), which
could depending on the number of dependencies, could create more than 32
threads. See: https://github.com/nielx/rust/issues/3

This change removes the limit of dead threads within a team. Note that there is
a risk that a badly written program that does not detach or joins its threads
can make this an endless list, but the impact is relatively small (dead threads
only occupy a bit of kernel memory).

Change-Id: I0135dd54e10ee48a529f23228d21237d4f1a74e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3178
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-09-01 21:04:46 +00:00