|
|
Signal handling has been modified in Release 7.1.1 to push an extended user context structure (uxcontext_t) on the user stack during signal processing.
When an extended user context structure with saved floating point state
is pushed on the user stack, it will have both UC_FP and
UC_FPX set in the uc_flags
element, and the
floating point state will be saved in two places in the extended user
context.
The i387 floating point state will be saved in the
uc_mcontext.fpregs
element and the extended floating point
state will be saved in the __fpxregset
element.
To determine the type of user context passed to the operating system upon
returning from a signal handler, the kernel uses the first four bytes of the
16-byte padding (uc_filler
) in both ucontext_t and
uxcontext_t.
The new structure element is:
void *uc_ucontextp;
The uc_ucontextp
pointer is used to save the user address at
which a user context structure is pushed onto the user stack during signal
handling.
In all other cases, uc_contextp
is set to NULL.
When a user context structure with both UC_FP and UC_FPX
set in uc_flags
is passed to the operating system via the
setcontext(2)
system call, the operating system checks the address saved in
uc_ucontextp
against the address of the user context it
is being passed.
If uc_ucontextp
matches the address of the user context,
the system assumes it is being passed an extended user context pushed
on the user stack during signal handling.
In this case, the operating system will set the extended floating point
state and then overlay the i387 floating point state.
The i387 floating point state takes precedence because an application which does not know about the extended floating point state may have altered the contents of the i387 register state. If uc_ucontextp does not match the address of the user context passed to the setcontext system call, the operating system assumes it is being passed a copy of an extended user context that was made by an application that does not know about the extended floating point state. In this case, the system ignores the extended floating point state and treats the user context as being of type ucontext_t, restoring only the i387 floating point state.
uc_flags
element of the user context structure before returning.