flat assembler
Message board for the users of flat assembler.

Index > Main > About MMX /FPU as parameter-register

Author
Thread Post new topic Reply to topic
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
I have used one time MMX/FPU registers to save and restore ESP/EBP in a proc.
I know they are volatile,like ECX/EDX etc., during context switching.

Is is dangerous to use them in the following way ? (i guess NO, because the whole remains in the same context, like respectively for ECX, or pending FPU instructions in other contexts do not affect too those in the thread)

Code:
 (pseudocode)
beginthread theproc
     ret

theproc:
     movd mm0,eax
        movd ecx,mm1
        call subproc
        ret

subproc:
     movd edx,mm0
        mov eax,ecx
 ret
    


Thanks,
hopcode
.
.
.
Post 30 Jan 2010, 01:22
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
No registers are volatile due to context switching. The OS has to guarantee this else nothing will work.

But the FPU/SIMD registers may be corrupted by API or library calls. Other than that you can use them as much as you please without any concern.
Post 30 Jan 2010, 01:30
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
OK,Alles Klar,thanks a lot for your fast answering.

btw: i was so sure about the fact that FPU/SIMD registers may be corrupted by API or library calls, (because i see them everyday running) that i have forgotten completely that an OS is behind all, and this is effectively the answer to my perplexity.
It is incredible how much clever Razz i am Laughing
Post 30 Jan 2010, 01:48
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.