Subject: Re: syscall() system call stub
To: Andrew Doran <ad@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-amd64
Date: 11/04/2007 10:31:19
On Sun, Nov 04, 2007 at 02:28:09AM +0000, Andrew Doran wrote:

> I'm not sure about this one. But it occurs to me syscall and _syscall can
> probably be turned into proper systems calls of their own *, so we don't
> have to do the tests in the syscall path. Does that make sense?
> 
> * ignoring systrace and to a much lesser extent ktrace

Yes I've had that thought as well.
I think 2 generic functions will suffice.

Adding a SYSCALL_NOTRACE [1] flag, and saving the 'code' from the syscall
entry trace for the exit one would solve the trace issue.

I think the code would be something like:

sys_syscall(lwp *l, register_t *args, register_t *rval)
{
	p = l->l_proc;
	code = args[0];
	callp = p->p_emul->e_sysent + code;
	if (p->p_trace_enabled)
		trace_enter(l, code, code, args + 1, callp->sy_argsize);
	return callp->sy_call(l, args + 1, rval);
}

Modulo some error checking and the argument types etc.

	David

[1] or maybe SYSCALL_INDIRECT

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