Commit Graph

6986 Commits

Author SHA1 Message Date
dchagin
8ab518aec9 MFC r283467:
Call nosys in case when the incorrect syscall number is specified.

Its my fault, fixed by mjg@ at r289055.
2016-01-09 17:18:03 +00:00
dchagin
c4895a81f6 Regen for r293567. 2016-01-09 17:15:03 +00:00
dchagin
5b01285f9b MFC r283465:
Add preliminary fallocate system call implementation
to emulate posix_fallocate() function.
2016-01-09 17:13:43 +00:00
dchagin
09f25351da Regen for r293555. 2016-01-09 17:00:15 +00:00
dchagin
682bdd605d MFC r283451:
Implement ppoll() system call.
2016-01-09 16:58:57 +00:00
dchagin
9d7b3777ea MFC r283446:
Include opt_compat.h, so that COMPAT_LINUX32 is defined, and we can
access to the semop structs and functions.
2016-01-09 16:52:25 +00:00
dchagin
b7022d5321 Regen for r293549. 2016-01-09 16:50:09 +00:00
dchagin
1eeab3feb9 MFC r283444:
Implement eventfd system call.
2016-01-09 16:48:50 +00:00
dchagin
623ca98188 MFC r283443:
Put the correct value for the abi_nfdbits parameter of kern_select() for
all supported Linuxulators.
2016-01-09 16:47:36 +00:00
dchagin
2ce85f55b6 Regen for r293546. 2016-01-09 16:45:54 +00:00
dchagin
ea9daca708 MFC r283441:
Implement epoll family system calls. This is a tiny wrapper
around kqueue() to implement epoll subset of functionality.
The kqueue user data are 32bit on i386 which is not enough for
epoll user data, so we keep user data in the proc emuldata.

Initial patch developed by rdivacky@ in 2007, then extended
by Yuri Victorovich @ r255672 and finished by me
in collaboration with mjg@ and jillies@.
2016-01-09 16:44:17 +00:00
dchagin
2205518265 MFC r283437:
To avoid code duplication move open/fcntl definitions to the MI
header file.
2016-01-09 16:31:10 +00:00
dchagin
f31e70952f MFC r283436:
Use the BSD_TO_LINUX_SIGNAL() wherever there is no need
to check the ABI as it is known.
2016-01-09 16:29:51 +00:00
dchagin
a1e3b366c7 MFC r283432:
Being exported through vdso the note.Linux section used by glibc
to determine the kernel version (this saves one uname call).
Temporarily disable the export of a note.Linux section until I figured
out how to change the kernel version in the note.Linux on the fly.
2016-01-09 16:25:30 +00:00
dchagin
68ddeae1b4 MFC r283431:
Add AT_RANDOM and AT_EXECFN auxiliary vector entries which are used by
glibc. At list since glibc version 2.16 using AT_RANDOM is mandatory.
2016-01-09 16:24:30 +00:00
dchagin
6a70519414 Regen for r293533. 2016-01-09 16:23:11 +00:00
dchagin
f186d260e2 MFC r283428:
Change linux faccessat syscall definition to match actual linux one.

The AT_EACCESS and AT_SYMLINK_NOFOLLOW flags are actually implemented
within the glibc wrapper function for faccessat().  If either of these
flags are specified, then the wrapper function employs fstatat() to
determine access permissions.
2016-01-09 16:21:39 +00:00
dchagin
199f40b151 Regen for r293530. 2016-01-09 16:16:16 +00:00
dchagin
aaac17a4f9 MFC r283424:
Add preliminary support for x86-64 Linux binaries.
2016-01-09 16:14:24 +00:00
dchagin
6c12e20ac1 MFC r283422:
Refund the proc emuldata struct for future use. For now move flags from
thread emuldata to proc emuldata as it was originally intended.

As we can have both 64 & 32 bit Linuxulator running any eventhandler
can be called twice for us. To prevent this move eventhandlers code
from linux_emul.c to the linux_common.ko module.
2016-01-09 16:11:09 +00:00
dchagin
d30e84112a MFC r283421:
Introduce a new module linux_common.ko which is intended for the
following primary purposes:

1. Remove the dependency of linsysfs and linprocfs modules from linux.ko,
which will be architecture specific on amd64.

2. Incorporate into linux_common.ko general code for platforms on which
we'll support two Linuxulator modules (for both instruction set - 32 & 64 bit).

3. Move malloc(9) declaration to linux_common.ko, to enable getting memory
usage statistics properly.

Currently linux_common.ko incorporates a code from linux_mib.c and linux_util.c
and linprocfs, linsysfs and linux kernel modules depend on linux_common.ko.

