flat assembler
Message board for the users of flat assembler.
Index
> Main > Getting value of EIP |
Author |
|
f0dder 07 Jul 2005, 18:00
Code: mov eax, .label .label: |
|||
07 Jul 2005, 18:00 |
|
ronware 07 Jul 2005, 18:10
Cute; but this is a piece of 'template' code which will be moved into place; it needs to be position independent
|
|||
07 Jul 2005, 18:10 |
|
THEWizardGenius 07 Jul 2005, 18:17
I don't think there is any other way, at least no shorter way. This is the easiest and fastest way. If you CALL FAR remember to clean up the stack.
This is the shortest amount of code; I don't know if there is any faster way. I don't think there is any way to do it without CALL or unless you use f0dder's code. |
|||
07 Jul 2005, 18:17 |
|
ronware 07 Jul 2005, 18:33
Yes, it works fine -- but I am manually constructing the code in the space it needs to go, now. Much, much faster than what was happening before.
|
|||
07 Jul 2005, 18:33 |
|
f0dder 07 Jul 2005, 18:43
Quote:
I know, I was just doing a bit of fun-poking There are other ways, but this is the shortest and fastest (at least what I know of) - other methods are usually employed by evil people who want to circumvent heuristic antivirus scanners. If you have speed problems, you need to look for them elsewhere. Construction + executing code has quite some penalty in itself, especially if you need to call the code short after you construct it. On modern processors, you only want to do code construction or self-modifying code if the modifications are few and the executions are many. |
|||
07 Jul 2005, 18:43 |
|
ronware 07 Jul 2005, 19:00
Hi, f0dder -
This is my Forth system, Reva, which interprets code into a compiled form for execution. So indeed, the modifications are few compared to the execution of the code. |
|||
07 Jul 2005, 19:00 |
|
f0dder 07 Jul 2005, 19:59
Do you have to make PIC code anyway? Wouldn't it be possible to apply relocations?
|
|||
07 Jul 2005, 19:59 |
|
ronware 07 Jul 2005, 20:04
Actually I am applying relocations, because otherwise I wouldn't be able to use the label method here. If I could have PIC code, I wouldn't have to do any tricks.
|
|||
07 Jul 2005, 20:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.