Repository navigation
0.5.3 --- an image is entered in its convention's floating-point state - #33
Merged
Merged
Conversation
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An ok image is entered in its convention's floating-point state (SPEC 12.2), on every system.
The defect. A thread of Windows begins with the x87 at double precision (control word 0x027F); Linux and macOS begin at extended precision (0x037F), the System V state. okrun entered an image without establishing the state, so a C library in the image that computes in long double read decimal numbers otherwise: openkal-musl's
strtod("0.4")gave0x1.99999999998p-2instead of0x1.999999999999ap-2(measured on x86_64-openkal under both control words). It surfaced as a JSON number comparison that failed only on Windows.The change.
run/src/image_abi.h:okrun_fp_enterandokrun_fp_leave— on x86-64 the x87 control word 0x037F and MXCSR 0x1F80, on AArch64 FPCR zero; each writes only a word that differs.okrun_call_enter/okrun_call_leave(okrun.h,openkal.run): a binding makes each call from a program of the system in the image's state and restores the caller's after it; openkal-bind generates the pair around every call.examples/fpstate: the state at the entry and in a context, checked on each system.examples/bind: the caller sets the x87 to Windows' precision, the library reports the convention's, and the caller's word is restored.The SPEC row that states the state is mcpplibs/openkal's (a companion pull request).