flat assembler
Message board for the users of flat assembler.
Index
> Windows > Stack frames in Delphi |
Author |
|
tthsqe 22 Feb 2014, 23:54
Unclear what you are trying to do in these examples.
If you don't know N, how can you write sub rsp,N*8 and lea rsp,[rbp+N*8]? Clearly who/whatever wrote these two instructions would know N. |
|||
22 Feb 2014, 23:54 |
|
typedef 23 Feb 2014, 06:00
@CandyMan From what I can tell, you need to read this :
|
|||
23 Feb 2014, 06:00 |
|
CandyMan 23 Feb 2014, 12:09
I would like to write exception call stack unit. In 32-bit mode there is no problem.
|
|||
23 Feb 2014, 12:09 |
|
revolution 23 Feb 2014, 12:25
If Delphi always uses the same prolog code then you can use the function address and read the contents of the value of N from the encoding:
Code: push rbp ;db 0x55 sub rsp,3*8 ;db 0x48,0x83,0ec, db N*8 <--- byte values from -128 to +124 push rbp ;db 0x55 sub rsp,30*8 ;db 0x48,0x81,0ec, dd N*8 <--- dword values from -2G to +2G |
|||
23 Feb 2014, 12:25 |
|
baldr 23 Feb 2014, 12:51
CandyMan,
That'll probably take some efforts to implement it right. Given this simple program, Delphi XE5 generates peculiar x86-64 code: Code: {$APPTYPE CONSOLE} program HelloWorld; procedure Say(a0, a1, a2, a3: LongInt; const It: string); procedure SayIt(b0: LongInt); procedure ReallySayIt(c0: LongInt); procedure SayItAtOnceYouDummKopf(d0: LongInt); begin WriteLn(It); end; begin SayItAtOnceYouDummKopf(3); end; begin ReallySayIt(2); end; begin SayIt(1); end; begin Say(0, 0, 0, 0, 'Hello, world!'); end. |
|||
23 Feb 2014, 12:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.