Commit Graph

60257 Commits

Author SHA1 Message Date
PulkoMandy
cdbda49e88 sparc: fix openfirmware entry point.
According to the IEEE standard documentation, the OpenFirmware entry
point should be in %o3. But that doesn't work, and both FreeBSD and
NetBSD expect it in %o4 (5th argument of the function). I suspect this
was changed for 64bit sparc, but neither the sparc nor 64bit
openfirmware specs mention it.

Move the sparc and powerpc specific parts out of the generic start.cpp
for openfirmware as they each have some specificities. More
specifically:
- sparc already clears bss for us
- entry point arguments are different
- determine_machine is of course platform specific

Change-Id: Icaa05087e88ea4d29198e3565223459aed75cdf9
Reviewed-on: https://review.haiku-os.org/c/1470
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-25 18:16:35 +00:00
PulkoMandy
906c14da63 sparc: use generic w_sqrtl.c implementation.
I accidentally imported a newer version of the file that does the same
thing as the existing one.

Change-Id: Ifab3b24218f017cc57a459e0467cb8225accd9e5
Reviewed-on: https://review.haiku-os.org/c/1368
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-25 18:16:35 +00:00
PulkoMandy
864a3f996b sparc: do not leave a hole between .text and .data
The a.out format does not allow to handle this properly. So we need the
two sections to be contiguous.

Change-Id: I44455d4fb728bd47d5dcebc48c52b7d90d808104
Reviewed-on: https://review.haiku-os.org/c/1469
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-25 18:16:35 +00:00
PulkoMandy
94ba4f6406 sparc: fix bootloader executable format
- The entry point has to be at the start of the text section
- Use the correct formqt ("impure") for the a.out file
- Strip all symbols (the bootloader isn't relocatable)

Change-Id: I2b973c39eaf1416f874bf1b2668b1e3090eb5f7b
Reviewed-on: https://review.haiku-os.org/c/1468
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-25 18:16:35 +00:00
Andrew Lindesay
89b16bb4d2 HaikuDepot: Categories from Server
The list of categories for packages is currently
hard-coded into the HaikuDepot desktop
application.  This change will change that so that
the list is obtained from the HaikuDepot Server
system and is always up to date with the server's
list of categories.

Change-Id: I757732f4d771e1599d6ad9c85cd65905640de928
Reviewed-on: https://review.haiku-os.org/c/1478
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-25 11:10:50 +00:00
Augustin Cavalier
f259502c90 Haiku3D: Clear media_format using assignment operator. 2019-05-24 22:51:10 -04:00
Augustin Cavalier
ca904ab353 system_time: Add temporary hack for GCC 8 to get ia32intrin.
ia32intrin isn't supposed to be included, only x86intrin is,
but GCC 8 changed some of the __builtin definitions in a
backwards-incompatible way for some of the AVX headers.
So, this is a temporary hack until we are using GCC 8 syslibs
packages.
2019-05-24 19:14:28 -04:00
Augustin Cavalier
3a2175926b hoard2: Remove.
rpmalloc has now been turned on by default for over a week, and no
bug reports against it have been filed. So, it's probably safe
to remove this as dead code now.
2019-05-24 18:20:50 -04:00
Augustin Cavalier
3ca2e85bfd Interface: Add casts to memcpy/memset invocations on BPoint & BRect.
Their copy constructors are exactly what GCC would generate,
but we can't remove them because doing so would make them
trivially copyable, and so they would be passed in registers
on x86_64, an ABI breakage.

So instead we have to add explicit casts to void* here.
2019-05-24 16:10:13 -04:00
Augustin Cavalier
057b69a774 Deskbar & Translation: Use assignment operator instead of memcpy. 2019-05-24 16:00:38 -04:00
Augustin Cavalier
f7397837e8 BMessage: Use assignment operator instead of memcpy().
The only non-POD types the macro is used on are BPoint, BRect, BSize,
and rgb_color, so the first change should essentially be a no-op.

The second change will technically have different behavior,
as the BMessenger copy constructor does not touch the _reserved_
field; but this shouldn't break anything, of course.
2019-05-24 14:28:19 -04:00
Augustin Cavalier
632e7fd0a8 Interface Kit: Remove no-op TARGET_PLATFORM_HAIKU_COMPATIBLE. 2019-05-24 14:25:44 -04:00
Augustin Cavalier
bac6edf06f ArchitectureRules: Clean up GCC >= 3 logic & disable -Werror for netfs. 2019-05-24 14:25:26 -04:00
Augustin Cavalier
17089e9ae5 Terminal: Remove a copy constructor and assignment operator. 2019-05-24 14:24:47 -04:00
Augustin Cavalier
43005c1925 libroot: Include emmintrin instead of x86intrin.
We only need one builtin here, not 8 files of them.
2019-05-24 14:24:27 -04:00
Augustin Cavalier
a1ad8af64e Change a number of sprintf to snprintf.
Fixes a number of -Werrors about format overflow from GCC 8.
2019-05-24 14:23:56 -04:00
Augustin Cavalier
5b189b0e1e HaikuDepot & PoorMan: Disable -Werror.
Unlike the last commit, I am not sure whether the memcpy/memsets
in here are properly safe to do. (They look OK, but a lot of them
involve template classes that probably should not make such
assumptions.)

But the code has worked so far, so let's disable the -Werror so
we can move forward with GCC 8 for now.
2019-05-24 14:23:12 -04:00
Augustin Cavalier
1705656eac Add (void*) casts to memcpy/memset invocations to appease GCC 8.
A lot of these classes are not *technically* "trivially copyable"
for one reason or another, but in all of these cases it seems
OK to me to use memcpy/memset on them. Adding a cast to void*
tells GCC that "I know what I'm doing here" and shuts up the
warning.
2019-05-24 14:21:37 -04:00
Augustin Cavalier
38b015579f Media: Use assignment operators instead of memset.
Spotted by GCC 8 -Werror=class-memaccess.
2019-05-24 14:19:07 -04:00
Augustin Cavalier
7a73df5e2c Debugger: Remove needless explicit copy constructors.
These worked in identical fashion to what the default copy
constructors would be, but their mere presence marks the class
as being "non-trivially copyable," which means that memcpy'ing
it is now a -Werror on GCC 8.

We have to be careful when making this change, though: classes
which *are* trivially copyable can be passed inside registers
on x86_64, so changes like these break ABI in a dangerous way.
These classes is private, so it should not be a problem, but
for other classes (e.g. BRect, BPoint) we cannot fix them
properly right now.
2019-05-24 14:17:02 -04:00
Augustin Cavalier
fef13fb917 ArchitectureRules: Add -Wno-error=format-truncation for GCC 8.
It warns on snprintf's output "possibly" being truncated (e.g.,
two B_PATH_NAME_LENGTH chars being concatenated together) which may
be exactly the behavior the programmer wanted. So that's not very
helpful.
2019-05-23 19:50:51 -04:00
Augustin Cavalier
1e78ac9523 BFS: Add missing NULL check in FileSystemVisitor.
Fixes #15082.
2019-05-23 12:11:12 -04:00
Augustin Cavalier
81c06cacc4 Debugger: Add missing SetTarget/AddItem. 2019-05-22 17:16:00 -04:00
Andrew Lindesay
cd00276153 HaikuDepot: Filtering Crash Resolution
I am unable to reproduce the problem locally, but
suspect that the lack of locking around one line
may be the cause.  Hopefully fixes #14025.

