Commit Graph

64111 Commits

Author SHA1 Message Date
Augustin Cavalier
00f1e7c5e4 kernel: Rework iovec copying from userland.
Create a utility function which performs all necessary checks,
allocates memory, and copies the structures, and then make use of it
in the three places in the kernel which did all this manually.

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

Part of #14961.
2022-06-03 16:32:11 -04:00
Augustin Cavalier
e52da6c73b kernel/fs: Invoke the new is_user_address_range on more I/O buffers.
We do not access these buffers directly here but pass them deeper
into the kernel, where they may be used in IO operations that do
not invoke user_* functions at all, so we have to validate them fully here.

Part of #14961.
2022-06-03 16:15:47 -04:00
Augustin Cavalier
77694f9225 kernel: Move validate_user_memory_range to kernel.h and rename it.
It has more general use than just in the VM code; basically anything
which receives buffers from userland should be invoking this if it
does anything besides user_memcpy (which alreay does it.)
2022-06-03 15:35:17 -04:00
Augustin Cavalier
3e9b842151 freebsd_network: bus_dmamap_load_mbuf_sg is always NOWAIT.
This matches FreeBSD.
2022-06-03 13:57:10 -04:00
Augustin Cavalier
04d2f987a6 freebsd_network: Put extern "C" in front of all public busdma functions.
Should catch the problem the previous commit fixed earlier.
2022-06-03 13:56:38 -04:00
Augustin Cavalier
92d0fd610b freebsd_network: Fix definition of bus_dma_tag_create.
Fixes the build under 32-bit.
2022-06-03 13:55:50 -04:00
Augustin Cavalier
9a6815fbfa freebsd_network: Adjust copyright headers in two files.
These were completely rewritten by me some years ago and contain nothing
from Hugo or Colin anymore.

Change-Id: I07f95b79c08f93b7630f73b6ff60634e3fc95599
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5353
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-03 17:39:59 +00:00
X512
b69a359e11 freebsd_network: implement missing generic bus access functions.
Change-Id: I9ed7b0f4187d659df798eac1d01c4f0e1f978e73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5352
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-03 17:39:59 +00:00
Augustin Cavalier
15253c90c3 freebsd_network: Retry dmamap loads with a bounce buffer in more cases.
Instead of just on ERANGE, also do it for EFBIG and other such errors.

Related to #17763 and #17766.
2022-06-03 13:13:14 -04:00
Augustin Cavalier
4eac62eb9f freebsd_network: Allow destruction of dmamaps with BUFFER_PROHIBITED. 2022-06-03 13:03:42 -04:00
Augustin Cavalier
cb7e50e0a3 freebsd_network: Propagate alignment restrictions from parent dma_tags.
FreeBSD does the same.
2022-06-02 22:24:34 -04:00
Augustin Cavalier
654b4f976b freebsd_network: Ensure BUFFER_PROHIBITED status is "sticky."
That is, do not reset it on bus_dmamap_unload.
2022-06-02 21:43:25 -04:00
Augustin Cavalier
d66ceb73f8 freebsd_network: Implement bouncing and address validation in bus_dma.
This has been missing since the rewrite in 26b95c15f2.

Until now it seems to not have been a problem since buffer sizes
were generally small enough and did not cross page boundaries due
to alignment guarantees. However, now that we have enabled jumbo
frames by default, some drivers do hit DMA limits without bouncing,
as these frames cross pages.

So, now we implement a basic bouncing system. Unlike FreeBSD which
maintains a global "bounce pages" cache that it pulls from,
we use per-dmamap bounce buffers, lazily allocated only if needed.
I tested this by forcing all non-"prohibited" dmamaps to bounce all
transactions, and the rtl81xx driver still worked that way (though
not all drivers may as they have expectations about contiguously
allocated memory never getting bounced.)

