Tech Support > Microsoft Windows > Drivers > x64 ABI Frame Function - Function Table Entry
x64 ABI Frame Function - Function Table Entry
Posted by Terry on September 26th, 2005


The Hardware Compatibility Test 12.1 ABIPROV.EXE considers one of my
assembly language functions to be a leaf function, thus "push r15" etc. are
considered illegal.

Could this be because there is no "function table entry" specified for this
function? How does one specify a "function table entry" for a function
written in assembly language?

I have found the DDK information "Calling Convention for x64 64-Bit
Environments", the "Exception Handling for x64 64-Bit" details
RUNTIME_FUNCTION, UNWIND_INFO, etc., information, but does not specify how I
am supposed to specify such structures.

I remove NO_SAFESEH from my environment, which was there for compatibility
reasons. This did not magically fix everything.

I found information on the ML.EXE .SAFESEH directive, but no instructions on
how it is utilized. This is probably what I need to figure out.

Thanks.


Posted by Ivan Brugiolo [MSFT] on September 27th, 2005


On average, any assembly instruction that modifies the stack pointer must be
contained
in the prologue of a function, and, that will make the function non-leaf.
What's wrong with marking the function NESTED_ENTRY and using END_PROLGUE ?
The function table entry is generated by the linker with the information
supplied by the compiler and the assembler.

"Terry" <terry@cloth.robe> wrote in message
news:eT9wgOvwFHA.3892@TK2MSFTNGP12.phx.gbl...


Posted by Terry on September 27th, 2005


Finally, the missing .inc: MACAMD64.INC.

Much thanks!!

"Ivan Brugiolo [MSFT]" <Ivan.Brugiolo@online.microsoft.com> wrote in message
news:OPsx%23qywFHA.2924@TK2MSFTNGP15.phx.gbl...


Posted by Skywing on June 9th, 2006


If you use the appropriate assembler directives then a function table entry
should be generated - I believe you need to use the `frame' attribute in the
`proc' definition. For instance:

functionname proc public frame
push rbx
..pushreg rbx
..endprolog
..
..
..
pop rbx
ret
functionname endp

(You would still need to use the meta-directives for unwind information like
`.pushreg' in your prolog.)

If you really aren't doing any calls in the function though, I'm not sure
why it would be treating it like a non-leaf function.

"Terry" <terry@cloth.robe> wrote in message
news:eT9wgOvwFHA.3892@TK2MSFTNGP12.phx.gbl...


Posted by Ivan Brugiolo [MSFT] on June 9th, 2006


Alternatively, using standard macros:
//------------------------------

include macamd64.inc

LEAF_ENTRY _test_leaf, _TEXT$00

mov [rsp+ 8h],rcx
mov [rsp+10h],rdx
mov [rsp+18h],r8
mov [rsp+20h],r9

ret
LEAF_END _test_leaf, _TEXT$00

public _test_nested
NESTED_ENTRY _test_nested, _TEXT$00

sub rsp, 98h
.allocstack 98h
END_PROLOGUE

mov rcx, 1
mov rdx, 2
mov r8, 3
mov r9, 4

call _test_leaf

add rsp, 98h
ret
NESTED_END _test_nested, _TEXT$00

END

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Skywing" <skywing_NO_SPAM_@valhallalegends.com> wrote in message
news:%23osvQM9iGHA.1208@TK2MSFTNGP02.phx.gbl...


Posted by Skywing on June 9th, 2006


Didn't even know those existed. BTW, the documentation on how to use the
prolog metainstructions *is* a bit sparse (at least in the 3780.1830 DDK).
I had to go hunting around on Google for awhile to actually come up with any
useful examples for an assembler feature - kind of a pain.

"Ivan Brugiolo [MSFT]" <Ivan.Brugiolo@online.microsoft.com> wrote in message
news:OI5LnX9iGHA.2188@TK2MSFTNGP04.phx.gbl...


Posted by Ivan Brugiolo [MSFT] on June 9th, 2006


When I googled these word in the `ivan brugiolo x64 ASM`
in the `groups` category, the search returned several examples
and discussions from the past,
starting from the calling convention, continuing to
the way to use ASM in a SORUCES, and APIProv validation.

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Skywing" <skywing_NO_SPAM_@valhallalegends.com> wrote in message
news:OApWMb9iGHA.4284@TK2MSFTNGP05.phx.gbl...


Posted by Skywing on June 9th, 2006


Yeah - I guess the point I was trying to make is that it would be good to
have at least some minimal level of documentation included with the DDK on
this subject, vs virtually none currently.

"Ivan Brugiolo [MSFT]" <Ivan.Brugiolo@online.microsoft.com> wrote in message
news:u6NeLs9iGHA.4368@TK2MSFTNGP03.phx.gbl...



Similar Posts