6f77685609
mainly in the kernel and headers. This split based on work by Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture port. . kernel does not program the interrupt controller directly, do any other architecture-dependent operations, or contain assembly any more, but uses architecture-dependent functions in arch/$(ARCH)/. . architecture-dependent constants and types defined in arch/$(ARCH)/include. . <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now, architecture-independent functions. . int86, sdevio, readbios, and iopenable are now i386-specific kernel calls and live in arch/i386/do_* now. . i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have gone, and 'machine.protected' is gone (and always taken to be 1 in i386). If 86 support is to return, it should be a new architecture. . prototypes for the architecture-dependent functions defined in kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h . /etc/make.conf included in makefiles and shell scripts that need to know the building architecture; it defines ARCH=<arch>, currently only i386. . some basic per-architecture build support outside of the kernel (lib) . in clock.c, only dequeue a process if it was ready . fixes for new include files files deleted: . mpx/klib.s - only for choosing between mpx/klib86 and -386 . klib86.s - only for 86 i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/: . mpx386.s (entry point) . klib386.s . sconst.h . exception.c . protect.c . protect.h . i8269.c
63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
/* The kernel call that is implemented in this file:
|
|
* m_type: SYS_SIGRETURN
|
|
*
|
|
* The parameters for this kernel call are:
|
|
* m2_i1: SIG_ENDPT # process returning from handler
|
|
* m2_p1: SIG_CTXT_PTR # pointer to sigcontext structure
|
|
*
|
|
*/
|
|
|
|
#include "../system.h"
|
|
#include <string.h>
|
|
#include <signal.h>
|
|
#include <sys/sigcontext.h>
|
|
|
|
#if USE_SIGRETURN
|
|
|
|
/*===========================================================================*
|
|
* do_sigreturn *
|
|
*===========================================================================*/
|
|
PUBLIC int do_sigreturn(m_ptr)
|
|
message *m_ptr; /* pointer to request message */
|
|
{
|
|
/* POSIX style signals require sys_sigreturn to put things in order before
|
|
* the signalled process can resume execution
|
|
*/
|
|
struct sigcontext sc;
|
|
register struct proc *rp;
|
|
phys_bytes src_phys;
|
|
int proc;
|
|
|
|
if (! isokendpt(m_ptr->SIG_ENDPT, &proc)) return(EINVAL);
|
|
if (iskerneln(proc)) return(EPERM);
|
|
rp = proc_addr(proc);
|
|
|
|
/* Copy in the sigcontext structure. */
|
|
src_phys = umap_local(rp, D, (vir_bytes) m_ptr->SIG_CTXT_PTR,
|
|
(vir_bytes) sizeof(struct sigcontext));
|
|
if (src_phys == 0) return(EFAULT);
|
|
phys_copy(src_phys, vir2phys(&sc), (phys_bytes) sizeof(struct sigcontext));
|
|
|
|
sc.sc_psw = rp->p_reg.psw;
|
|
|
|
#if (_MINIX_CHIP == _CHIP_INTEL)
|
|
/* Don't panic kernel if user gave bad selectors. */
|
|
sc.sc_cs = rp->p_reg.cs;
|
|
sc.sc_ds = rp->p_reg.ds;
|
|
sc.sc_es = rp->p_reg.es;
|
|
#if _WORD_SIZE == 4
|
|
sc.sc_fs = rp->p_reg.fs;
|
|
sc.sc_gs = rp->p_reg.gs;
|
|
#endif
|
|
#endif
|
|
|
|
/* Restore the registers. */
|
|
#if _MINIX_CHIP == _CHIP_POWERPC
|
|
memcpy(&rp->p_reg, &sc.sc_regs, sizeof(struct stackframe_s));
|
|
#else
|
|
memcpy(&rp->p_reg, &sc.sc_regs, sizeof(struct sigregs));
|
|
#endif
|
|
return(OK);
|
|
}
|
|
#endif /* USE_SIGRETURN */
|
|
|