Change-Id: I14ba6d2cb4f264af732fad9c783c55f690cece4f
Reviewed-on: https://review.haiku-os.org/c/1472
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-22 19:12:02 +00:00
Alexander von Gluck IV
a70eb9a982 rpmalloc: Make 64-bit arch detection more generic
Change-Id: Ide9def37fd76641003dc25b7df8ade17d8443d19
Reviewed-on: https://review.haiku-os.org/c/1475
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-21 20:47:20 +00:00
Andrew Lindesay
4f8d9e120f HaikuDepot: Load Languages from HDS - Fixes
Follow-on changes from recent commit of the same title
with some improvements and fixes.

Change-Id: Ic4439966340578b920345332669591f6cdfcc203
Reviewed-on: https://review.haiku-os.org/c/1471
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-21 20:23:18 +00:00
Jérôme Duval
38ce902686 posix: add posix_fadvise(), only error checks.
should help for ports.

Change-Id: Id504bdb79cb68db4b615f58848e0e1a86ced8d2b
Reviewed-on: https://review.haiku-os.org/c/1467
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-21 15:07:43 +00:00
Adrien Destugues
66cb2efaa8 Move StripeView to libshared
Change-Id: Ib8ff2f731f9d34e04854f1c2ec288a3db1036793
Reviewed-on: https://review.haiku-os.org/c/1458
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-05-21 06:55:45 +00:00
Adrien Destugues
33fc4f4063 Revert "debug_server: Remove the "Write core file" button."
This reverts commit 02079c66f3.

Change-Id: I95a4bbef67e2a982da49a18105a4cbd85c4e11e9
Reviewed-on: https://review.haiku-os.org/c/1457
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-05-21 06:55:45 +00:00
Augustin Cavalier
d906fe3cc7 freebsd_network: Allocate a new root device for every attach.
This also means that when attach fails, we destroy the root device.
This should fix stale root devices getting left around when attach
fails.

