GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Nov-2005, 07:45
gustav_a gustav_a is offline
New Member
 
Join Date: Nov 2005
Posts: 7
gustav_a is on a distinguished road

Ignoring FPU interrupts from the processor


Hi
I am working on a C++ program that generates random machinecode instructions that is stored in an byte-array and then directly executed. The instructions are all FPU-instructions (Floating Point Unit), for example, fadd, fsub, fmul, etc. When the instructions have been executed I read the top value from the FPU-stack, this is my "output".
The problem is that since the instructions are created randomly they often result in illegal values, overflow, NANs, etc. I have masked all the exeptions in the FPU control word but these instructions still take a _very_ long time to handle.
So what I'm asking is if there is a way to tell the processor that it should completely ignore any illegal values in the FPU and just continue with the execution?

/Gustav
  #2  
Old 08-Nov-2005, 08:32
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,621
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Ignoring FPU interrupts from the processor


Quote:
Originally Posted by gustav_a

So what I'm asking is if there is a way to tell the processor that it should completely ignore any illegal values in the FPU and just continue with the execution?

/Gustav

So: You are searching for a computer language and a CPU that implements a "Branch on Bug" instruction. Mathematicians, Computer Scientists, and Engineers have been searching for that ever since Eniac. "My Life with the ENIAC - a Worm's Eye View". Maybe farther back than that. (I didn't check for specifics on Babbage's Analytical Engine or Blaise Pascal's Arithmetic Machine.)

Lacking any computer language construct that prevents you from even trying to execute an illegal instruction, you could include an analysis function in your program that looks at each op code and its arguments and tests whether it is going to try to divide by zero, for example. The function that I am referring to is sometimes called an "instruction set simulator". Maybe you can find something about such programs and decide whether to implement one in your program. Or, maybe one exists for modern floating-point processors (more recent than the 8087) and is available for your use; I haven't looked recently.)

Regards,

Dave

Footnote: Looking at the mythical "Branch on bug" instruction somehow made me think of Microsoft's "Bob" product of a few years ago. Microsoft Bob --- "widely considered one of Microsoft's least successful products". Coincidence??? Or did Bob just go nuts looking at all of the bugs so that he never had time to do anything that really helped the user?
  #3  
Old 08-Nov-2005, 10:55
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Ignoring FPU interrupts from the processor


Quote:
Originally Posted by davekw7x
Footnote: Looking at the mythical "Branch on bug" instruction somehow made me think of Microsoft's "Bob" product of a few years ago. Microsoft Bob --- "widely considered one of Microsoft's least successful products". Coincidence??? Or did Bob just go nuts looking at all of the bugs so that he never had time to do anything that really helped the user?
He probably got frustrated looking through Windows code and had a hemmorage.
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
  #4  
Old 09-Nov-2005, 05:02
gustav_a gustav_a is offline
New Member
 
Join Date: Nov 2005
Posts: 7
gustav_a is on a distinguished road

Re: Ignoring FPU interrupts from the processor


Quote:
Lacking any computer language construct that prevents you from even trying to execute an illegal instruction, you could include an analysis function in your program that looks at each op code and its arguments and tests whether it is going to try to divide by zero, for example. The function that I am referring to is sometimes called an "instruction set simulator". Maybe you can find something about such programs and decide whether to implement one in your program. Or, maybe one exists for modern floating-point processors (more recent than the 8087) and is available for your use; I haven't looked recently.)

Unfortunately I can't have any functions that checks for illegal output before I get them since it is very important that my program is as fast as possible. And I will never get any illegal instructions in the FPU, because I choose the instructions from a list of valid FPU instructions, but the result of the functions can be illegal. I'm guessing that each illegal value causes some kind of interrupt that takes a long time to handle, and it is those interrupts that I would like to block in some way

Regards
Gustav
  #5  
Old 09-Nov-2005, 07:23
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,621
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Ignoring FPU interrupts from the processor


Quote:
Originally Posted by gustav_a
And I will never get any illegal instructions in the FPU,

My intent was to indicate illegal operations (divide by zero, overflow, etc.), not just illegal instructions.

Since you indicated that you already know how to mask the interrupts from the FPU and the results are still unsatisfactory (long delay handling the "bad boy" instructions), I assumed that a solution would be to somehow trap illegal operations and not call the FPU in the first place.

Since I wasn't able to come up with anything useful, I am hopeful that someone else browsing through the thread might have suggestions.

Regards,

Dave
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Payment Processor News Guru eCommerce / Merchant Account Forum 8 27-Feb-2007 03:43
Processor Overclocking query... sirantonycartwr Computer Hardware Forum 5 08-Nov-2005 20:27
VC++ .NET Windows and interrupts / watchdogs question. bmwrob MS Visual C++ / MFC Forum 0 30-Jun-2004 21:06
Which processor? Mick Computer Hardware Forum 19 23-Mar-2004 20:32

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:24.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.