Re: Jumping into middle of instruction
- From: NoSpam@xxxxxxxxxxx (Bob Masta)
- Date: Thu, 28 Feb 2008 12:52:45 GMT
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!
.
- Follow-Ups:
- Re: Jumping into middle of instruction
- From: Wolfgang Kern
- Re: Jumping into middle of instruction
- References:
- Jumping into middle of instruction
- From: mybwpp@xxxxxxxxxxxxxx
- Re: Jumping into middle of instruction
- From: Wolfgang Kern
- Re: Jumping into middle of instruction
- From: mybwpp@xxxxxxxxxxxxxx
- Re: Jumping into middle of instruction
- From: Wolfgang Kern
- Jumping into middle of instruction
- Prev by Date: Re: GNU Assembler (GAS) query
- Next by Date: Re: Jumping into middle of instruction
- Previous by thread: Re: Jumping into middle of instruction
- Next by thread: Re: Jumping into middle of instruction
- Index(es):
Relevant Pages
|