flat assembler
Message board for the users of flat assembler.

Index > Main > Mixing x86 and x64 code

Author
Thread Post new topic Reply to topic
nts94



Joined: 10 Jun 2012
Posts: 11
nts94
Hi, is there any way to do that with fasm? I know yasm can, but i don't like it much

I need it because I'm trying to play with the "Heaven Gate" in Windows (you know, running 64 bits code inside a 32 bits program)


Last edited by nts94 on 10 Jun 2012, 22:17; edited 1 time in total
Post 10 Jun 2012, 20:28
View user's profile Send private message Reply with quote
Bargest



Joined: 09 Feb 2012
Posts: 79
Location: Russia
Bargest
If I understand you:
Code:
use64
 ; any x64 code here
use32
 ; any x32 code here
use64
 ; any x64 code here
use32
 ; any x32 code here
use64
 ; any x64 code here
...
    
Post 10 Jun 2012, 21:05
View user's profile Send private message Reply with quote
nts94



Joined: 10 Jun 2012
Posts: 11
nts94
Thank you, that's exactly what i was looking for!
Post 10 Jun 2012, 22:19
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 454
Location: Czech republic, Slovak republic
Feryno
and here you have ready samples for win
http://board.flatassembler.net/topic.php?p=140791#140791
Post 11 Jun 2012, 07:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
nts94



Joined: 10 Jun 2012
Posts: 11
nts94
Thanks for the examples, but i was faster (hehe) and i coded it before reading them (even so, they were useful, thanks)

Now my question is: i've coded the seh handler, and if anything goes wrong, it redirects me to the x86 mode. Anyway, i need to return from both functions (x64 and x86 mode) with a 32 bits retf (it doesn't make much sense to me, but it works), so i can't declare them with proc and endp, but i need to declare some locals in both of them, so, is there any way to declare local vars in an ebp-frame-less function? Is there any ready-made macro for this?

(in general, it would be useful to have this kind of macro, because there is no need for an EBP-frame, and this wastes a valuable register)

Note: i've read the documentation, and it states that there is a macro that is called whenever fasm has to make a prologue, but i'm looking for a reusable solution (i'm still learning about the preprocessor, i'm very amazed about things like load and store; it is very powerful!)
Post 11 Jun 2012, 19:18
View user's profile Send private message 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.

Powered by rwasa.