flat assembler
Message board for the users of flat assembler.
Index
> Windows > 64-bit 0xFFFFFFFF "Value out of range"? Goto page Previous 1, 2, 3 Next |
Author |
|
KingDemon 24 Sep 2009, 16:57
FYI: PAINTSTRUCT needs the same kind of padding
|
|||
24 Sep 2009, 16:57 |
|
asmfan 24 Sep 2009, 18:11
Well the next question is how to obtain
4825FFFFFFFF opcode from fasm? fasm only produces short form with negative values. Are there many basic opcodes that are unreachable for fasm like this above? |
|||
24 Sep 2009, 18:11 |
|
Tomasz Grysztar 24 Sep 2009, 18:25
In 32-bit world you could force such opcodes with "word" or "dword" operators, however for 64-bit world, where the immediate is not a full-size in such case I have no suitable syntax option that would be considered to allow such opcode generation.
So I'm afraid that if you really need this exact opcode (perhaps for the purpose of self-modifying code?), you may have to do it like: Code: and rax,-80000000h store dword -1 at $-4 |
|||
24 Sep 2009, 18:25 |
|
asmfan 24 Sep 2009, 18:44
Then as i supposed tons of opcode are lost in this formula rex.w + sign-ext. dword. Any other formulas as examples? Will you think of fixing this with some new keywords or just leave as is, Tomasz?
|
|||
24 Sep 2009, 18:44 |
|
Tomasz Grysztar 24 Sep 2009, 19:30
The assembler is an abstraction from machine language, and therefore assembly language sees the instructions from the functional point of view, not the opcode point of view. For example you have two way to encode "and eax,ebx": 21 D8 or 23 C3. Since they are functionally equivalent and also size equivalent in this case, assembler is free to choose any of them (it is sometimes used to recognize a "footprint" of an assembler or compiler, BTW).
For the instructions that are functionally equivalent, but not equivalent in size, fasm simply chooses the shortest one, because in this sense it is an optimizing assembler. The only case when the instructions that are otherwise completely equivalent, but have different sizes, would not be equivalent enough for you, might be some cases of self-modyfing code, where you need to access the displacement field. This is a very rare application, though, and if you are doing such things, then having to use the tricks like above shouldn't really be a problem. Therefore I don't think there really anything that would require "fixing" here. One of the purposes of assembly language is to abstract you from the encoding so that you can focus on what the instructions do, not how they are encoded. |
|||
24 Sep 2009, 19:30 |
|
LocoDelAssembly 24 Sep 2009, 19:37
Quote:
There is another application, you may need to do that for alignment so instead of padding with instructions that do nothing, you just pad making the instructions above the label bigger. |
|||
24 Sep 2009, 19:37 |
|
Tomasz Grysztar 24 Sep 2009, 19:42
LocoDelAssembly wrote:
But to do that manually you also have to know the addresses and instruction sizes yourself. Thus, as it is with self-modifying code, if you really are that much into digging into machine code, you won't mind to use some specialized directives instead of pure assembly language, which is focused on the meaning of instruction, not encoding. |
|||
24 Sep 2009, 19:42 |
|
Borsuc 24 Sep 2009, 19:49
Tomasz Grysztar wrote:
one could get rid of the "footprint" by randomizing the equivalent instructions, right? _________________ Previously known as The_Grey_Beast |
|||
24 Sep 2009, 19:49 |
|
Tomasz Grysztar 24 Sep 2009, 19:52
Borsuc wrote: one could get rid of the "footprint" by randomizing the equivalent instructions, right? |
|||
24 Sep 2009, 19:52 |
|
asmfan 24 Sep 2009, 19:55
This is about HLL concept you're talking about but assembler is a bit higher layer of CPU (machine) language. All the power of assembler is that you can talk that language w/ human mnemonics and letters with all the power and variety that machine lang. has. Then why assembler should leave all the power (and often extra) of machine lang.? The optimal way to avoid those cliche or "footprints" is to use RNG to chose between them when the sizes of resulting equivalent opcodes are the same. But this isn't the case when some machine mnemonics are unreachable in assembly language itself w/o some hacks (hardcoding). The point is that every machine mnemonics should be available thru assembly lang. regardless how difficult/weird/hard/suboptimal machine mnemonics is. That's the case.
And relatively optimization - it's optional and is ON in fasm by default but why sacrifice some words (in CPU language) in size sake? Alphabet optimization? Entropy reduction? RISC? )) a bit too much from me) but anyway RNG in equal code generation is good (or evil to debug)? |
|||
24 Sep 2009, 19:55 |
|
Tomasz Grysztar 24 Sep 2009, 19:58
asmfan wrote: This is about HLL concept you're talking about but assembler is a bit higher layer of CPU (machine) language. All the power of assembler is that you can talk that language w/ human mnemonics and letters with all the power and variety that machine lang. has. Then why assembler should leave all the power (and often extra) of machine lang.? The optimal way to avoid those cliche or "footprints" is to use RNG to chose between them when the sizes of resulting equivalent opcodes are the same. But this isn't the case when some machine mnemonics are unreachable in assembly language itself w/o some hacks (hardcoding). The point is that every machine mnemonics should be available thru assembly lang. regardless how difficult/weird/hard/suboptimal machine mnemonics is. That's the case. So how would you like to write the instructions for 21 D8 and 23 C3 opcodes to make the different? And why would you need it? I don't agree that is a HLL concept. This is exactly the assembly language concept in my opinion - the abstraction from machine codes into area of functionality of instructions. |
|||
24 Sep 2009, 19:58 |
|
Tomasz Grysztar 24 Sep 2009, 20:03
You may find much older discussion on this topic here:
http://board.flatassembler.net/topic.php?t=3866 |
|||
24 Sep 2009, 20:03 |
|
asmfan 24 Sep 2009, 20:08
In some cases RNG as i said this case of instruction is exactly unreachable in their full equivalent w/ any input params. f(s, s=any) == g(m,m=any) then RNG(f, g)
but those that are not d(g, g=any) <> t(w,w=any) even if in some case must be reached directly thru asm in theory. Besides if one is subset of other even if optimal in size then the superset must be reached by asm too as covering more variety of params (imm32). |
|||
24 Sep 2009, 20:08 |
|
asmfan 24 Sep 2009, 20:12
Yeah, that one was a year before i came here)) missed it, was a funny one, he-he, "damn capitalists"(c) )))
|
|||
24 Sep 2009, 20:12 |
|
revolution 25 Sep 2009, 01:34
I have not yet seen a good use for polymorphic code. If you are writing polymorphic code then I suggest that your reasons for wanting it are not exactly saintly.
Can you show a dire need for it that is used in a good application that users desire and request? |
|||
25 Sep 2009, 01:34 |
|
asmfan 25 Sep 2009, 08:05
revolution wrote: I have not yet seen a good use for polymorphic code. If you are writing polymorphic code then I suggest that your reasons for wanting it are not exactly saintly. Users request Java and not variation of encoding of the same instruction that in most case fasm allows in ia-32 (not ia-32e alas). If you need explanation for what's happening in this thread (if you don't want to read it yourself) then see below: regs i/o are equal in this way f() = 21 D8 g() = 23 C3 one is subset of other and superset is unreached in some cases thru assembler. d() = 48 81 E0 * t() = 48 83 E0 * And now ask yourself where is polimorphic somewhere. Also i haven't seen users on this board only hi-quality (hope) low-level programmers. Maybe this is some kind of paranoia of you made by asm* nicks of others here? _________________ Any offers? |
|||
25 Sep 2009, 08:05 |
|
revolution 25 Sep 2009, 08:14
I think I got muddled with the thread that Tomasz Grysztar linked to where it talks about polymorphism.
asmfan: I don't understand your Java reference. I can't get how that relates to assembly. Are you writing a JIT compiler? |
|||
25 Sep 2009, 08:14 |
|
Borsuc 25 Sep 2009, 14:27
revolution wrote: Can you show a dire need for it that is used in a good application that users desire and request? But self-modifying constants is very useful, I used it myself a lot. _________________ Previously known as The_Grey_Beast |
|||
25 Sep 2009, 14:27 |
|
asmfan 25 Sep 2009, 18:28
Java and other isn't related but is requested by users more than assembly w/ plenty of ways to encode the same instruction.
+We are talkin about different things. you ask different questions i give different answers. it's the matter of talking on different things (and not reading previous posts/discussion). |
|||
25 Sep 2009, 18:28 |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.