flat assembler
Message board for the users of flat assembler.

Index > Linux > non-volatile register as syscall buffer?

Author
Thread Post new topic Reply to topic
Lurker



Joined: 07 Feb 2012
Posts: 6
Lurker 07 Feb 2012, 20:25
Code:
push 4
pop edx
;mov ecx,esi (does not work)
mov ecx,tsz;(does work)
mov ebx,eax
push 3
pop eax
int 0x80
    


I'm a novice to asm and I've been trying to code a program that needs to read 4 bytes from a file to esi/edi.
If ecx holds the offset of tsz (reserved memory) everything works fine and later I can mov esi,[tsz]. Is it possible to read to esi/edi directly?
Post 07 Feb 2012, 20:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 08 Feb 2012, 15:00
Lurker wrote:
Is it possible to read to esi/edi directly?
If I understand you properly then the answer is no. You have to supply a memory address for the destination. You can't make ecx point to esi, you can only copy the contents of esi into ecx.
Post 08 Feb 2012, 15:00
View user's profile Send private message Visit poster's website Reply with quote
Lurker



Joined: 07 Feb 2012
Posts: 6
Lurker 08 Feb 2012, 15:20
yes, I was asking If It was possible to make ecx point to esi.
Thanks.
Post 08 Feb 2012, 15:20
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 08 Feb 2012, 17:39
only instructions points to registers, you can change some opvalues to change the register reference in an instruction, and if you use ecx to contain that value (cl is enough), you can use as a pointer... but;;; hem.
Post 08 Feb 2012, 17:39
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.