flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > [fasmarm] Is it possible to disable optimizations?

Author
Thread Post new topic Reply to topic
Kellan2255



Joined: 03 Jul 2024
Posts: 3
Kellan2255 03 Jul 2024, 18:32
I'm trying to write some CPU tests and fasm keeps optimizing my LDMs and STMs to LDRs and STRs. I can sort of work around it by hand assembling the instructions and writing out the opcode with an inline dw, but it's very slow, hard to modify, and hard to read. Is there any way to disable optimizations entirely?
Post 03 Jul 2024, 18:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20422
Location: In your JS exploiting you and your system
revolution 03 Jul 2024, 19:48
Kellan2255 wrote:
Is there any way to disable optimizations entirely?
I'll assume you are asking about fasmarm.

You can disable the availability of encodings using the processor and coprocessor directives. This will prevent fasmarm from finding some alternative instructions if they are not made available to it.
Post 03 Jul 2024, 19:48
View user's profile Send private message Visit poster's website Reply with quote
Kellan2255



Joined: 03 Jul 2024
Posts: 3
Kellan2255 03 Jul 2024, 20:03
These are instructions that are available in all versions of the ARM architecture.
Post 03 Jul 2024, 20:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20422
Location: In your JS exploiting you and your system
revolution 03 Jul 2024, 20:25
All instructions have a processor or a coprocessor switch to enable/disable them.

Please give an example of what you are trying to achieve.
Post 03 Jul 2024, 20:25
View user's profile Send private message Visit poster's website Reply with quote
Kellan2255



Joined: 03 Jul 2024
Posts: 3
Kellan2255 03 Jul 2024, 20:59
In this case where I'm trying to test STM with r15 as the base register and various register list combinations
Code:
stmib r15, {r0}    

gets turned into
Code:
str r0, [r15, #4]    


The instruction does the same thing. It's just not what I'm trying to test.
Post 03 Jul 2024, 20:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20422
Location: In your JS exploiting you and your system
revolution 03 Jul 2024, 21:20
That is because r15 is not valid as a source register for LDM, so fasmarm will select something else that is valid as a replacement.

Both of those instructions are V1 so you are correct that deselecting a processor bit won't be able to prevent the substitution without modifying the source code.
Post 03 Jul 2024, 21:20
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.