Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jul 1999 18:21:48 +0200
From:      Martin Cracauer <cracauer@cons.org>
To:        Peter Wemm <peter@netplex.com.au>
Cc:        Martin Cracauer <cracauer@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/i386/i386 genassym.c machdep.c src/sys/i386/include frame.h src/sys/kern kern_sig.c src/sys/sys signal.h signalvar.h
Message-ID:  <19990706182148.A23965@cons.org>
In-Reply-To: <19990706155057.C664178@overcee.netplex.com.au>; from Peter Wemm on Tue, Jul 06, 1999 at 11:50:57PM %2B0800
References:  <199907060713.AAA83501@freefall.freebsd.org> <19990706155057.C664178@overcee.netplex.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
In <19990706155057.C664178@overcee.netplex.com.au>, Peter Wemm wrote: 
> Martin Cracauer wrote:
> > cracauer    1999/07/06 00:13:49 PDT
> > 
> >   Modified files:
> >     sys/i386/i386        genassym.c machdep.c 
> >     sys/i386/include     frame.h 
> >     sys/kern             kern_sig.c 
> >     sys/sys              signal.h signalvar.h 
> >   Log:
> >   Except those applications that access hidden signal handler arguments
> >   bejond the documented third one. If you have applications that do,
> >   please let me know so that we take the opportunity to provide the
> >   functionality they need in a documented manner.
> 
> The one that springs to mind is cvsup (more specifically, the M3 runtime)
> that accesses sf_addr to get the faulting address.

The SA_SIGINFO implementation doesn't really move sf_addr (the first
three arguments are of the same size) and cvsup still runs on my
system. Will have to wait for distfile fetching before I can test a
build. 

> >   Also except application that use 'struct sigframe' directly. You need
> >   to recompile gdb and doscmd. `make world` is recommended.
> 
> I've been looking at the Alpha code to try and figure out how to do this
> there too.  The calling conventions have me a little confused but I think
> I have a handle on it.

I would suggest that FreeBSD/alpha doesn't start using two conventions
from start. You have few old applications to break.

Just treat every signal handler as it requires SA_SIGINFO, since you
need additional arguments anyway. If there are some
performance-critical computations to do for SA_SIGINFO arguments
later, you may choose to skip them out for signal that don't require
them. But the point is to push identical structures onto the stack for
both cases.

Use a struct like this for the arguments (like i386, but simplified
since only one case must be supported):

struct sigframe {
	int sf_signum;             /* Required by Posix, in register */
	siginfo_t *sf_siginfo;     /* Required by Posix, in register */
	void *sf_third;            /* Required by Posix, in register */
	struct siginfo_t sf_store; /* A place where the second
                                    * argument points to, on stack */
};

The first three arguments are pushed into registers by convetion, on
i386 and on alpha.

typedef struct {
	struct sigcontext si_sc;        /* Here's the sigcontext you
                                         * need. */
	int si_signo;			/* Required by Posix */
	int si_code;			/* Required by Posix */
	union sigval si_value;		/* Required by Posix */
} siginfo_t;

> The "problem" is that the Alpha doesn't have a sigframe, it passes the
> args to the called functions by register and a pointer to the sigcontext
> which was pushed onto the stack.

i386 has to push the first three arguemnts into registers as well.

> I am thinking that the easiest way to get this to work will be to
> additionally push a siginfo_t onto the stack for siginfo signals and
> change the code argument to point to it and leave the sigcontext
> pointer as is. 

I think it is easier to move the struct sigcontext into siginfo_t and
pass a siginto_t everytime. The overhead is minimal, the siginfo_t is
only a little larger than the struct sigcontext. It's a serious
simplification. 

I could give it a shot, but I don't have an alpha machine (I need root
access and either a serial console or a on-site person to boot a
know-good kernel on demand).

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/
  Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990706182148.A23965>