Probably helps with or even outright fixes #15016.
2019-05-20 11:51:44 -04:00
Augustin Cavalier
6d880c9085 SerialConnect: Fix build on 64-bit. 2019-05-20 11:05:46 -04:00
Jérôme Duval
3802df804f pthread_key: set value planned for destruction to NULL.
* This fixes bug fix #10951.

Change-Id: I152cea3651b3307171ea4d6a0c49aceae2f0f797
Reviewed-on: https://review.haiku-os.org/c/1456
Reviewed-by: Rene Gollent <rene@gollent.com>
2019-05-20 14:09:15 +00:00
Augustin Cavalier
33f7f28798 kernel & runtime_loader: Don't load from non-packaged when "Disable user
add-ons" is set.

Confirmed to fix #14361. It is finally possible to un-brick an install
with a bad system library in non-packaged without having to use another
install to do so.

Change-Id: Iafea7821f02cb34e77c766b1f97d1c19206b1081
Reviewed-on: https://review.haiku-os.org/c/1452
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-20 14:08:28 +00:00
Augustin Cavalier
69712d5c00 OS.h: Reorder includes alphabetically. 2019-05-19 12:37:14 -04:00
Adrien Destugues
d4b3a3277d SerialConnect: implement PopLine to get items from scrollback
Allows to make the scrollback visible again when resizing, instead of
adding blank lines at the bottom.

Change-Id: I7a14188cdcb14bcd197325b935d8cfe2435ae80f
Reviewed-on: https://review.haiku-os.org/c/1464
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-19 14:00:48 +00:00
Adrien Destugues
1eb386084c SerialConnect: add a clear/reset menu.
Change-Id: I0435ba679e19094d201d65ac0c6290cd194ec344
Reviewed-on: https://review.haiku-os.org/c/1463
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-05-19 13:46:19 +00:00
Adrien Destugues
506f9764d4 Some notes about openboot.
As I keep looking for the commands to do anything...

Next step is to figure out network booting and set up an easy way to
test haiku_loader.
2019-05-19 14:31:21 +02:00
Augustin Cavalier
ba390da3b4 libroot: Name mmap areas by the name of the image that allocated them.
This adds an average overhead of 10-15 us, which seems acceptable
(without the previous patch it adds 200-250 us, which is less so),
and it makes "listarea" output much more enlightening for applications
like app_server or WebKit which use a lot of them.

Change-Id: I48a4148e6e9fb0d1a8bbf67294deeafad9372f44
Reviewed-on: https://review.haiku-os.org/c/1462
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-18 18:09:43 +00:00
Augustin Cavalier
dee722ce4f runtime_loader: Optimize a special case of get_nearest_symbol.
If the caller does not want the symbol name/address/etc., we don't
need to spend the time finding it, and can just return after
finding the image.

Change-Id: I138f8bd4071ffc25738dac4d6c0c6d3fe25edf1c
Reviewed-on: https://review.haiku-os.org/c/1461
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-05-18 18:09:43 +00:00
Augustin Cavalier
44b903f97a rpmalloc: Disable ASLR for heap areas.
On 32-bit at least, our ASLR is too aggressive and fragments
the address space very quickly to the point where at 500MB (1/4)
usage, area insertion begins to fail.
2019-05-18 13:51:19 -04:00
Augustin Cavalier
fb683851b1 rpmalloc: Disable assert on failing to map memory.
We want applications to be able to handle out-of-memory
conditions gracefully, not just trigger an assert every time.
I disabled this before, looks like I missed it in the final
patch.
2019-05-17 16:35:58 -04:00
Augustin Cavalier
dd249016c2 USB: Check and set the Device object state appropriately.
The Device object gets an ID before it begins initializing, and
loses its ID after it fully finishes tearing down, so simply
verifying the Device object is non-NULL is not enough to verify
that we can use it. We need to call InitCheck() every time.

In Device itself, we should also unset fInitOK when beginning
teardown, so that anyone who still has a handle can no longer
use this Device object while teardown occurs (which, depending
on the number of pipes, pending transfers, etc. may take some
time.)

Fixes #14949 and almost certainly any other USB-related KDLs
in these codepaths.
2019-05-17 16:24:06 -04:00
Augustin Cavalier
f8fdf848d0 HTTPStreamer: Another build fix I forgot to commit.
Sorry for the noise...
2019-05-17 16:13:07 -04:00
Augustin Cavalier
5731cdeb5f media_client: Fix build after previous commit. 2019-05-17 16:03:35 -04:00
Augustin Cavalier
218a8c03cb Revert the Codec Kit.
All of Barrett's individual reverts have been squashed into this
one commit, save a few actual bugfixes.

