Statistics

Members: 1927
News: 293
Web Links: 1
Visitors: 3933227

Who's Online

We have 2 guests online
Damn Vulnerable LinuxDamn Vulnerable Linux (DVL) is a Linux-based (modified Damn Small Linux) tool for IT-Security & IT-Anti- Security and Attack & Defense. [CLICK HERE FOR MORE INFOS! ]

Featured Conference Video

T16-Recon2006-Joe_Stewart-OllyBonE.gif OllyBone - Semi-Automatic Unpacking on IA-32. View the conference video here!
Home arrow Conference Proceedings arrow Assembly arrow Triple XOR
Triple XOR
User Rating: / 0
PoorBest 
Written by Jan Verhoeven   


Assembly Snippets

;Summary: exchange the contents of two registers using ; as few storage locations as possible ;Compatibility: all x86 assemblers
;Notes: Will work for memory locations, etc

        xor     ax, bx
xor     bx, ax
xor     ax, bx
Trailing Calls
by Jan Verhoeven

;This is really more of a trick than a snippet. It is quite common to come ;across code such as

                cmp     ax, [Sector][2]
jne     >L0
inc     ax
L0:     call    TestDrive
ret

;This amounts to two ret's, one in the above code and one in the TestDrive ;routine. To save a bit of space and overhead, we can make use of TestDrive's ;ret to return from our own routine:

                cmp     ax, [Sector][2]
jne     >L0
inc     ax
L0:     jmp     TestDrive