1995-06-25 17:32:43 +00:00
|
|
|
|
/*-
|
|
|
|
|
* Copyright (c) 1994-1995 S<EFBFBD>ren Schmidt
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer
|
|
|
|
|
* in this position and unchanged.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
* derived from this software withough specific prior written permission
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
|
* $FreeBSD$
|
1995-06-25 17:32:43 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/systm.h>
|
1995-11-22 07:43:53 +00:00
|
|
|
|
#include <sys/sysproto.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#include <sys/proc.h>
|
|
|
|
|
#include <sys/signalvar.h>
|
|
|
|
|
|
2000-08-22 01:49:54 +00:00
|
|
|
|
#include <machine/../linux/linux.h>
|
2000-11-10 21:30:19 +00:00
|
|
|
|
#ifdef __alpha__
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#include <linux_proto.h>
|
2000-11-10 21:30:19 +00:00
|
|
|
|
#else
|
|
|
|
|
#include <machine/../linux/linux_proto.h>
|
|
|
|
|
#endif
|
2000-08-22 01:49:54 +00:00
|
|
|
|
#include <compat/linux/linux_signal.h>
|
|
|
|
|
#include <compat/linux/linux_util.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
2000-08-22 01:49:54 +00:00
|
|
|
|
void
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_to_bsd_sigset(linux_sigset_t *lss, sigset_t *bss)
|
|
|
|
|
{
|
|
|
|
|
int b, l;
|
|
|
|
|
|
|
|
|
|
SIGEMPTYSET(*bss);
|
|
|
|
|
bss->__bits[0] = lss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1);
|
|
|
|
|
bss->__bits[1] = lss->__bits[1];
|
|
|
|
|
for (l = 1; l <= LINUX_SIGTBLSZ; l++) {
|
|
|
|
|
if (LINUX_SIGISMEMBER(*lss, l)) {
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#ifdef __alpha__
|
|
|
|
|
b = _SIG_IDX(l);
|
|
|
|
|
#else
|
1999-09-29 15:12:18 +00:00
|
|
|
|
b = linux_to_bsd_signal[_SIG_IDX(l)];
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (b)
|
|
|
|
|
SIGADDSET(*bss, b);
|
|
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-17 00:00:20 +00:00
|
|
|
|
void
|
1999-09-29 15:12:18 +00:00
|
|
|
|
bsd_to_linux_sigset(sigset_t *bss, linux_sigset_t *lss)
|
|
|
|
|
{
|
|
|
|
|
int b, l;
|
|
|
|
|
|
|
|
|
|
LINUX_SIGEMPTYSET(*lss);
|
|
|
|
|
lss->__bits[0] = bss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1);
|
|
|
|
|
lss->__bits[1] = bss->__bits[1];
|
|
|
|
|
for (b = 1; b <= LINUX_SIGTBLSZ; b++) {
|
|
|
|
|
if (SIGISMEMBER(*bss, b)) {
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#if __alpha__
|
|
|
|
|
l = _SIG_IDX(b);
|
|
|
|
|
#else
|
1999-09-29 15:12:18 +00:00
|
|
|
|
l = bsd_to_linux_signal[_SIG_IDX(b)];
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (l)
|
|
|
|
|
LINUX_SIGADDSET(*lss, l);
|
|
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-03-02 21:00:11 +00:00
|
|
|
|
static void
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
linux_to_bsd_sigaction(linux_sigaction_t *lsa, struct sigaction *bsa)
|
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
|
|
linux_to_bsd_sigset(&lsa->lsa_mask, &bsa->sa_mask);
|
|
|
|
|
bsa->sa_handler = lsa->lsa_handler;
|
|
|
|
|
bsa->sa_flags = 0;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_NOCLDSTOP)
|
|
|
|
|
bsa->sa_flags |= SA_NOCLDSTOP;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_NOCLDWAIT)
|
|
|
|
|
bsa->sa_flags |= SA_NOCLDWAIT;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_SIGINFO)
|
|
|
|
|
bsa->sa_flags |= SA_SIGINFO;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_ONSTACK)
|
|
|
|
|
bsa->sa_flags |= SA_ONSTACK;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_RESTART)
|
|
|
|
|
bsa->sa_flags |= SA_RESTART;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_ONESHOT)
|
|
|
|
|
bsa->sa_flags |= SA_RESETHAND;
|
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_NOMASK)
|
|
|
|
|
bsa->sa_flags |= SA_NODEFER;
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-03-02 21:00:11 +00:00
|
|
|
|
static void
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
bsd_to_linux_sigaction(struct sigaction *bsa, linux_sigaction_t *lsa)
|
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
|
|
bsd_to_linux_sigset(&bsa->sa_mask, &lsa->lsa_mask);
|
|
|
|
|
lsa->lsa_handler = bsa->sa_handler;
|
|
|
|
|
lsa->lsa_restorer = NULL; /* unsupported */
|
|
|
|
|
lsa->lsa_flags = 0;
|
|
|
|
|
if (bsa->sa_flags & SA_NOCLDSTOP)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_NOCLDSTOP;
|
|
|
|
|
if (bsa->sa_flags & SA_NOCLDWAIT)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_NOCLDWAIT;
|
|
|
|
|
if (bsa->sa_flags & SA_SIGINFO)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_SIGINFO;
|
|
|
|
|
if (bsa->sa_flags & SA_ONSTACK)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_ONSTACK;
|
|
|
|
|
if (bsa->sa_flags & SA_RESTART)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_RESTART;
|
|
|
|
|
if (bsa->sa_flags & SA_RESETHAND)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_ONESHOT;
|
|
|
|
|
if (bsa->sa_flags & SA_NODEFER)
|
|
|
|
|
lsa->lsa_flags |= LINUX_SA_NOMASK;
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
2000-08-22 01:49:54 +00:00
|
|
|
|
int
|
1999-08-14 17:28:46 +00:00
|
|
|
|
linux_do_sigaction(struct proc *p, int linux_sig, linux_sigaction_t *linux_nsa,
|
|
|
|
|
linux_sigaction_t *linux_osa)
|
|
|
|
|
{
|
1999-11-30 15:02:28 +00:00
|
|
|
|
struct sigaction *nsa, *osa;
|
1999-09-29 15:12:18 +00:00
|
|
|
|
struct sigaction_args sa_args;
|
|
|
|
|
int error;
|
|
|
|
|
caddr_t sg = stackgap_init();
|
|
|
|
|
|
|
|
|
|
if (linux_sig <= 0 || linux_sig > LINUX_NSIG)
|
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
|
|
if (linux_osa != NULL)
|
|
|
|
|
osa = stackgap_alloc(&sg, sizeof(struct sigaction));
|
|
|
|
|
else
|
|
|
|
|
osa = NULL;
|
|
|
|
|
|
|
|
|
|
if (linux_nsa != NULL) {
|
|
|
|
|
nsa = stackgap_alloc(&sg, sizeof(struct sigaction));
|
1999-11-30 15:02:28 +00:00
|
|
|
|
linux_to_bsd_sigaction(linux_nsa, nsa);
|
1999-09-29 15:12:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
nsa = NULL;
|
|
|
|
|
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#ifndef __alpha__
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (linux_sig <= LINUX_SIGTBLSZ)
|
|
|
|
|
sa_args.sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)];
|
|
|
|
|
else
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
sa_args.sig = linux_sig;
|
|
|
|
|
|
|
|
|
|
sa_args.act = nsa;
|
|
|
|
|
sa_args.oact = osa;
|
|
|
|
|
error = sigaction(p, &sa_args);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
if (error)
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (error);
|
|
|
|
|
|
1999-11-30 15:02:28 +00:00
|
|
|
|
if (linux_osa != NULL)
|
|
|
|
|
bsd_to_linux_sigaction(osa, linux_osa);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (0);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-01 19:48:35 +00:00
|
|
|
|
|
|
|
|
|
#ifndef __alpha__
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_signal(struct proc *p, struct linux_signal_args *args)
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_sigaction_t nsa, osa;
|
|
|
|
|
int error;
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1999-09-29 15:12:18 +00:00
|
|
|
|
printf("Linux-emul(%ld): signal(%d, %p)\n",
|
|
|
|
|
(long)p->p_pid, args->sig, (void *)args->handler);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
#endif
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
nsa.lsa_handler = args->handler;
|
|
|
|
|
nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK;
|
|
|
|
|
LINUX_SIGEMPTYSET(nsa.lsa_mask);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
error = linux_do_sigaction(p, args->sig, &nsa, &osa);
|
|
|
|
|
p->p_retval[0] = (int)osa.lsa_handler;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (error);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
}
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif /*!__alpha__*/
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args)
|
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_sigaction_t nsa, osa;
|
|
|
|
|
int error;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2000-11-01 19:48:35 +00:00
|
|
|
|
printf("Linux-emul(%ld): rt_sigaction(%ld, %p, %p, %ld)\n",
|
|
|
|
|
(long)p->p_pid, (long)args->sig, (void *)args->act,
|
|
|
|
|
(void *)args->oact, (long)args->sigsetsize);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->sigsetsize != sizeof(linux_sigset_t))
|
|
|
|
|
return (EINVAL);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->act != NULL) {
|
|
|
|
|
error = copyin(args->act, &nsa, sizeof(linux_sigaction_t));
|
|
|
|
|
if (error)
|
|
|
|
|
return (error);
|
|
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
error = linux_do_sigaction(p, args->sig,
|
|
|
|
|
args->act ? &nsa : NULL,
|
|
|
|
|
args->oact ? &osa : NULL);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->oact != NULL && !error) {
|
|
|
|
|
error = copyout(&osa, args->oact, sizeof(linux_sigaction_t));
|
|
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (error);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-08-14 17:28:46 +00:00
|
|
|
|
static int
|
|
|
|
|
linux_do_sigprocmask(struct proc *p, int how, linux_sigset_t *new,
|
|
|
|
|
linux_sigset_t *old)
|
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
int error, s;
|
|
|
|
|
sigset_t mask;
|
|
|
|
|
|
|
|
|
|
error = 0;
|
|
|
|
|
p->p_retval[0] = 0;
|
|
|
|
|
|
|
|
|
|
if (old != NULL)
|
|
|
|
|
bsd_to_linux_sigset(&p->p_sigmask, old);
|
|
|
|
|
|
|
|
|
|
if (new != NULL) {
|
|
|
|
|
linux_to_bsd_sigset(new, &mask);
|
|
|
|
|
|
|
|
|
|
s = splhigh();
|
|
|
|
|
|
|
|
|
|
switch (how) {
|
|
|
|
|
case LINUX_SIG_BLOCK:
|
|
|
|
|
SIGSETOR(p->p_sigmask, mask);
|
|
|
|
|
SIG_CANTMASK(p->p_sigmask);
|
|
|
|
|
break;
|
|
|
|
|
case LINUX_SIG_UNBLOCK:
|
|
|
|
|
SIGSETNAND(p->p_sigmask, mask);
|
|
|
|
|
break;
|
|
|
|
|
case LINUX_SIG_SETMASK:
|
|
|
|
|
p->p_sigmask = mask;
|
|
|
|
|
SIG_CANTMASK(p->p_sigmask);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
error = EINVAL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
splx(s);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (error);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#ifndef __alpha__
|
1995-06-25 17:32:43 +00:00
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_osigset_t mask;
|
|
|
|
|
linux_sigset_t set, oset;
|
|
|
|
|
int error;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1999-09-29 15:12:18 +00:00
|
|
|
|
printf("Linux-emul(%d): sigprocmask(%d, *, *)\n", p->p_pid, args->how);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#endif
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->mask != NULL) {
|
|
|
|
|
error = copyin(args->mask, &mask, sizeof(linux_osigset_t));
|
|
|
|
|
if (error)
|
|
|
|
|
return (error);
|
|
|
|
|
LINUX_SIGEMPTYSET(set);
|
|
|
|
|
set.__bits[0] = mask;
|
|
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
error = linux_do_sigprocmask(p, args->how,
|
|
|
|
|
args->mask ? &set : NULL,
|
|
|
|
|
args->omask ? &oset : NULL);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->omask != NULL && !error) {
|
|
|
|
|
mask = oset.__bits[0];
|
|
|
|
|
error = copyout(&mask, args->omask, sizeof(linux_osigset_t));
|
|
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (error);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
}
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif /*!__alpha__*/
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1999-08-14 17:28:46 +00:00
|
|
|
|
int
|
|
|
|
|
linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
|
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_sigset_t set, oset;
|
|
|
|
|
int error;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2000-11-01 19:48:35 +00:00
|
|
|
|
printf("Linux-emul(%ld): rt_sigprocmask(%d, %p, %p, %ld)\n",
|
1999-09-29 15:12:18 +00:00
|
|
|
|
(long)p->p_pid, args->how, (void *)args->mask,
|
2000-11-01 19:48:35 +00:00
|
|
|
|
(void *)args->omask, (long)args->sigsetsize);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->sigsetsize != sizeof(linux_sigset_t))
|
|
|
|
|
return EINVAL;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->mask != NULL) {
|
|
|
|
|
error = copyin(args->mask, &set, sizeof(linux_sigset_t));
|
|
|
|
|
if (error)
|
|
|
|
|
return (error);
|
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
error = linux_do_sigprocmask(p, args->how,
|
|
|
|
|
args->mask ? &set : NULL,
|
|
|
|
|
args->omask ? &oset : NULL);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->omask != NULL && !error) {
|
|
|
|
|
error = copyout(&oset, args->omask, sizeof(linux_sigset_t));
|
|
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
return (error);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#ifndef __alpha__
|
1995-06-25 17:32:43 +00:00
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_siggetmask(struct proc *p, struct linux_siggetmask_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_sigset_t mask;
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#ifdef DEBUG
|
1999-09-29 15:12:18 +00:00
|
|
|
|
printf("Linux-emul(%d): siggetmask()\n", p->p_pid);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
|
|
bsd_to_linux_sigset(&p->p_sigmask, &mask);
|
|
|
|
|
p->p_retval[0] = mask.__bits[0];
|
|
|
|
|
return (0);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_sigsetmask(struct proc *p, struct linux_sigsetmask_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
linux_sigset_t lset;
|
|
|
|
|
sigset_t bset;
|
|
|
|
|
int s;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1999-09-29 15:12:18 +00:00
|
|
|
|
printf("Linux-emul(%ld): sigsetmask(%08lx)\n",
|
|
|
|
|
(long)p->p_pid, (unsigned long)args->mask);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#endif
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
|
bsd_to_linux_sigset(&p->p_sigmask, &lset);
|
|
|
|
|
p->p_retval[0] = lset.__bits[0];
|
|
|
|
|
LINUX_SIGEMPTYSET(lset);
|
|
|
|
|
lset.__bits[0] = args->mask;
|
|
|
|
|
linux_to_bsd_sigset(&lset, &bset);
|
|
|
|
|
s = splhigh();
|
|
|
|
|
p->p_sigmask = bset;
|
|
|
|
|
SIG_CANTMASK(p->p_sigmask);
|
|
|
|
|
splx(s);
|
|
|
|
|
return (0);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_sigpending(struct proc *p, struct linux_sigpending_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
sigset_t bset;
|
|
|
|
|
linux_sigset_t lset;
|
|
|
|
|
linux_osigset_t mask;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1999-09-29 15:12:18 +00:00
|
|
|
|
printf("Linux-emul(%d): sigpending(*)\n", p->p_pid);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
|
|
bset = p->p_siglist;
|
|
|
|
|
SIGSETAND(bset, p->p_sigmask);
|
|
|
|
|
bsd_to_linux_sigset(&bset, &lset);
|
|
|
|
|
mask = lset.__bits[0];
|
|
|
|
|
return (copyout(&mask, args->mask, sizeof(mask)));
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif /*!__alpha__*/
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_kill(struct proc *p, struct linux_kill_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
struct kill_args /* {
|
|
|
|
|
int pid;
|
|
|
|
|
int signum;
|
|
|
|
|
} */ tmp;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1999-09-29 15:12:18 +00:00
|
|
|
|
printf("Linux-emul(%d): kill(%d, %d)\n",
|
|
|
|
|
p->p_pid, args->pid, args->signum);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Allow signal 0 as a means to check for privileges
|
|
|
|
|
*/
|
|
|
|
|
if (args->signum < 0 || args->signum > LINUX_NSIG)
|
|
|
|
|
return EINVAL;
|
|
|
|
|
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#ifndef __alpha__
|
1999-09-29 15:12:18 +00:00
|
|
|
|
if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ)
|
|
|
|
|
tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)];
|
|
|
|
|
else
|
2000-11-01 19:48:35 +00:00
|
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
tmp.signum = args->signum;
|
|
|
|
|
|
|
|
|
|
tmp.pid = args->pid;
|
|
|
|
|
return (kill(p, &tmp));
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|