Temporarily remove dtrace garbage from linux_mib.c and linux_util.c
2016-01-09 16:08:22 +00:00
dchagin
793bb9c3f7 MFC r283416:
x86_64 Linux do not use multiplexing on ipc system calls.
Move struct ipc_perm definition to the MD path as it differs for 64 and
32 bit platform.
2016-01-09 15:56:01 +00:00
dchagin
f536abaf31 MFC r283411:
Remove stale comment about a signal trampoline which
is moved to the shared page at r219609.
2016-01-09 15:49:42 +00:00
dchagin
a034df74fd MFC r283410:
Put linux_platform into the vdso to avoid copying it onto the stack at
every exec.
2016-01-09 15:48:11 +00:00
dchagin
5c3e282c6e MFC r283408:
Eliminate a now unused global declaration of elf_linux_sysvec.
2016-01-09 15:46:05 +00:00
dchagin
18c1672334 MFC r283407:
Implement vdso - virtual dynamic shared object. Through vdso Linux
exposes functions from kernel with proper DWARF CFI information so that
it becomes easier to unwind through them.
Using vdso is a mandatory for a thread cancelation && cleanup
on a modern glibc.
2016-01-09 15:44:38 +00:00
dchagin
2e9cc3f70d Regen for r293511. 2016-01-09 15:40:44 +00:00
dchagin
4ed27590e5 MFC r283403:
Implement pselect6() system call.
2016-01-09 15:39:41 +00:00
dchagin
4992ef5f9d Regen for r293510. 2016-01-09 15:38:16 +00:00
dchagin
027f6631c0 MFC r283401:
Implement prlimit64() system call.
2016-01-09 15:37:10 +00:00
dchagin
a82405c150 Regen for r293508. 2016-01-09 15:35:57 +00:00
dchagin
b4d7be064f MFC r283399:
Implement dup3() system call.
2016-01-09 15:34:54 +00:00
dchagin
e327d1c9cc Regen for r293505. 2016-01-09 15:32:33 +00:00
dchagin
df59792813 MFC r283396:
Implement rt_sigqueueinfo() system call.
2016-01-09 15:31:15 +00:00
dchagin
4e3ae75e5e Regen for r293503. 2016-01-09 15:29:10 +00:00
dchagin
3c97a00938 MFC r283394:
Implement waitid() system call.
2016-01-09 15:28:05 +00:00
dchagin
a14064e328 MFC r283391:
To reduce code duplication introduce linux_copyout_rusage() method.
Use it in linux_wait4() system call and move linux_wait4() to the MI path.
While here add a prototype for the static bsd_to_linux_rusage().
2016-01-09 15:23:54 +00:00
dchagin
2646cf70a0 MFC r283385:
Some style(9) && whitespaces fixes. No functional changes.
2016-01-09 15:18:36 +00:00
dchagin
cb3b38d164 MFC r283383:
Switch linuxulator to use the native 1:1 threads.

The reasons:
1. Get rid of the stubs/quirks with process dethreading,
   process reparent when the process group leader exits and close
   to this problems on wait(), waitpid(), etc.
2. Reuse our kernel code instead of writing excessive thread
   managment routines in Linuxulator.

Implementation details:

1. The thread is created via kern_thr_new() in the clone() call with
   the CLONE_THREAD parameter. Thus, everything else is a process.
2. The test that the process has a threads is done via P_HADTHREADS
   bit p_flag of struct proc.
3. Per thread emulator state data structure is now located in the
   struct thread and freed in the thread_dtor() hook.
   Mandatory holdig of the p_mtx required when referencing emuldata
   from the other threads.
4. PID mangling has changed. Now Linux pid is the native tid
   and Linux tgid is the native pid, with the exception of the first
   thread in the process where tid and pid are one and the same.

Ugliness:

   In case when the Linux thread is the initial thread in the thread
   group thread id is equal to the process id. Glibc depends on this
   magic (assert in pthread_getattr_np.c). So for system calls that
   take thread id as a parameter we should use the special method
   to reference struct thread.
2016-01-09 15:16:13 +00:00
dchagin
2b83b41438 MFC r283382:
In preparation for switching linuxulator to the use the native 1:1
threads add a hook for cleaning thread resources before the thread die.
2016-01-09 14:53:08 +00:00
dchagin
c12aa632f3 Regen fro r293487. 2016-01-09 14:48:23 +00:00
dchagin
31e61f6749 MFC r283379:
Implement a Linux version of sched_getparam() && sched_setparam().
Temporarily use the first thread in proc.
2016-01-09 14:47:08 +00:00
dchagin
65d490113d MFC r283378:
Remove a now unused include.
2016-01-09 14:45:41 +00:00
dchagin
fd9d33be2a MFC r283374:
In preparation for switching linuxulator to the use the native 1:1
threads refactor kern_sched_rr_get_interval() and sys_sched_rr_get_interval().
Add a kern_sched_rr_get_interval() counterpart which takes a targettd
parameter to allow specify target thread directly by callee (new Linuxulator).

Linuxulator temporarily uses first thread in proc.

Move linux_sched_rr_get_interval() to the MI part.
2016-01-09 14:40:38 +00:00
dchagin
994d3d5889 Regen for r293478. 2016-01-09 14:34:29 +00:00
dchagin
e060fa6fed MFC r283370:
In preparation for switching linuxulator to the use the native 1:1
threads introduce linux_exit() stub instead of sys_exit() call
(which terminates process).
In the new linuxulator exit() system call terminates the calling
thread (not a whole process).
2016-01-09 14:33:10 +00:00
dchagin
358125d39c MFC r283369:
In preparation for switching linuxulator to the use the native 1:1
threads print the thread id in addition to the pid in debug messages.
2016-01-09 14:31:03 +00:00
dim
7295d680ea MFC r277735 (by royger):
amd64: allow base memory segment to start at address different than 0

Current code requires that the first physical memory segment starts at 0,
but this is not really needed. We only need to make sure the bootstrap code
and page tables for APs are allocated below 4GB.

This patch removes this requirement and allows booting a Dell R710 from
UEFI, where the first physical memory segment starts at 0x10000.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D1417
2015-12-21 17:15:03 +00:00
kib
9167bbc1e5 MFC r291948:
Use ANSI C definition.
2015-12-14 07:54:45 +00:00
jhb
f91ade9d24 MFC 284325:
Report the values of x86 segment registers to remote debuggers.

While here, also report %eflags from the i386 trapframe.
2015-11-13 00:50:34 +00:00