Bug 32051 - getcontext/swapcontext/setcontext unnecessarely save and restore argument passing registers on SysV x86-64
Summary: getcontext/swapcontext/setcontext unnecessarely save and restore argument pas...
Status: UNCONFIRMED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-04 11:59 UTC by Stefano Guerrini
Modified: 2024-08-04 11:59 UTC (History)
1 user (show)

See Also:
Host:
Target: x86-64
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefano Guerrini 2024-08-04 11:59:55 UTC
The getcontext/swapcontext/setcontext functions save (restore) the RDI/RSI/RDX/RCX/R8/R9 registers for the current (target) context. However, according to the SysV x86-64 ABI these registers are not required to be preserved across function calls. 

I think that these registers shall be restored only for the first call of the context created via the makecontext().