RE: [RFC] Improve amd64 prologue analysis

Pierre Muller
2010-11-19T22:50:03Z

I think that your code does indeed catch some
instructions that are not covered by my patch,
especially in Windows DLL.

Concerning your pre_prologue function, I
think that I found the explanation in
"amd64 Prolog and Epilog" description page from MSDN.

This page states that before storing
non-volatile registers and allocating the local stack,
the register parameters should be placed into
the stack space that must be allocated anyhow
when calling a function according to the ABI.

http://msdn.microsoft.com/en-us/library/tawsa7cb.aspx

This means that basically only 8 patterns should
be possible:

movq %rcx, 8(%rsp) or movq %xmm0, 8(%rsp)
movq %rdx, 16(%rsp) or movq %xmm1, 16(%rsp)
movq %r8, 24(%rsp) or movq %xmm2, 24(%rsp)
movq %r9, 32(%rsp) or movq %xmm3, 32(%rsp)

But apparently KernelBase DLL
doesn't itself follow this rule,
and other registers are saved into this stack space
allocated for register parameters...
So that keeping it general makes sense.

Mark, what should we do about those patches?

Pierre