This should fix #17763. Hopefully it will also fix #17766 as well.
2022-06-02 21:08:26 -04:00
Jérôme Duval
6ba3c443a2 atheros813x: apply fix from OpenBSD
* 10fd7e3817
"Force maximum payload size to 128 bytes for AR816X/AR817x as it triggers"
* could help for #16978

Change-Id: I626e364adcabaa9b3d7e4c1078067c1d82c7d4e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5340
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-01 20:11:00 +00:00
milek7
748b488347 ACPI: Make it compile on architectures other than x86.
Change-Id: Ie72dd2c6a571234399dc99d3573a5de19252737e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5269
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-31 18:22:22 +00:00
Andrew Lindesay
409af93462 HaikuDepot: Fix Crash on Shutdown
The MainWindow itself was a BReferencable via a listener
virtual class.  It looks like the error has come from a
conflict between the MainWindow's own deletion and the
state of the reference count.  This change moves the
listener / BReferencable out of the MainWindow so that
the lifecycle of the BReferenable can be managed
correctly.

A further problem here is that the new listener
was leaked from the MainWindow class on shutdown.
To resolve this problem requires a considerable
change to the "process coordinator" system.

Fixes #17689

Change-Id: I7230843ba05537015f4a597b4a616b96c6db3dde
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5285
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Andrew Lindesay <apl@lindesay.co.nz>
2022-05-31 06:15:02 +00:00
Augustin Cavalier
26f691760c freebsd_network: Add missing segment size check to bus_dma logic. 2022-05-29 22:13:36 -04:00
François Revol
6f80a9801f Some script for a crude convertion from Hugo to Pandoc
I wrote this to make a print copy of my lenovo blog post.

Change-Id: Id39bfda3d95532a4049b58d9008b695f340513ed
2022-05-29 23:29:46 +02:00
PulkoMandy
54036160f5 EFI: Fix some mis-located files
These were output to the root of the generated directory. There should
be nothing there except the final Haiku image.

Fixes #16750.

Change-Id: I132de939c70197c3f7cc306ac371965a0b7f38b3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5346
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-29 18:54:30 +00:00
milek7
d5f2742d1f arm64: Preserve FPU registers in setjmp/longjmp and arch_context_swap.
Change-Id: If0ca2ecbfa45b663dab39d1e9cb2562f071c3b27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5268
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-29 18:51:32 +00:00
milek7
444980deb1 arm64: Implement setjmp/longjmp.
Change-Id: I9cd2d5de27a3b110b185c658e980428fe49392b0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5267
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: David Karoly <karolyd577@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-29 18:51:32 +00:00
milek7
e9d04b25e6 arm64: Add thread exit syscall in commpage.
Change-Id: Ia8e7e4626add623735fefefa1af151b7338adc35
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5265
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-29 18:51:32 +00:00
milek7
d1c3213a6d arm64: Add exception handling, handle pagetables access and dirty flags.
Change-Id: I751d78eb458da16098d236f3829d0c26540fbc17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5264
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-29 18:51:32 +00:00
milek7
78ea9ffc9b arm64: Implement kernel thread switching.
Change-Id: I87cca66ad89cfa85ba98a9ec828c5e357d7406b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5263
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-29 18:51:32 +00:00
Autocomitter
e4d6c87ca2 Update translations from Pootle 2022-05-28 08:14:56 +00:00
Augustin Cavalier
122765f7d9 tests: Fix build of CookieTest. 2022-05-27 17:03:37 -04:00
Augustin Cavalier
44604448de freebsd_network: Automatically switch to jumbo-sized MTUs if possible.
Unfortunately there is no way to ask if a device supports jumbo MTUs
besides actually activating it. But that's fine, because for now,
Haiku's own network stack does not actually support changing MTUs
at the device level! Probably that should be fixed, too, but that
is a problem for another day.

