Re: piplining principles (and confusion!)

From: Bob Masta (NoSpam_at_daqarta.com)
Date: 09/07/04


Date: Tue, 7 Sep 2004 12:19:52 +0000 (UTC)

On a related issue:

In the "good old days" we could use self-modifying code
to tell an 8088 from an 80286 by modifying an opcode
just ahead of the current instruction. If it was an 8088
with a short queue, the modification would be done
before the modified instruction was read, and it would
thus be acted upon. If it was an 80286, the target
instruction was already in the queue and so the
original form was acted upon, and the mod ignored.

In general, if you were doing self-modifying code and
did *not* want the "queue trap", you could insert a
jump before the target, which would flush the queue
and assure that the changed code was acted upon.

So, my question is how all this relates to modern
pipeline and cache operation. Are all modern
CPUs smart enough to recognize that a write is
going to change an instruction already in the pipeline,
and flush it? If not, what are the rules for safe
self-modifying code?

Thanks!

Bob Masta
dqatechATdaqartaDOTcom
 
            D A Q A R T A
Data AcQuisition And Real-Time Analysis
           www.daqarta.com



Relevant Pages

  • Re: piplining principles (and confusion!)
    ... >> with a short queue, ... >> before the modified instruction was read, ... >> pipeline and cache operation. ...
    (comp.lang.asm.x86)
  • Re: piplining principles (and confusion!)
    ... > just ahead of the current instruction. ... > with a short queue, ... which would flush the queue ... > pipeline and cache operation. ...
    (comp.lang.asm.x86)
  • Re: Forth Day and SEA Platform news?
    ... Forth Day and SEA Platform news? ... self-modifying code will always be the smallest and fastest ... Write byte with value a to 32-bit memory location "b", ... instruction. ...
    (comp.lang.forth)
  • Re: piplining principles (and confusion!)
    ... my question is how all this relates to modern pipeline ... First rule, don't use self-modifying code. ... If you ignore these reasonable rules, ... modern CPUs _can_ run SMC correctly. ...
    (comp.lang.asm.x86)
  • Re: Self-modifying code on SMP operating systems
    ... The new intel and amd cpus detect self-modifying code, ... Patrick Harsdorf ... > But aren't there ways of using pipeline tricks to help obscure ... > read somewhere that you can do things that use the pipeline to your ...
    (comp.lang.asm.x86)