delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/09/09/19:15:14

From: "Lawrence Rust" <lvr AT nospam DOT softsystem DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: SIGALRM signal handler doesn't save FPU state
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Message-ID: <q78f9.1851$Yc7.106506@newsfep2-gui>
Date: Mon, 9 Sep 2002 22:10:40 +0100
NNTP-Posting-Host: 62.253.142.12
X-Complaints-To: abuse AT ntlworld DOT com
X-Trace: newsfep2-gui 1031605846 62.253.142.12 (Mon, 09 Sep 2002 22:10:46 BST)
NNTP-Posting-Date: Mon, 09 Sep 2002 22:10:46 BST
Organization: ntl Cablemodem News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have a program that uses setitimer to raise periodic SIGALRM signals.  The
ANSI C/C++ spec guarantees very little about what can be done in a signal
handler.  However, I've discovered that djgpp 2.03 / gcc 3.10 don't
save/restore the FPU state across an async signal handler.  Consequently if
the foreground and the signal handler both execute simple floating points
ops (like multiply) then the foreground routine can be trashed.

I've added some inline assembler (fnsave/frstor) around my signal handler to
solve this.  Perhaps the FAQ could be updated to include this info or even
better if libc could include this for async signals.

-- Lawrence Rust, Software Systems, www.softsystem.co.uk
The problem with Windows XP: http://www.arachnoid.com/boycott



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019