Question about STD64 ABI

Torbjorn Granlund tg at
Fri Mar 30 11:29:52 CEST 2012

bodrato at writes:

  "The 128-byte area beyond the location pointed to by %rsp is considered to
  be reserved and shall not be modified by signal or interrupt handlers.
  Therefore, functions may use this area for temporary data that is not
  needed across function calls. In particular, leaf functions may use this
  area for their entire stack frame, rather than adjusting the stack pointer
  in the prologue and epilogue."
  If I understand correctly, this means that we can directly use:
  	mov	%rbx, -8(%rsp)
  	mov	%rbp, -16(%rsp)
  	mov	%r12, -24(%rsp)
  	mov	%r13, -32(%rsp)
  	mov	%r14, -40(%rsp)
  DOS64 compatibility apart, is there any other reason not to use the second
Perhaps something similar is also allowed on DOS64?

I wasn't aware if this for AMD64, but I now it is allowed under some
other ABIs.

I don't think interrupt handlers under *nix is ever a problem when it
comes to data under the stack pointer; the problem might be that pages
under it might not be considered dirty and properly paged out.

If GCC generates code that takes advantage if this rule, then I expect
no problems at any standard platform.

I suggest that we follow the ABI.  If we trip over some non-conforming
system, we deal with it.  We need to handle DOS64 specially anyway
(unless we find a similar rule there).


More information about the gmp-devel mailing list