Change-Id: Ib0a7d0a841d3ac40b1fca7372c58b7f9229bd1f0
2019-05-17 14:43:32 -04:00
Augustin Cavalier
086528f66a USB & XHCI: Refactor endpoint initialization to support SuperSpeed better.
SuperSpeed (USB3) devices have a "companion descriptor" along with the
endpoint descriptors that describes certain other attributes they have,
which are important for the controller to schedule transfers properly.
Previously we were just using USB2 values; now we are properly using USB3
ones.

Tested on an Intel Lynx Point controller. As far as I can tell, no
regressions, but #15000 is not fixed anyway.
2019-05-16 20:31:11 -04:00
Michael Lotz
c8836afc0a rpmalloc: Use create_area instead of mmap.
It has lower overhead and allows to name the areas so that they are
labeled as heap areas.

Note that we can still use munmap for releasing. It has the nicer
interface of using the base address and length which we already know
instead of needing the area id that would have to be queried with an
additional syscall.

Change-Id: I338c4043ecc2947b82b8fe9fd69a99ce3fa23138
2019-05-16 16:04:34 -04:00
Michael Lotz
8ccd1402bf rpmalloc: Port to native TLS.
The native TLS has just a little less overhead which quickly adds up in
heavy use.

Change-Id: I6223dfdc0f9298952fdde5eb47d5112bc7887653
2019-05-16 16:04:34 -04:00
Augustin Cavalier
7132b79eaf rpmalloc: Import and set as default.
Hoard, the LGPL-licensed locking thread-caching allocator that we have
used by default since libroot's introduction, is showing its age.
It is a "pseudo-sbrk-based" allocator (it predates our actual sbrk,
so instead it uses a single Be area), which has serious limitations:
as we cannot ever move the area, we can only resize it "in place",
and so once we hit the end of the ~1.5GB reserved part of the address
space for the heap, we are usually out of luck if we need more memory.

On 32-bit userspace has only 2GB of address space anyway, but on
64-bit where address space is not a resource worth worrying about,
this can be a serious problem for applications that want to use a
lot of RAM. As more and more large applications get ported to Haiku,
the time for a mmap-based allocator has come.

For posterity's sake, here are all the possible options there were,
and why this one was selected rather than one of them, beginning
with the immediate rejects:

 * nedmalloc. Unmaintained since 2014 and all benchmarks show it
   underperforming vs. virtually all other allocators.
 * bmalloc. Significantly worse-performing vs. other options on
   this list with no apparent advantages.
 * hoard3. Now GPL only, which is obviously not acceptable for
   use as a system library.
 * ptmalloc2. glibc's default allocator; underperforms vs.
   even most of the above-listeds.

And now on to the honorable mentions:

 * tcmalloc. This is Google's allocator; it's designed for server
   and other high-performance workloads. As a result, it almost
   never unmaps memory unless ordered to do so in a very explicit
   way, which obviously is unacceptable behavior for a general-purpose
   allocator.

 * jemalloc. This is FreeBSD and NetBSD's default allocator as well
   as finding use in Firefox and Rust. It is again designed for
   performance, with significantly higher memory overhead than
   other allocators, especially for small heaps; which is of course
   a problem for us, as we want to retain our light footprint.

Finally this brings us to rpmalloc. It's not as well-travelled as
tcmalloc or jemalloc, but by benchmarks done by itself [0] and
by developers of other allocators [1], it seems to typically hit
the "sweet spot" of very good performance with lower (if not the lowest)
memory use out of all the other allocators it's tested against;
even beating jemalloc in certain benchmarks for speed, too.

You can see a description of the allocator's design in its README [2].

[0]: https://github.com/rampantpixels/rpmalloc/blob/master/BENCHMARKS.md
[1]: https://github.com/ezrosent/allocators-rs/blob/master/info/elfmalloc-performance.md
[2]: https://github.com/rampantpixels/rpmalloc#rpmalloc---rampant-pixels-memory-allocator

In general testing thus far on Haiku, it appears to be a consistent
5-10% performance boost (1m28s real -> 1m23s real) when doing
the "HaikuDepot compile" benchmark. Memory usage by most apps
after a cold boot changed negligibly (launch_daemon: 444K -> 476K,
app_server: 15.86MB -> 15.49MB, Tracker: 6.19MB -> 4.49MB.)

The only adverse affect I have observed so far is that a certain few
WebKit double-frees cause crashes/asserts faster than they did before
(e.g. Google Maps crashes after less than a minute instead of a few
minutes.)

That being said, any new or strange behaviors, please report
immediately. Backing out this change should be as easy as
reverting the changes to the libroot/posix Jamfile. If nothing
else comes up in a few weeks, then I'll remove Hoard from
the repository.

Fixes #13554.

Change-Id: Id2871601b1e99dcf022fbef2c53008ee6c3f233b
2019-05-16 16:04:33 -04:00
Augustin Cavalier
c5f96e5b4a net80211: Merge a memory leak fix from FreeBSD. 2019-05-16 15:11:01 -04:00