The bootloader is now only responsible for setting up Protected Mode
and Paging. It otherwise preserves the existing CR0, and leaves setup
to the kernel.
The kernel now sets CR0 for each CPU in preboot_init_percpu().
Some redundant sets are removed from x86_init_fpu, which now
panic()s in the case where we don't have a FPU, and avoids
unnecessary prints.
This fixes a massive oversight where CR0 was never reset on x86
systems booted using the EFI loader, except on the boot CPU! That
meant that NUMERIC_ERROR and possibly even WRITE_PROTECT were
simply not set on non-boot CPUs, unless the EFI BIOS had set them up
already. (On the BIOS loader, smp_start_kernel() ran on all CPUs.)
Fixes NVMM initialization on non-boot CPUs on Intel hardware.
At present, it can boot TinyCore Linux to a GUI, but a Haiku
image reaches the rocket before crashing with an NVMM error,
when tested under nested virtualization in VMware. (It seems
my Intel device is a few generations too old and doesn't have
all required features, so I wasn't able to test there.) So,
some more work is still required, it seems.
* VMUserAddressSpace & VMTranslationMap64Bit will need to be inherited from.
* vm_soft_fault & vm_unmap_address_range will need to be invoked directly.
* map_backing_store will need to be invoked directly. The whole concept
of "backing stores" is long merged into VMCache anyway, so at the
same time, just rename the method to "vm_map_cache".
Methods added to the internal vm_priv.h; they should not be needed
except in special circumstances.
* Drop screen_configuration::is_current. This just caused significant
confusion and problems, because values could get out of sync between
the Stored and Current screen configuration storage.
* Try to match by monitor_info always, not just ID.
* Add the current vs. stored Configurations distinction to VirtualScreen.
This will populate the CurrentScreenConfiguration object during
initial configuration of screens.
Fixes app_server not properly reverting to the original resolution after
apps that change the resolution quitting, which was seen in #20042.
Change-Id: I61c9ee4c5b7e755cbb207170d2eddb1d31fd0ea8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11024
Reviewed-by: waddlesplash <[email protected]>
This reverts dbc6b2061e.
Hopefully after the various fixes to APIC timer setup, the
problems that this was causing will be gone. (The users who
reported issues with it did so only on the forums and never
opened tickets, it seems.)
We should just be zeroing any unknown bits, not trying to preserve them.
If the BIOS or other mechanisms left the timer in some other mode
besides "one-shot" like we need, then we might incorrectly preserve
those bits.
This also has the advantage of avoiding config reads in set_hardware_timer.
Even on a single-core software-emulation QEMU VM, we acquire more
than 10k spinlocks per second (sometimes even over 100k.) That makes
sense, as every syscall entry, mutex acquisition (even uncontended,
for KDEBUG kernels), etc. acquires a spinlock. So, reasonably, this
list will always be too small to detect much of anything at this point.
If we need a similar debugging facility, we should store addresses
or thread IDs in the lock structure. That will require a more significant
refactor to locking code, however, and it doesn't seem necessary at this
time, so I haven't implemented that (yet).
* Get rid of the global sUserTimerLock. This was added in 2013
to prepare for the removal of the global scheduler lock, which
is what all these routines previously used. The locking design
was never redesigned since then to accomodate for the changes,
it appears.
* Make CPU timers always locked by time_lock, and the system-time
timers locked by a local lock.
* Make fScheduled load-bearing as to whether the timer is presently
in the team/thread lists or not.
* Don't re-fetch the team/thread every wait cycle. This allows us
to avoid a lock/unlock dance that would otherwise complicate
the scheduling logic significantly.
Tested using the old version of the Open POSIX Testsuite (which
indeed caught some bugs in earlier versions of this patch.) All
12 timer_create tests still pass, including the ones that depend on
timers firing within the right timeframe.
Fixes#20090.
Change-Id: I54dd9a49e72f51711baa0fbf18e5c35a7fafec8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11007
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
They have been in BeBuild.h since BeOS days, but as this file
is included everywhere in the base system headers, it causes
a bunch of unnecessary POSIX namespace pollution. So, instead,
put them in a config header, and include it from SupportDefs.h,
which should only ever be included by Be/Haiku API headers.
It's a non-standard header we inherited from BeOS. According to the
POSIX specification, size_t should be declared from including stddef.h
and/or sys/types.h, and ssize_t from sys/types.h.
It comes with AVX, so enable it if we've enabled AVX.
This also adjusts altcodepatch_replace to explicitly set NOPs
for the remainder of the patch area.
Change-Id: Ia07549851d86836ff5428635b580c751b4e5b2a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10867
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Enabled by default, but can be disabled via a new settings window
option (which is saved and remembered across runs.)
Change-Id: Ifd49cd734dcf5e4a5e5b3625d23bc2778fa1fa55
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10850
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Putting all the per-CPU messages in one array means they'll all
be on the same cache lines. The cpu_ent structure is cache-line-aligned,
so this means they'll be on separate cache lines.
TCPEndpoint::_NotifyReader() calls notify(READ, _AvailableData()),
which after a close will be negative, so this will set DISCONNECTED
in that case.
Drop the unnecessary duplication from TCPEndpoint::_HandleReset:
the net_socket layer sends READ|WRITE notifications in this case.
Fixes#19969.
Change-Id: I0e10c0280f3c84276b486b0375000153a117246d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10581
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
* Implement the TODO about needing to place stubs in executable
memory. This fixes basic ltrace operations.
* Place traces behind a TRACE ifdef.
* Get rid of the "patched table" and find the PatchEntry
using fixed offsets, to improve efficiency.
* Add a "bool trace" to PatchEntry. This paves the way for
tracing only specific methods.
Using LD_PRELOAD_ADDONS=...ltrace_stub.so, trace entries are now
printed on x86_64. However, it seems that the trace stub is clobbering
something, as BWindows don't work correctly when traced.
On a 64-bit nightly, it appears we're already using 16 out of the 20
slots for kernel_args ranges. On a 32-bit bootstrap build with symbols
enabled, we exhaust them (due to the network drivers that the bootstrap
build adds to the boot set).
The kernel_args are later freed by the kernel, so this shouldn't "leak"
any memory unnecessarily. With this size, we only need one chunk with
symbol loading disabled.
We never send it to the kernel but always free it. The kernel_args
allocator is very simple and can't handle frees besides the most recent
data, so this avoids "leaking" some kernel_args memory (it should all
be freed by the kernel later, though, so that only matters for
the bootloader itself.)
Nothing uses it (not even DEBUG_PAGE_QUEUE, it appears),
and it will need to be managed a different way for the
multiple ModifiedPageQueues, if we really do need it.
Use strchrnul instead of strchr, and increment at the end of the loop.
This avoids needing to call _ParseExportVariable in two separate places.
The invocation of line.Append(chunk, bytesRead) was also incorrect,
as bytesRead would be past the end of chunk if chunk had been
incremented. But this wasn't really a problem because BString
does strnlen() on the passed arguments.
Inspired by a change seen in a fork of the Haiku repository on
GitHub.
Also drop the long-double files from architectures where long-double
support is (currently) disabled in glibc config.h.
Should fix#19589 and other long-double related problems on
RISC-V and ARM64.
Change-Id: Ia33ce2791d812eb143b719fb61e69dbf8b70ce79
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10815
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Sam Roberts <[email protected]>
Otherwise we just spends lots of CPU time sending silence.
This also paves the way for stopping the output when all
outputs disconnect, but that's not implemented just yet.
Since this forces a wait inside the mixer for the destination
to actually start, it may help with problems like #19074.
At least in testing, without that block, I got similar symptoms
and crashes, due to the initial 0 value being used to compute
the performance times, and winding up with very incorrect times.
Note that this changes the MultiAudioNode to not really start its
timesource when it gets a TIMESOURCE_START message. Instead it waits
until it gets a regular B_START (via StartNode) message to do that.
Change-Id: I1716e347537c88dcc76163a515e7fbb8c5ccdecb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10643
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This makes for much faster lookups, and avoids the need
to allocate an array.
sizeof(BWindow) is unchanged (on x86_64, 504; on x86, 376)
so this should not break ABI/API.
Quick benchmark in Tracker:
501 lookups, before: ~488 usec
501 lookups, after: ~284 usec
Change-Id: Ica2c728f0c5957380add53e14a826a4aade52df0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10720
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
If the shortcut is not available (due to the menus not being active),
then this will make sure we handle the key regardless. If the shortcut
is active, then it'll get eaten by BWindow, and we won't get here.
Change-Id: Id6c3ae590f596481f9dfb720aa088238ccc6413c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10718
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: John Scipione <[email protected]>
This is now a POSIX method which was widely supported even before
its addition to POSIX, so using it here (including on the build
platform) should be OK.
This takes mimeset -F of the whole src/ hierarchy from around 2.8
seconds to around 2.1 (user time goes from ~1.2s to ~0.6s.) It seems
I/O is a lot of the remainder now.
Also drop the TODO comment; we don't want partial matching like that,
as the sniffing rules would not expect it.
All tests still pass.
Change-Id: Ibb190f6f9f5e73ed027e052ef665b177d3fd6f86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10688
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Another slight optimization. The time doesn't seem to decrease much,
but this paves the way for a much more optimized scan.
Change-Id: I0fb65544524fbc9606fd84ef521b706bd9dc4d02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10687
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
This will allow them to perform some more upfront optimizations.
Note that this change includes a slight compatibility breakage with
BeOS R5: it applies an "-i" flag in a disjunction to all patterns in
the disjunction, not just all patterns following the "-i" (I checked.)
However, as far as I can see, this feature of R5 was undocumented
(sniff rules are described in the "Release Notes" section of the Be Book
only, and "-i" isn't discussed there), and the only pattern on R5 that
appears to use them at all was the "text/html" pattern. The behavior to
apply case-insensitivity to all patterns seems unexpected, so I think
it should be OK to break compatibility in this slight way.
Change-Id: I0556d53e602bc68ae14ac21c9e226403061043a0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10686
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Otherwise, we send them out before the file is actually renamed,
and so we could send notifications with stale name values in them
(in the case of B_ENTRY_CREATED and B_ENTRY_REMOVED), or before
the file's name actually changed as visible in stat(). This way,
we send the notification only after updating the entries.
I noticed when profiling the system with ActivityMonitor running
that most of ActivityMonitor's time was spent initializing these
for the Memory view. So, instead, cache the formatters to avoid
needing to reinitialize them so often.
With the old code, if the currentErrno hadn't changed, but was in
fact re-assigned more recently than the local errno was, then we
would wind up incorrectly return the local value instead of the
system value. This was the cause of the build mimeset not working
properly when run in recursive mode on Haiku.
So, instead, create a wrapper struct to make assignment of the
local errno always pass through to the system one, so they never
get out of sync in the first place.
* Move the logic to build_cross_tools, as some scripts use this
directly.
* Use gnu89 standard instead of disabling specific warnings.
* Reduce optimization level used to compile GCC, to try and stave
off possible bugs.
* Explain why 32-bit is used for GCC 2. (With some hacks,
GCC 2 compiled in 64-bit mode can be used to build an image
that does get to the desktop, though.)
Tested with GCC 14.2.
This avoids an allocation, copy, and deallocation every single
test of every single pattern, which was unbelievably inefficent
and one of the worst performance hits to the MIME sniffer.
Before this change, "mimeset -F src/" in the Haiku repository
took 20-40+ seconds. After this, it takes around 3 seconds.
All tests still pass (and indeed the tests caught some bugs in
the initial version of this change.)
We use BString in the build platform, so we need it to work
everywhere. Add a fallback for non-Haiku targets (though glibc and
others do have memrchr and so could keep this, if we added some
more logic here.)
It turns out PAGE_ACCESS assertions could be tripped in other cases,
e.g. when resizing a cache while pages were being read in. So,
properly unset ACCESS (and just leave 'busy' set) in the places
where pages are read in, and re-enable the check.
Change-Id: I22ac5c8cb432c87613bb85e82703a0c1aeb55d86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10627
Reviewed-by: waddlesplash <[email protected]>
Since we unlock the cache at various points in this loop,
we need to periodically recheck the size here, as otherwise
we might try to insert pages past the end.
This amends 4f8eaff87f. Re-tested
using the case described in that commit.
Change-Id: Id65e309f986a9b7f3e701d2b99c4f318a4eefbd3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10626
Reviewed-by: waddlesplash <[email protected]>
This allows the VMCache to remove these pages pending the I/O
completion.
Combined with the following commits, confirmed to fix#18390.
Change-Id: I9630a00d70a9d6ac5b36e6de70475a6032390806
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10591
Reviewed-by: waddlesplash <[email protected]>