Re: Jumping into middle of instruction



On Wed, 27 Feb 2008 14:20:10 +0100, "Wolfgang Kern"
<spamtrap@xxxxxxxxxx> wrote:


mybwpp asked:

Can we categorize this technique of jumping into middle of
instructions, as 'self modifying code'?

No, SMC is a different story.

start:
; this works only in true RealMode!
cmp al,80h
jns L1:
mov word CS:[L2],9090h ;two NOPs
L1:
... ;put some code in here to avoid prefetched remains
mov ax...
add ax,cx
L2:
JC L3 ;this two bytes may become NOPS
...

How does Real Mode make a difference here? I thought it only had to
do with the processor architecture, regarding the depth of the
prefetch queue and whether it was smart enough to know when to
invalidate the queue when you use short forward SMC.

On modern processors it's probably not a good idea to
depend upon a certain depth of prefetch queue, but in the
Olden Days (befoire CPUID) when there were only a few x86 CPUs and
they had known queue differences, you could identify the CPU by
its queue length. You modified code at known distances ahead,
and if the modifications were ignored you knew that those instructions

must have already been in the queue.

To answer the OP, self-modifying code is anything that alters
the actual code. The jump-into-instruction leaves the code
unaltered, and just takes a different path through it.

Best regards,


Bob Masta

DAQARTA v3.50
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, FREE Signal Generator
Science with your sound card!

.



Relevant Pages

  • Re: EnterCriticalSection
    ... The is a false assertion. ... You probably don't know that acquiring and releasing an uncontended lock involves the use of 2 interlocked RMW instructions and 2 memory barriers, one of which is very expensive. ... I am talking about an unbounded single producer/consumer wait-free queue that relies on the assertions made in the following paper: ...
    (microsoft.public.win32.programmer.kernel)
  • Re: How to kill a thread?
    ... The same methods as the normal Queue, but when you call a new .kill ... A client thread listens on a Queue for its instructions and replies ... That kind of thread can easily have an instruction which means quit. ... blocked on something else (eg listening to a socket). ...
    (comp.lang.python)
  • Re: Jumping into middle of instruction
    ... SMC is a different story. ... invalidate the queue when you use short forward SMC. ... but I encountered this prefetch issue also on modern CPUS. ... and if the modifications were ignored you knew that those instructions ...
    (comp.lang.asm.x86)
  • Re: Re: Delete All Messages from Queues
    ... because although the title describes how to flush the server ... que, the instructions will show you how to pause an SMTP server, then ... >> a queue by right clicking on the queue and choosing to ... >> individually access each recipient in the queue, ...
    (microsoft.public.exchange.admin)