On 18/08/2022 12:32, Richard Henderson wrote:
On 8/17/22 09:57, Lucas Mateus Castro(alqotel) wrote:
+void sigfpe_handler(int sig, siginfo_t *si, void *ucontext)
+{
+    uint64_t t;
+    uint64_t ch = 0x5fcfffe4965a17e0ull;
+    asm (
+        "stfd 2, %0\n\t"
+        : "=m"(t)
+        :
+        : "memory", "fr2"
+    );

No, you need to fetch f2 from ucontext.  There's no guarantee of any specific values being
present in the signal handler otherwise.
Yeah, for some reason I completely forgot about this, my bad. I'll send a second version fixing this

+    return -1;

exit(-1), which return from main equates to, helpful over EXIT_FAILURE.
But here I'd tend to abort(), since it really shouldn't be reachable.
Good point, I'll change in v2


r~
--
Lucas Mateus M. Araujo e Castro
Instituto de Pesquisas ELDORADO <https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>

Reply via email to