fibers icon indicating copy to clipboard operation
fibers copied to clipboard

System V x86-64 ABI Red Zone

Open mghcoder opened this issue 4 years ago • 0 comments

This was a great read, thanks for sharing.

I think you misinterpreted the location of the Red Zone on System V x86-64 ABI, or maybe there was a problem with the Wikipedia article that you used as a reference at the time. As you can see on page 18 of the System V x86-64 documentation, the Red Zone is a 128 bytes region below current %rsp, and it moves along as %rsp grows downwards.

There is no need to decrement 128 bytes from the top of the stack pointer when creating a new context, the following lines of code may be removed:

// Make 128 byte scratch space for the Red Zone. This arithmetic will not unalign // our stack pointer because 128 is a multiple of 16. The Red Zone must also be // 16-byte aligned. sp -= 128;

mghcoder avatar Aug 31 '21 03:08 mghcoder