Re: Jumping into middle of instruction
- From: NoSpam@xxxxxxxxxxx (Bob Masta)
- Date: Fri, 29 Feb 2008 13:08:57 GMT
On Thu, 28 Feb 2008 15:59:56 +0100, "Wolfgang Kern"
<spamtrap@xxxxxxxxxx> wrote:
Bob Masta wrote:
mybwpp asked:
Can we categorize this technique of jumping into middle ofNo, SMC is a different story.
instructions, as 'self modifying code'?
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?
You can't direct write to CodeSeg in protected mode.
That may be true in some sense, but not as a practical
matter... it is easy to create apps with combined code+data
that allow you to write anywhere in your own program space.
I use a .data? (BSS) section for uninitialized data and a
...code section for everything else. The linker needs to have
/SECTION:.text,ERW to handle this properly.
Self-modifying code seems to have a bad name, but it
shouldn't. Think about how you would do self-decryption
without 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: robertwessel2@xxxxxxxxx
- 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
- Re: Jumping into middle of instruction
- From: Bob Masta
- Re: Jumping into middle of instruction
- From: Wolfgang Kern
- Jumping into middle of instruction
- Prev by Date: referring to segment offsets in read address mode
- Next by Date: Re: Seg fault with hla 1.99 on Fedora 8 linux
- Previous by thread: Re: Jumping into middle of instruction
- Next by thread: Re: Jumping into middle of instruction
- Index(es):