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.
+ 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. r~