This has been broken since January 2014, from a change made during
the scheduler refactor (527da4ca8a).
How nobody seems to have figured this out since then, I have no idea,
especially since the 32-bit initialization routine had the
critical function (x86_get_double_fault_stack) commented out entirely.
Even if it wasn't commented out (and it wasn't for 64-bit), it wouldn't
have worked, because the double-fault stacks were not allocated
until "post-VM", while the TSS is set up during "preboot" (basically
just after kernel entry.)
We now take care of this by allocating the virtual address for
the stacks immediately, and then creating an area for it
in the "post-VM" stage. This means that any double-faults
which occur before the post-VM stage will just triple-fault,
but seeing as all double-faults have been triple-faults
for the past decade, that's probably fine. (In order to get a
double-fault stack that early, we would probably need to
have the bootloader allocate it for us.)
This must be working, because it changes #18692
from a triple-fault (instant reboot) into a double-fault KDL.
On some rare memory-corruption KDLs, I have seen pages with
"0" for all fields including page_num. So now we compute the
expected page number from the page's offset into sPages
and print an additional line if it doesn't match what's in the
page structure.
This way, FIONBIO and O_NONBLOCK will no longer get out of sync,
and additionally, FIONBIO can be used to change non-blocking
status of regular (non-socket) FDs, too (which some applications
seem to take advantage of, to avoid needing to fetch the open_mode
before calling fcntl.)
Change-Id: Id894fe76c79ac373c0121a003d68180a3d9b6560
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7697
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Some systems (e.g. NTFS through WSL1) support arbitrarily-large
extended attributes, but do not preserve case on attribute names
(or disallow more characters than the existing manglers took
care of.)
So, this adds a mode in which attribute names are encoded as
hexadecimal. At present it must be manually enabled; in the future
it may be possible to modify ./configure to activate it
automatically.
Change-Id: If20e4cb1cf4153cccc918ce6d51761426055290c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7698
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
* Make the consumer-count int32 atomic, avoiding the need for
all get/put operations to go through a global lock.
* Disable the code that unloads the stack interface when there
are no consumers. Otherwise, we wind up repeatedly loading/
unloading the stack interface during the boot process (e.g.
while sockets are being created and destroyed during net_server
startup.)
In the future, if we want to really unload it, we can add some
interaction with low_resource_monitor or something like that.
Reduces register_domain call count during boot from 31 to 7
(it appears the stack was loaded and unloaded 5 times, before
it stayed loaded the 6th.)
Otherwise, modules that depend on each other will be repeatedly
loaded and unloaded. This reduces the number of register_domain()
calls on a standard boot (of @minimum, at least) from 43 to 31.
Remove the `ByteOrder.h` and `SupportDefs.h` Haiku-specific headers
from `bsd/endian.h` on GCC >= 4 and replace them with compiler builtins.
This prevents some unwanted symbols like `type_code` causing name
clashes in ported applications.
Change-Id: Id88791ea5954c260f4e7f5e82a564f3ae6bafe69
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7642
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Font size have no direct relation with actual text line height and is a
choose of a font designer. Ascend + descent formula should be used to
calculate actual text line height.
`BRect` `right` and `bottom` coordinates are inclusive so it means for
example `BRect(0, 0, 15, 15)` width is 16 pixels.
`BRect::Width`/`Height` methods returns `right - left` and
`bottom - top` accordingly so actual size in pixels bigger by one. There
is some confusion that string width and rect width have a difference by one.
Change-Id: If29f8a2e6804a90e63dd2d92580160160229392f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7668
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Fix fPosition and fTerm not being initialized when expr is NULL
at line 1162.
Pointed out by GCC14.
Change-Id: If883ac0cc32e3418d0e3b49b42012efd861d65f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7641
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
before trying to write to the frame buffer.
* QEMU can now be started without a standard vga output (-vga none).
Change-Id: Id46cd4d70ce16e2156e0b0668fb88f09112067a0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7667
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Fill the buffer also for NUL character.
Give the buffers at least the minimum needed: 4 characters for each of
at most 4 bytes and an extra one for the ending NULL.
Fixes: #18651
Change-Id: I1ca931ad5673baaca3fb08ebfe189dca7093c80e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7666
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This tells the compiler that this function takes a format string as a
parameter, and returns a "similar" string with the same formatting
operations. This allows the format string to "propagate" to prinf-file
functions (including BString::SetToFormat) and the format string to be
actually checked with the arguments passed to that function.
Without this, all translated strings were not checked to match with
their arguments.
Change-Id: I5c3c5cbfe7dfede9a6f45cad47a7524f9138fac0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7663
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Previously these were not checked by the compiler due to a missing
function attribute.
Unfortunately, for the translation macros to work, the translated string
must be identical in all architectures (otherwise, we would need
different translations and different catalogs for each). This means the
B_PRI* macros can't be used, and instead the parameters must be in one
of the types handled directly by printf. Change the variables types
directly where it was easily possible, and otherwise, use a cast.
Change-Id: Ib77a7e378b7c508f6e7a015bbe3cbb4c2c096bfa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7665
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* like sigqueue() but for threads. was added recently to FreeBSD, long before to glibc.
* also include features.h in gnu/pthread.h
Change-Id: I73bca666e2c67d7ff05f341bf85d71df9ccccbe5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7659
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
FontStyle will be keeping the references, so the family will exist as
long as there's a style pointing to it.
Change-Id: I639f7914be924a84d5db5882c638a4dac665aa23
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7634
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
On font removal styles may still be referenced by views, pictures or
whatever else. In that case, what we were doing had the following
effects:
- The style is still available through the family. So it is still
returned when listing fonts.
- The style is not available by ID. So a few app server messages will
fail, including those for string width or character escapements.
Moreover, if the removal was due to an update, adding the style again
fails because we already have one by that name. If all the old
references are finally dropped, we end up without the old nor the
updated style.
We now do the opposite: until all references are dropped, a style can
still be fetched by ID (that is, by an object that loaded it before
being removed), but it is not listed anymore (so it won't be given to an
app loading a font by name or by changing the style of a font of the
same family).
Fixes: #18868
Change-Id: Ia64744afeb9297fd446e437d08636733b6dc0aec
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7633
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
In which case failure to find it in the styles hash table does not tell
us anything about the existence of its family.
Change-Id: I77c8960a96e7283547650daae67ea71fd022567e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7631
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
(And surrounding portions of the "btCoreData" module.)
* Rewrote the main "l2cap.h" header representing protocol constants
and structures. Now conforms to general Haiku naming conventions
rather than BSD ones. Some more constants added/removed based
on the most recent Bluetooth specification.
* Rewrote all code derived from the BSDs to match Haiku conventions
and structures in the driver.
* Dropped the "channel" and "frame" structures from "btCoreData".
Channels are now managed by L2capEndpoints, and "frames" are
now just plain net_buffers without surrounding structures.
This also makes state management much simpler.
* Made it so that actual net_buffers are passed through to the
l2cap_receive function rather than another data structure.
A fake interface address is used to communicate connection
information. (This probably ought to be changed, though.)
* Get rid of l2cap_lower and l2cap_upper abstractions.
Everything related to channel/endpoint management is now
done in L2capEndpoint, while buffer reception is handled
directly in l2cap_receive and elsewhere, same as other drivers.
* Wire up more hooks and fix module flags (needed to be able to
get the module loaded and opening sockets at all.)
* Implement an actual locking strategy in L2capEndpoint
and HciConnection. There's still problems with lifetime
management, but at least thread-safety is mostly handled.
* Create an L2capEndpointManager and use it to manage
the endpoints, rather than having a single (unsafe)
linked-list.
And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:
* The "btCoreData" and "hci" modules also badly need a major
overhaul, and should be merged into a single "bluetooth"
bus_manager. They also shouldn't be passing around pointers
to other modules like this.
* There's a number of TODOs/FIXMEs in the L2CAP module, most
notably around timeouts (especially command timeouts) and
parameter validation/specification.
Tested by myself and kallisti5. Outgoing connections,
at least, manage to fully initialize and configure
successfully.
(And surrounding portions of the "btCoreData" module.)
* Rewrote the main "l2cap.h" header representing protocol constants
and structures. Now conforms to general Haiku naming conventions
rather than BSD ones. Some more constants added/removed based
on the most recent Bluetooth specification.
* Rewrote all code derived from the BSDs to match Haiku conventions
and structures in the driver.
* Dropped the "channel" and "frame" structures from "btCoreData".
Channels are now managed by L2capEndpoints, and "frames" are
now just plain net_buffers without surrounding structures.
This also makes state management much simpler.
* Made it so that actual net_buffers are passed through to the
l2cap_receive function rather than another data structure.
A fake interface address is used to communicate connection
information. (This probably ought to be changed, though.)
* Get rid of l2cap_lower and l2cap_upper abstractions.
Everything related to channel/endpoint management is now
done in L2capEndpoint, while buffer reception is handled
directly in l2cap_receive and elsewhere, same as other drivers.
* Wire up more hooks and fix module flags (needed to be able to
get the module loaded and opening sockets at all.)
* Implement an actual locking strategy in L2capEndpoint
and HciConnection. There's still problems with lifetime
management, but at least thread-safety is mostly handled.
* Create an L2capEndpointManager and use it to manage
the endpoints, rather than having a single (unsafe)
linked-list.
And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:
* The "btCoreData" and "hci" modules also badly need a major
overhaul, and should be merged into a single "bluetooth"
bus_manager. They also shouldn't be passing around pointers
to other modules like this.
* There's a number of TODOs/FIXMEs in the L2CAP module, most
notably around timeouts (especially command timeouts) and
parameter validation/specification.
Tested by myself with kallisti5's help. Incoming connections
(on the PSM for SDP) get all the way to the latter half
of the Configuration step before hanging.
8cc8ec9ef9 fixed a problem due to BSpinner
using its own variable to store the value instead of resorting to
BControl's one. That was accessed with a inline method, so programs
compiled before the change get the spinner's value from a place that in
newer revisions contain garbage. Copy the value to that position after
changes, so that it is available for both old and new apps.
Fixes: #18898
Change-Id: I01679bfcb5b208e04ea85d7ec38cc655305d532a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7657
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>