Re: [PATCH v2 7/9] x86/vdso: abstract out vdso system call internals

"H. Peter Anvin" <[email protected]>
Newsgroups org.kernel.vger.linux-sgx,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On 2025-11-13 20:40, H. Peter Anvin wrote:
> 
> For 64 bits, if you need frame pointer support *and* frob %rsp, using:
> 
> xchg %[arg],%%rbp
> <stuff>
> xchg %[arg],%%rbp
> 
> ... is probably easiest, with %[arg] in a register.
> 

Incidentally, ORC is one thing, but if you need DWARF information to be
correct for user space, it is definitely "fun".  With the xchg hack for 64
bits it is just a matter of using .cfi_def_cfa_register to change the frame
pointer around, but in the 32-bit case the best I could come up with was:

	.cfi_remember_state
	push %ebp
	.cfi_escape 0x0f,3,0x74,0,0x06	// CFA address in *%esp
	mov %eax, %ebp
	mov $syscall_no, %eax
	int $0x80
	pop %ebp
	.cfi_restore_state

Note that in both cases you need to *NOT* put in any of these CFI directives
when compiling without frame pointers (in which case you need to let gcc take
care of it if you want any hope of getting the CFI correct.)

	-hpa
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.