flat assembler
Message board for the users of flat assembler.

Index > DOS > using new 64-Bit-registers in unreal Mode with FASM

Author
Thread Post new topic Reply to topic
TomCat1000



Joined: 11 Sep 2014
Posts: 2
TomCat1000 11 Sep 2014, 11:47
hello,

I'm new in Flat Assembler.

in MASM it's only possible to use the 32-Bit Register.
like:
mov eax,ebx

----------------------------------------------------------------------------
Is it possible to use the new 64-Bit Register in unreal mode with FASM ?
for example:

mov rax, rbx
Post 11 Sep 2014, 11:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 11 Sep 2014, 11:49
Code:
use64
mov rax,rbx    
Post 11 Sep 2014, 11:49
View user's profile Send private message Visit poster's website Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 11 Sep 2014, 15:00
FASM has noting to do with unreal mode. Anyway even if you use "use64" the final result under unreal mode can be different from what you are probably expecting due to instruction encoding.
Post 11 Sep 2014, 15:00
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 11 Sep 2014, 22:34
If you can do an "unreal" mode with 64 bit registers, I would love to know how to do that (without paging; through segmentation). I am not far enough along in my latest iteration to "try" to play with that part, but soon.
Post 11 Sep 2014, 22:34
View user's profile Send private message Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 11 Sep 2014, 22:43
smiddy wrote:
If you can do an "unreal" mode with 64 bit registers, I would love to know how to do that (without paging; through segmentation). I am not far enough along in my latest iteration to "try" to play with that part, but soon.


I was kind of joking with my previous comment. You can't switch to unreal mode which is based on 32 bit PM to RM mode and use long mode instructions at the same time. What you can do is switch under DOS to long mode - see Japeth example for his JWASM. So 64bit DOS Extender is possible.
Post 11 Sep 2014, 22:43
View user's profile Send private message Reply with quote
TomCat1000



Joined: 11 Sep 2014
Posts: 2
TomCat1000 12 Sep 2014, 07:28
It's possible to use the 32-Bit Register (mov eax,ebx) in real and also in unreal mode. So you can use the Memory over 1MB and although flat graphic access.

I don't want to calculate addresses with the 64-Bit registers.
with 32 bit I can reach 4GB. This is enough, more than enough.
What I want is to use the 64-Bit-registers in my program to increase speed.

Isn't it possible?
Post 12 Sep 2014, 07:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 12 Sep 2014, 07:52
TomCat1000 wrote:
What I want is to use the 64-Bit-registers in my program to increase speed.
Speed increase is not guaranteed. It depends upon what you are doing.
TomCat1000 wrote:
Isn't it possible?
Sure. Just switch to 64-bit mode (AKA long mode) then you will get access to 64-bit instructions. You will also have to setup a paging table and various others things to get the whole system working in 64-bit mode.
Post 12 Sep 2014, 07:52
View user's profile Send private message Visit poster's website Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 12 Sep 2014, 08:02
TomCat1000 wrote:
It's possible to use the 32-Bit Register (mov eax,ebx) in real and also in unreal mode. So you can use the Memory over 1MB and although flat graphic access.

I don't want to calculate addresses with the 64-Bit registers.
with 32 bit I can reach 4GB. This is enough, more than enough.
What I want is to use the 64-Bit-registers in my program to increase speed.

Isn't it possible?


Use SSE?
Post 12 Sep 2014, 08:02
View user's profile Send private message Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP 12 Sep 2014, 08:05
revolution wrote:
Sure. Just switch to 64-bit mode (AKA long mode) then you will get access to 64-bit instructions. You will also have to setup a paging table and various others things to get the whole system working in 64-bit mode.


That is why I have been joking about unreal mode since unreal mode is not a long mode.

Just because you tell the assembler to generate x64 opcodes does not mean the CPU will handle as you wish. This why - as revolution said - you need to setup all the structures long mode requires and when you switch back to rm or pm you loose it so it does not work like in pm when you switch it on, change selectors limits and switch back to rm with limits still valid.
Post 12 Sep 2014, 08:05
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 19 Sep 2014, 08:24
TomCat1000 wrote:
What I want is to use the 64-Bit-registers in my program to increase speed. Isn't it possible?


Most likely NO. 80386 brought 32-bit registers usable in 16-bit real mode too (with some flaws). AFAIK 64-bit registers like RAX are NOT usable outside of the 64-bit long mode. But you can use MMX and SSE registers and instructions. The best way to increase speed is a better algorithm by the way. So stop dreaming about 65'536-bit registers and reveal what you are trying to do and can't get fast enough.

PS: Welcome to the FASM forum Smile

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 19 Sep 2014, 08:24
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.