flat assembler
Message board for the users of flat assembler.
Index
> Main > POPA |
Author |
|
revolution 06 Oct 2015, 11:55
l4m2 wrote: ... does that mean on some old cpus (E)SP is poped and some new ones doesn't? Note that the docs state that SP is not used so to find the bug in a real chip might be difficult. |
|||
06 Oct 2015, 11:55 |
|
AsmGuru62 06 Oct 2015, 14:38
I am not sure there IS a bug.
It is a single instruction and at the end of it -- ESP is adjusted by 32 bytes (8 registers) on any CPU. Why do we need to know how the micro-code works inside the instruction? Just curiosity, maybe. |
|||
06 Oct 2015, 14:38 |
|
l4m2 06 Oct 2015, 17:42
So you mean I can just use this to clear the seven registers:
mov ecx, 8 a:push 0 loop a popa |
|||
06 Oct 2015, 17:42 |
|
AsmGuru62 06 Oct 2015, 21:55
I think so.
I would just do XOR 7 times: Code: xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx xor edi, edi xor esi, esi xor ebp, ebp |
|||
06 Oct 2015, 21:55 |
|
shutdownall 07 Oct 2015, 00:23
I think this could be maybe executed faster:
Code: xor eax,eax mov ebx,eax mov ecx,eax mov edx,eax mov edi,eax mov esi,eax mov ebp,eax So depending on how pipeline execution is optimized it could be faster with a mov instruction than always "calculating" and using/blocking the internal ALU for an XOR operation. I would say an XOR operation is more "expensive" than a simple mov (copy of data). |
|||
07 Oct 2015, 00:23 |
|
revolution 07 Oct 2015, 00:42
shutdownall wrote: I think this could be maybe executed faster: |
|||
07 Oct 2015, 00:42 |
|
l4m2 07 Oct 2015, 04:16
usually xor is faster this is just for shortening when the code runs rarely
|
|||
07 Oct 2015, 04:16 |
|
shutdownall 07 Oct 2015, 11:53
revolution wrote: I doubt it would make any difference except for the extra dependency you have from eax propagating to the other registers. In fact this is a very untypical piece of code. I never saw a situation where all or so many registers have to be preloaded with 0. So at the end this is one of the endless academic approaches. |
|||
07 Oct 2015, 11:53 |
|
l4m2 08 Oct 2015, 10:58
shutdownall wrote:
I was going to jump to another process. Some registers may contain private value so I had to do this |
|||
08 Oct 2015, 10:58 |
|
shutdownall 09 Oct 2015, 19:54
l4m2 wrote: I was going to jump to another process. Some registers may contain private value so I had to do this You meant this as a security issue to hide information to other processes/callers ? Interesting. |
|||
09 Oct 2015, 19:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.