-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ia32/exceptions: fix FPU exceptions #624
Merged
Merged
Conversation
This file contains 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
Unit Test Results7 958 tests 7 416 ✅ 40m 32s ⏱️ Results for commit 887e356. ♻️ This comment has been updated with latest results. |
badochov
force-pushed
the
badochov/exc-int
branch
from
November 18, 2024 16:11
765fd16
to
095fdb4
Compare
badochov
changed the title
ia32/exceptions: fix FPU exceptions
ia32/exceptions: improve FPU exceptions
Nov 18, 2024
badochov
force-pushed
the
badochov/exc-int
branch
2 times, most recently
from
November 18, 2024 17:29
709b931
to
1967f0f
Compare
badochov
force-pushed
the
badochov/exc-int
branch
from
November 27, 2024 23:21
1967f0f
to
5a0f089
Compare
jnz .exception_pushRegisters should have flags from andl not subl instruction. JIRA: RTOS-954
savesp saved in exception_pushContext pointed to savesp instead of edi. JIRA: RTOS-954
Checking for FPU exception in preambule of exception handling causes infinite recursion of FPU exceptions if one is found. JIRA: RTOS-954
badochov
force-pushed
the
badochov/exc-int
branch
from
November 27, 2024 23:21
5a0f089
to
84e4337
Compare
badochov
changed the title
ia32/exceptions: improve FPU exceptions
ia32/exceptions: fix FPU exceptions
Nov 27, 2024
cr0Bits were overwriteen by eax in the context during restoration. This resulted in a crash on second context restoration. JIRA: RTOS-954
As we use interirupt gate for exceptions the interrupts are already disabled. JIRA: RTOS-954
Apply same optimizations as to exceptions_pushContext JIRA: RTOS-954
JIRA: RTOS-954
badochov
force-pushed
the
badochov/exc-int
branch
from
November 28, 2024 15:17
84e4337
to
887e356
Compare
agkaminski
approved these changes
Nov 28, 2024
mateusz-bloch
approved these changes
Nov 28, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the changes with the latest master of the project, and everything seems to be ok.
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.
Description
This PR aims to resolve situation with exceptions caused by FPU on Intel.
First commit resolves issue where recently instead of a triple fault on FPU error exception 16 got presented on the screen, due to wrong instruction setting flag.
Second, commit fixes saving context in exceptions.
Third commit changes
fsave
in context saving procedure tofnsave
to prevent infinite recursion on FPU exception causing a triple fault. Due to this change exception 16 is reported correctly as exception 16 not as tripple fault. Thus, exception 16 is excepted to appear not Triple fault.Fourth, commit fixes the root cause of the intermittent error. The
cr0Bits
were overwritten by eax during context restoration. We may restore twice from the same context in case of a signal pushed during_threads_schedule
. Then we restore once from the context to go to the signal handler, after the signal is handled the context is modified to have originaleip
andesp
and we longjump to it resulting in second restoration from the context with overwrittencr0Bits
. This resulted inTS
flag being removed without proper FPU initialization on next restore.The following commits are optimizations.
Fixes: phoenix-rtos/phoenix-rtos-project#1012
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment