Subject: syscall() system call stub
To: None <port-amd64@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-amd64
Date: 11/03/2007 11:28:11
The amd64 stub for syscall() is:

ENTRY(syscall)
	movl	%edi,%eax
	syscall

(from libc/arch/x86_64/sys/syscall.S)

This looks completely wrong to me.
I think it needs to be:
	mov	$0,%eax
	mov	%rcx,%r10
	syscall

probably generated by RSYSCALL(syscall)

I actually suspect there are no actual calls to it in the amd64 userspace.

Which is rather fortunate since there are calls lurking like:
	syscall(SYS___syscall, SYS_foo, args)
which really isn't going to DTRT unless syscall() is implemented in
the library - which it cannot be for some architectures like amd64 (& sparc)
where some, but not all, of the system call arguments are passed in registers.

	David

-- 
David Laight: david@l8s.co.uk