<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style='--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;'>
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>

<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";'>
<div class="content">

<p style="color: #777777;">
<a href="https://gitlab.rtems.org/anj_anl.gov">Andrew Johnson</a>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5214#note_119953">commented</a>:
</p>
<div class="md" style="position: relative; z-index: 1; color: #28272d; word-wrap: break-word;">
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">Isn't the fundamental issue here that an interrupt should never corrupt the FPSR of a thread that gets interrupted?</p>
<p dir="auto" style="color: #28272d; margin: 0 0 16px;" align="initial">A piece of code running in one thread (Task A) should be able to perform an operation that results in some FPSR bits being set, and then read those bits to act on them. If an interrupt occurs in between the two and results in a different thread (Task B) being preemptively scheduled, the interrupt/scheduler code needs to save the FPSR value from the first thread, so that the second one can perform its own FP operations that could change the FPSR, then the scheduler must restore the FPSR before it returns to the first thread again.</p>
<p dir="auto" style="color: #28272d; margin: 0;" align="initial">I suspect <a href="https://gitlab.rtems.org/opticron" data-reference-type="user" data-user="4" data-container="body" data-placement="top" class="gfm gfm-project_member js-user-link" title="Kinsey Moore" style="color: #0b5cad; background-color: #cbe2f9; border-radius: .25rem; margin-top: 0; padding: 0 2px;">@opticron</a> is seeing the delay calls in the above description as permitting the FPSR to be corrupted in the example, but <a href="https://gitlab.rtems.org/pfaiks" data-reference-type="user" data-user="326" data-container="body" data-placement="top" class="gfm gfm-project_member js-user-link" title="Preston Faiks" style="color: #0b5cad; background-color: #cbe2f9; border-radius: .25rem; padding: 0 2px;">@pfaiks</a> is concentrating on the problem that FP operations in another thread is what is actually changing the FPSR value in the example. The delays were presumably included to maximize the chances that an interrupt will occur between the FPSR being set and then read, but it should be possible to replace those calls with a busy-wait loop to remove that aspect.</p>
</div>


</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #737278;">

<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5214#note_119953">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/db81957cc4569936a92e789fdd5886bc/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5214#note_119953"}}</script>


</p>
</div>
</body>
</html>