Commit Graph

9591 Commits

Author SHA1 Message Date
Fredrik Holmqvist
48eb7d981d Allow gcc to know result is aligned
Someone on the internet found out gcc only understand posix_memalign.

The alloc_align attribute may be applied to a function that returns
a pointer and takes at least one argument of an integer or enumerated
type. It indicates that the returned pointer is aligned on a boundary
given by the function argument at position.

Change-Id: I4b0af6ef3020da1fb460652117286193d5d72f1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4514
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-10-14 16:19:18 +00:00
Alexander von Gluck IV
3e8376c6dd arm64: Add missing fdt storage for FDT bus
Change-Id: Ifadd47204be1ec688017a567d43dca38c80bd1df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4431
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2021-10-12 13:55:53 +00:00
X512
5ab0674c38 kernel/arch/riscv64: fix crash on userland thread exit
Set first stack frame return address to
<commpage>commpage_thread_exit, so it will be called
when thread entry point returns.

Change-Id: Ide5cde8d4501eb7241e03ff4052174e984e78870
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4493
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-10-11 17:38:20 +00:00
Adrien Destugues
fb5c24d812 MediaAddOn: missing const
Pretty much all add-ons are setting this to point to a const string, so
we should make sure that nothing tries to modify it.
2021-10-09 16:38:46 +02:00
Adrien Destugues
857c79a6b8 Introduce symbol_visibility.h with macros to define hidden functions
These were used in function_remapper.cpp but can be used elsewhere too,
so move them to a private header. Also use them for the stack protector
hidden function definition (probably not so useful since gcc2 doesn't
support using the stack protector anyway?).

The gcc2 way to make a symbol hidden is to manually generate the .hidden
directive in the assembler output. This is not perfect: it is hard to
use for C++ functions and methods (manual mangling of the name is
needed), and inline assembler can only be inserted inside functions. But
the alternative is patching gcc2 to add support for the function
attribute, and I don't want to dig into that today.
2021-10-09 15:03:36 +02:00
Adrien Destugues
2ac7dbb046 Remove libc++
This is an old version of libc++ that was imported in an early attempt
of building Haiku with clang. It is currently not used for anything. In
fact there never was a Jamfile to build it.
2021-10-09 11:04:22 +02:00
Alexander von Gluck IV
b9b2a1dcd2 radeon_hd: yolo add navi chipsets
* PCI ID's from Linux
* There are a bunch of NAVI quirks around 3d rendering pipelines
  but not many around modesetting (which is the only thing we care
  about)

Change-Id: If63e31fe1d37d9d95f2a71c222a4cda7a2914a5e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4467
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-10-05 21:13:46 +00:00
Augustin Cavalier
7aa5574713 kernel & addons: Build with the non-legacy GCC even on x86_gcc2h.
Only one code change: for some reason, GCC chokes on the cr3 functions
as macros (throwing errors about invalid registers.) The BSDs have them
as inline functions instead, so they are converted to that here.

Tested and working. There seems to be about a 10% decrease in CPU time
on some compilation benchmarks that I briefly tried.

Change-Id: I31666297394d7619f83fca6ff5f933ddd6f07420
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4515
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-10-02 18:29:40 +00:00
Rudolf Cornelissen
fe8f9e2326 intel_extreme: set B_SCROLL, share current mode. Cloning and BWindowScreen now work OK. 2021-09-27 10:19:43 +00:00
Jérôme Duval
bb187c91d8 interface: add colorspaces support for RGB48 and RGBA64
these colorspaces are packed as RGB or RGBA, not BGR or BGRA.
RGB48_BIG and RGBA64 only differ in the endianess of the channel the 2-byte value.

this is a big difference with RGB24_BIG and RGBA32_BIG, in which case _BIG
means the order is RGB (BGR) and not BGR (BGRA).
BGR48, BGRA64 could indeed be added, if needed.

I chose 0x11 and 0x12 arbitrarily, but given the order of channels 0x1011
and 0x1012 might make more sense. This would mean using another bit for "real"
bigendian colorspaces.

Only the color conversion to 32-bits is implemented.

Tested with the RAWTranslator modified to output 16bpp with success.

Found some references in enum AVPixelFormat in libavutil/pixfmt.h.

Change-Id: I4b023dec85d01f1e63e1b053139e5bb5d263a0e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4468
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-09-27 07:21:27 +00:00
Rudolf Cornelissen
96c8657d24 intel_extreme: fix haswell virt display scroll/pan, ticket #17261 2021-09-17 23:46:00 +00:00
Augustin Cavalier
744f487bc5 headers/libs: Remove expat headers.
We now have an expat build feature that uses packaged headers instead.
2021-09-17 16:26:06 -04:00
Augustin Cavalier
80519e78aa bootloader: Clarify comment in text_console.h.
The following colors are "foreground colors only" not "foreground colors,
only if".
2021-09-17 15:36:57 -04:00
Augustin Cavalier
5e2d0005c1 libroot: Fix previous commit. 2021-09-17 15:35:51 -04:00
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