With preceding commits, this fixes #17728, and all BSD network drivers
will use jumbo frames if possible by default.
2022-05-27 17:01:41 -04:00
Augustin Cavalier
3ea7c99119 network/ethernet: Use read/write buffers for scattered I/O.
This solves a long-standing TODO about scattered writes returning errors,
which was not a problem before now because we did not actually support
jumbo-sized MTUs. But now we will, so create temporary buffers if needed
in order to be able to read/write data larger than one buffer's worth.
2022-05-27 16:59:40 -04:00
Augustin Cavalier
ca6a44c133 freebsd_network: Overhaul device read/write functions.
* In read, check that we actually have enough buffer capacity
   to read the next buffer on the queue. Otherwise return E2BIG.
   (This fixes data being silently discarded if the mbuf was larger
    than the passed read buffer, but that should not usually happen
    anyway based on MTU buffer sizing.)

 * In write, use m_get2 to get an appropriately sized mbuf (which may
   be up to 16K) instead of clamping all writes to the cluster size.

These changes are needed for jumbo-frames to be actually read and written
as one unit. However, they are not yet enabled, as more changes are needed
above this point both in ioctl() here and in the stack.
2022-05-27 16:42:07 -04:00
Augustin Cavalier
3ed5041315 freebsd_network: Fix SIOCSIFMTU handling in ether_ioctl.
We cannot set anything below ETHERMIN nor greater than ETHERMTU here,
because we do not know what capabilities the driver actually has.
(The driver will have already caught and handled this ioctl if it
supports something more than the required minimum.)
2022-05-27 16:37:23 -04:00
Augustin Cavalier
41faeb1df9 net_interface & datalink: Fix MTU handling.
The device is what actually controls the MTU, and it has its own
field for this, so having a second one just meant the MTU never
got updated after startup.

Remove the "mtu" field from the interface, use the "device->mtu" directly,
and then actually invoke device->module->set_mtu when updating.
2022-05-27 16:36:12 -04:00
Mashijams
05cb1b0e05 Filesystem : move crc files to shared folder
Moved crc32.c, CRCTable.cpp, CRCTable.h from ext2, and crc_table.c from the UDF filesystem to shared directory

Modified Jam files to use these files from shared directory for ext2 and UDF filesystem

Change-Id: Ie2c79ce0a3ec7d1ea497e725a288c31528dcaa86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5343
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-05-27 17:12:06 +00:00
Jérôme Duval
a8db4bae55 libroot: system() should ignore SIGINT, SIGQUIT while waiting
https://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
Change-Id: Ic9919e403fb4e6ee4406b0c33789fe8b00b22d1f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5341
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-26 18:48:02 +00:00
Adrien Destugues
4b0d8831c2 HaikuBook: better doc and example for BList::DoForEach
The description of the callback function was still quite confusing. The
main usage for the return argument from the callback function is not
handling failures, but knowing wether the function did something in the
list or not, and stopping the iteration if only one item was looked for.

