[fpc-devel] registers used in function call, any rule?

Martin lazarus at mfriebe.de
Wed Apr 27 19:51:36 CEST 2011


Not sure were I got my original info from... , but at current 
lazarus-ide (debugger) assumes that (on 64 bit) arguments (to 
fpc_raiseexceptions) are passed in RDI, RSI, RDX.

I thought some one had told me that this was some kind of standard and 
would always work? (I may be wrong...)


Now I just been running some code in the debugger 64 bit, win XP.

And the first arg was either in rax or rcx; see assembler below

Any ideas how to know what register to expect?


00000001000B1F6B ff90f8000000             callq  *0xf8(%rax)
00000001000B1F71 39d8                     cmp    %ebx,%eax
00000001000B1F73 7d2f                     jge    0x1000b1fa4 
<CLASSES_TSTREAM_$__READBUFFER$formal$LONGINT+84>
00000001000B1F75 4c8b059c5f9d00           mov    
0x9d5f9c(%rip),%r8        # 0x100a87f18 <RESSTR_RTLCONSTS_SREADERROR+8>
00000001000B1F7C 488d153d499c00           lea    
0x9c493d(%rip),%rdx        # 0x100a768c0 <VMT_CLASSES_EREADERROR>
00000001000B1F83 48b90000000000000000     movabs $0x0,%rcx
00000001000B1F8D e8ee9df7ff               callq  0x10002bd80 
<SYSUTILS_EXCEPTION_$__CREATE$ANSISTRING$$EXCEPTION>
00000001000B1F92 4889c1                   mov    %rax,%rcx
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00000001000B1F95 4989e8                   mov    %rbp,%r8
00000001000B1F98 488d15f6ffffff           lea    -0xa(%rip),%rdx        
# 0x1000b1f95 <CLASSES_TSTREAM_$__READBUFFER$formal$LONGINT+69>
00000001000B1F9F e88ccaf5ff               callq  0x10000ea30 
<fpc_raiseexception>



More information about the fpc-devel mailing list