Subject: trap frames

From: Tim Newsham <[email-masked]>

Hi,
  I'm going over some things and I came across something I dont fully
understand.  Why are the stack frames set up the way they are?

struct frame {
        int     f_regs[16];
        short   f_pad;
        short   f_stackadj;
        u_short f_sr;
        u_int   f_pc;
        u_short f_format:4,
                f_vector:12;
        union F_u {
 
What is the purpose of the pad and stackadj fields?
If there was just one field I might think that it is used
to make sure other fields are aligned but thats 4 extra bytes.

Another thing is sometimes the usp is saved in f_regs and at
other times the ssp is saved.  I'm not so clear as to why
the usp is not always saved.  It also seems that if there
is a trap in supervisor mode then the usp gets written in
when the ssp should.  I guess this isnt a problem since
we're probably talking about a panic condition (?).

                                  Tim N.