Add an example use of the function return value to implement a linear
search in the list and remove the note about the function "failing",
which is not what this parameter was meant to do (and I think that lead
to the initial inversion of "true" and "false" values.

Change-Id: If8cae8b8ee21ced2c899aef6033a89ab8dbf1621
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5339
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-26 07:49:01 +00:00
Jim906
f7eda03757 WebPositive: Don't display '...' icon when empty
* Conditionally add/remove fOverflowMenu to BookmarkBar when window
  is resized or a bookmark is added/removed.
* Improve handling of large window size changes (e.g. zoom button)
  which require moving multiple bookmarks to/from fOverflowMenu in a
  single call to FrameResized.
* Fixes #17616.

Change-Id: Id3e991167ec8d7aa540dd0644749cad1612de293
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5324
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-05-26 07:42:49 +00:00
Augustin Cavalier
27f95c84d7 drivers/audio: Adjust physical memory mapping after recent VM changes.
Fixes more KDLs.
2022-05-25 12:32:51 -04:00
Augustin Cavalier
aef561c99a AHCI: Adjust memory allocation after recent VM changes.
Fixes #17758.
2022-05-25 12:32:17 -04:00
Alexander von Gluck IV
6ec74693c7 docs/develop: Document how to build source hpkgs
Change-Id: I86a6cef5773c543e1b46d85091b9e73a7e3c016c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5342
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-05-25 12:48:27 +00:00
Dale Cieslak
143253c873 DeskCalc: Fix Locale-aware display
Expression parser was made aware of Locale-specific separators in
hrev56067. However, the Expression view was still using only '.' as
separator. This change passes the Locale-specific decimal separator
to the ExpressionTextView class and uses that to parse the value for
display.

Fixes #17754

Change-Id: I7386eed51afe929a9b3eee69334f9199a3d06c4a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5338
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-25 06:22:21 +00:00
Trung Nguyen
956f45070d kernel/vm: Remove default kernel read/write flags
`fix_protection` will not apply `B_KERNEL_READ_AREA` and
`B_KERNEL_WRITE_AREA` by default.

Kernel drivers that directly call `create_area` or `create_area_etc`
and do not pass any protection flags have been updated to
apply `B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA` instead.

Bug: #17751
Change-Id: I43e7ee6b5396e0309cdcff750e28262942c6d01c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5330
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-24 16:37:29 +00:00
Jérôme Duval
9e991b61fe intel_extreme: switch FDI to i915 register naming
Change-Id: Ib7382240a2bc07dbbd2aed7647b06f14a6c5cb4c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5335
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-24 15:52:46 +00:00
Jérôme Duval
59ce1ffe61 intel_extreme: check internal crt feature in VBT for analog probe on DDI
* also uses the BAR size when dumping regs (as done by the intel_reg tool).

Change-Id: Ie29768afc8f9c42bb9a03b2866db34c4b0e43b7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5334
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-24 15:52:46 +00:00
Jessica Hamilton
5e5bb3318e BStringList: update DoForEach to abort the iteration early.
* This matches `BList::DoForEach`, and the passed in function
  was already returning a boolean, but was not used.

Change-Id: Ifac94734b6181663726cb7aaa7966c5c0ca59bc8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5337
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-24 04:35:46 +00:00
Jessica Hamilton
a0a83410c4 docs/BList: fix DoForEach to match BeOS.
* The function passed to `DoForEach` returns `true` to terminate
  the loop early

Change-Id: If445836b14c44b981d169564e7beab8c0ecac36f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5336
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-24 04:35:46 +00:00
Andrew Lindesay
7d137fd96a HaikuDepot: Issue with Version Dates
Resolves an issue where package version dates are not
updated in the UI as they are updated in the model.

Change-Id: Ic21954f91abb9c6f9bf0907500e189215adb70de
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5333
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2022-05-23 20:25:23 +00:00
Pascal Abresch
eb9ff8e5a7 libtracker: Fix Tests.cpp compilation
Change-Id: I5a738e71a92846cfe7cc46727be65ff0f57d4c39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5328
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-21 14:54:29 +00:00
Autocomitter
193c594405 Update translations from Pootle 2022-05-21 08:14:41 +00:00
Alexander von Gluck IV
ea166fa97e build/repo/riscv64: Bump python to 3.9.1, add libffi
Change-Id: I2f15f2ce856fa8c6a105cdb09efe9da90694bb50
2022-05-20 22:31:01 -05:00
Alexander von Gluck IV
f8ef244100 system/riscv64: Use dtb-based time cv for system_time
* Fixes speedy-system_time in qemu

Change-Id: I07ae4d984c09f2f2503bd45acc415c219f3b3f11
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5327
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-05-20 21:54:45 +00:00
Augustin Cavalier
6c675bab59 XHCI: Defer writing the cycle bits for the "wrapping" link TRB.
There is already a comment above this that some controllers choke if the
target of a link TRB is invalid, and thus to not write the cycle bit
of the link TRB until said target is valid, but we did not follow that
when writing the link TRB to go back to the beginning of the ring.

Also put in a memory_write_barrier before writing the cycle bits,
just to be sure.

Tested in QEMU. May help with errors seen in #17749.
2022-05-20 17:32:17 -04:00