linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SMC article
@ 2004-08-06  9:25 Maciej Hrebien
       [not found] ` <20040810190412.G20945@codepoet.unixcoders.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej Hrebien @ 2004-08-06  9:25 UTC (permalink / raw)
  To: linuxassembly; +Cc: linux-assembly

Hi Karsten,

long time ago i had briefly looked at your SMC article placed at
linuxassembly.org but yesterday i opened it once again (by accident) and
read it more careful ;) The code is quite tricky i admire but i have one
small suggestion: you write only about .bss, placing the code in and
execute in it. It gives the illusion that SMC technique can only be used
in .bss. I think you should consider writing something about
un-mprotect-ing .text and doing SMC on it just to avoid this kind of
illusion. Let me illustrate what i mean:

.set PAGE_SZ, 4096
.set PROT_RD, 1
.set PROT_WR, 2
.set PROT_EX, 4

.text

.globl _start
_start:
        mov     $125,%eax         # change protection of code seg...
        mov     $_start,%ebx
        mov     $PAGE_SZ,%ecx
        and     $~(PAGE_SZ-1),%ebx
        mov     $(PROT_RD|PROT_WR|PROT_EX),%edx
        int     $0x80
hello:
        mov     $4,%eax           # write some text...
        mov     $1,%ebx
        mov     $msg,%ecx
        mov     $msglen,%edx
        int     $0x80

        mov     $exit,%esi        # change our "hello" a little bit...
        mov     $hello,%edi
        mov     $(end-exit),%ecx
        rep     movsb

        jmp     hello             # and print it again... ;)
exit:
        mov     $1,%eax
        xor     %ebx,%ebx
        int     $0x80
end:
        msg:    .ascii "hello :)\n"
        msglen  = .- msg
.end


Please consider my suggestion in your future update(s) of the
article. With regards,

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-12  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-06  9:25 SMC article Maciej Hrebien
     [not found] ` <20040810190412.G20945@codepoet.unixcoders.org>
2004-08-12  6:00   ` Maciej Hrebien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).