summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-05-11 08:59:58 -0300
committerRenato Botelho <renato@netgate.com>2017-05-11 08:59:58 -0300
commit5fa580e9c45b6668f134701651fa17cad722750e (patch)
tree8c4a473887fb8b23533d37cf95c1a33a406d1fe8 /sys/amd64
parent4a3427ce64e27e7bac30020eb566d3b6a9072d12 (diff)
parentdad5ccf4808854af8f6af32ab4f15dca00dae42b (diff)
downloadFreeBSD-src-5fa580e9c45b6668f134701651fa17cad722750e.zip
FreeBSD-src-5fa580e9c45b6668f134701651fa17cad722750e.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/db_disasm.c12
-rw-r--r--sys/amd64/amd64/machdep.c11
-rw-r--r--sys/amd64/amd64/pmap.c2
-rw-r--r--sys/amd64/cloudabi32/cloudabi32_sysvec.c4
-rw-r--r--sys/amd64/cloudabi64/cloudabi64_sysvec.c5
-rw-r--r--sys/amd64/include/atomic.h51
-rw-r--r--sys/amd64/include/pc/bios.h3
-rw-r--r--sys/amd64/linux/linux.h59
-rw-r--r--sys/amd64/linux/linux_dummy.c36
-rw-r--r--sys/amd64/linux/linux_ipc64.h142
-rw-r--r--sys/amd64/linux/linux_machdep.c35
-rw-r--r--sys/amd64/linux/linux_proto.h77
-rw-r--r--sys/amd64/linux/linux_ptrace.c414
-rw-r--r--sys/amd64/linux/linux_syscall.h13
-rw-r--r--sys/amd64/linux/linux_syscalls.c27
-rw-r--r--sys/amd64/linux/linux_sysent.c33
-rw-r--r--sys/amd64/linux/linux_systrace_args.c250
-rw-r--r--sys/amd64/linux/syscalls.master40
-rw-r--r--sys/amd64/linux32/linux.h48
-rw-r--r--sys/amd64/linux32/linux32_dummy.c29
-rw-r--r--sys/amd64/linux32/linux32_ipc64.h145
-rw-r--r--sys/amd64/linux32/linux32_machdep.c5
-rw-r--r--sys/amd64/linux32/linux32_proto.h33
-rw-r--r--sys/amd64/linux32/linux32_syscall.h5
-rw-r--r--sys/amd64/linux32/linux32_syscalls.c9
-rw-r--r--sys/amd64/linux32/linux32_sysent.c15
-rw-r--r--sys/amd64/linux32/linux32_systrace_args.c154
-rw-r--r--sys/amd64/linux32/syscalls.master20
-rw-r--r--sys/amd64/vmm/x86.c3
29 files changed, 832 insertions, 848 deletions
diff --git a/sys/amd64/amd64/db_disasm.c b/sys/amd64/amd64/db_disasm.c
index dd436d7..0ec81f4 100644
--- a/sys/amd64/amd64/db_disasm.c
+++ b/sys/amd64/amd64/db_disasm.c
@@ -1044,7 +1044,7 @@ db_read_address(loc, short_addr, rex, regmodrm, addrp)
return (loc);
}
addrp->is_reg = FALSE;
- addrp->index = 0;
+ addrp->index = NULL;
if (short_addr)
size = LONG;
@@ -1067,7 +1067,7 @@ db_read_address(loc, short_addr, rex, regmodrm, addrp)
if (rm == 5) {
get_value_inc(addrp->disp, loc, 4, FALSE);
if (have_sib)
- addrp->base = 0;
+ addrp->base = NULL;
else if (short_addr)
addrp->base = "%eip";
else
@@ -1109,9 +1109,9 @@ db_print_address(seg, size, rex, addrp)
db_printf("%s:", seg);
}
- if (addrp->disp != 0 || (addrp->base == 0 && addrp->index == 0))
+ if (addrp->disp != 0 || (addrp->base == NULL && addrp->index == NULL))
db_printsym((db_addr_t)addrp->disp, DB_STGY_ANY);
- if (addrp->base != 0 || addrp->index != 0) {
+ if (addrp->base != NULL || addrp->index != NULL) {
db_printf("(");
if (addrp->base)
db_printf("%s", addrp->base);
@@ -1248,7 +1248,7 @@ db_disasm(db_addr_t loc, bool altfmt)
get_value_inc(inst, loc, 1, FALSE);
short_addr = FALSE;
size = LONG;
- seg = 0;
+ seg = NULL;
/*
* Get prefixes
@@ -1313,7 +1313,7 @@ db_disasm(db_addr_t loc, bool altfmt)
while (ip->i_size == ESC) {
get_value_inc(inst, loc, 1, FALSE);
ip = ((const struct inst * const *)ip->i_extra)[inst>>4];
- if (ip == 0) {
+ if (ip == NULL) {
ip = &db_bad_inst;
}
else {
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 0001127..2c18af9 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1086,7 +1086,8 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap,
"ACPIMemoryNVS",
"MemoryMappedIO",
"MemoryMappedIOPortSpace",
- "PalCode"
+ "PalCode",
+ "PersistentMemory"
};
/*
@@ -1107,7 +1108,7 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap,
for (i = 0, p = map; i < ndesc; i++,
p = efi_next_descriptor(p, efihdr->descriptor_size)) {
if (boothowto & RB_VERBOSE) {
- if (p->md_type <= EFI_MD_TYPE_PALCODE)
+ if (p->md_type < nitems(types))
type = types[p->md_type];
else
type = "<INVALID>";
@@ -1129,6 +1130,12 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap,
printf("RP ");
if (p->md_attr & EFI_MD_ATTR_XP)
printf("XP ");
+ if (p->md_attr & EFI_MD_ATTR_NV)
+ printf("NV ");
+ if (p->md_attr & EFI_MD_ATTR_MORE_RELIABLE)
+ printf("MORE_RELIABLE ");
+ if (p->md_attr & EFI_MD_ATTR_RO)
+ printf("RO ");
if (p->md_attr & EFI_MD_ATTR_RT)
printf("RUNTIME");
printf("\n");
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index d0b1eed..612421e 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -391,7 +391,7 @@ static struct md_page pv_dummy;
/*
* All those kernel PT submaps that BSD is so fond of
*/
-pt_entry_t *CMAP1 = 0;
+pt_entry_t *CMAP1 = NULL;
caddr_t CADDR1 = 0;
static vm_offset_t qframe = 0;
static struct mtx qframe_mtx;
diff --git a/sys/amd64/cloudabi32/cloudabi32_sysvec.c b/sys/amd64/cloudabi32/cloudabi32_sysvec.c
index 5cf73ab..abede1a 100644
--- a/sys/amd64/cloudabi32/cloudabi32_sysvec.c
+++ b/sys/amd64/cloudabi32/cloudabi32_sysvec.c
@@ -181,7 +181,7 @@ cloudabi32_thread_setregs(struct thread *td,
/* Perform standard register initialization. */
stack.ss_sp = TO_PTR(attr->stack);
- stack.ss_size = attr->stack_size - sizeof(args);
+ stack.ss_size = attr->stack_len - sizeof(args);
cpu_set_upcall(td, TO_PTR(attr->entry_point), NULL, &stack);
/*
@@ -227,5 +227,5 @@ Elf32_Brandinfo cloudabi32_brand = {
.brand = ELFOSABI_CLOUDABI,
.machine = EM_386,
.sysvec = &cloudabi32_elf_sysvec,
- .compat_3_brand = "CloudABI",
+ .flags = BI_BRAND_ONLY_STATIC,
};
diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c
index f1b3863..84f0cb3 100644
--- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c
+++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c
@@ -164,7 +164,7 @@ cloudabi64_thread_setregs(struct thread *td,
* from the top of the stack to store a single element array,
* containing a pointer to the TCB. %fs base will point to this.
*/
- tcbptr = rounddown(attr->stack + attr->stack_size - sizeof(tcbptr),
+ tcbptr = rounddown(attr->stack + attr->stack_len - sizeof(tcbptr),
_Alignof(tcbptr));
error = copyout(&tcb, (void *)tcbptr, sizeof(tcb));
if (error != 0)
@@ -212,6 +212,5 @@ Elf64_Brandinfo cloudabi64_brand = {
.brand = ELFOSABI_CLOUDABI,
.machine = EM_X86_64,
.sysvec = &cloudabi64_elf_sysvec,
- .flags = BI_CAN_EXEC_DYN,
- .compat_3_brand = "CloudABI",
+ .flags = BI_CAN_EXEC_DYN | BI_BRAND_ONLY_STATIC,
};
diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h
index c9526f4..09a5f9c 100644
--- a/sys/amd64/include/atomic.h
+++ b/sys/amd64/include/atomic.h
@@ -99,6 +99,8 @@ void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src);
int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src);
+int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src);
+int atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src);
u_int atomic_fetchadd_int(volatile u_int *p, u_int v);
u_long atomic_fetchadd_long(volatile u_long *p, u_long v);
int atomic_testandset_int(volatile u_int *p, u_int v);
@@ -196,6 +198,42 @@ atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src)
return (res);
}
+static __inline int
+atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src)
+{
+ u_char res;
+
+ __asm __volatile(
+ " " MPLOCKED " "
+ " cmpxchgl %3,%1 ; "
+ " sete %0 ; "
+ "# atomic_fcmpset_int"
+ : "=r" (res), /* 0 */
+ "+m" (*dst), /* 1 */
+ "+a" (*expect) /* 2 */
+ : "r" (src) /* 3 */
+ : "memory", "cc");
+ return (res);
+}
+
+static __inline int
+atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src)
+{
+ u_char res;
+
+ __asm __volatile(
+ " " MPLOCKED " "
+ " cmpxchgq %3,%1 ; "
+ " sete %0 ; "
+ "# atomic_fcmpset_long"
+ : "=r" (res), /* 0 */
+ "+m" (*dst), /* 1 */
+ "+a" (*expect) /* 2 */
+ : "r" (src) /* 3 */
+ : "memory", "cc");
+ return (res);
+}
+
/*
* Atomically add the value of v to the integer pointed to by p and return
* the previous value of *p.
@@ -504,6 +542,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
#define atomic_subtract_rel_int atomic_subtract_barr_int
#define atomic_cmpset_acq_int atomic_cmpset_int
#define atomic_cmpset_rel_int atomic_cmpset_int
+#define atomic_fcmpset_acq_int atomic_fcmpset_int
+#define atomic_fcmpset_rel_int atomic_fcmpset_int
#define atomic_set_acq_long atomic_set_barr_long
#define atomic_set_rel_long atomic_set_barr_long
@@ -515,6 +555,8 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
#define atomic_subtract_rel_long atomic_subtract_barr_long
#define atomic_cmpset_acq_long atomic_cmpset_long
#define atomic_cmpset_rel_long atomic_cmpset_long
+#define atomic_fcmpset_acq_long atomic_fcmpset_long
+#define atomic_fcmpset_rel_long atomic_fcmpset_long
#define atomic_readandclear_int(p) atomic_swap_int(p, 0)
#define atomic_readandclear_long(p) atomic_swap_long(p, 0)
@@ -569,6 +611,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
#define atomic_cmpset_32 atomic_cmpset_int
#define atomic_cmpset_acq_32 atomic_cmpset_acq_int
#define atomic_cmpset_rel_32 atomic_cmpset_rel_int
+#define atomic_fcmpset_32 atomic_fcmpset_int
+#define atomic_fcmpset_acq_32 atomic_fcmpset_acq_int
+#define atomic_fcmpset_rel_32 atomic_fcmpset_rel_int
#define atomic_swap_32 atomic_swap_int
#define atomic_readandclear_32 atomic_readandclear_int
#define atomic_fetchadd_32 atomic_fetchadd_int
@@ -593,6 +638,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
#define atomic_cmpset_64 atomic_cmpset_long
#define atomic_cmpset_acq_64 atomic_cmpset_acq_long
#define atomic_cmpset_rel_64 atomic_cmpset_rel_long
+#define atomic_fcmpset_64 atomic_fcmpset_long
+#define atomic_fcmpset_acq_64 atomic_fcmpset_acq_long
+#define atomic_fcmpset_rel_64 atomic_fcmpset_rel_long
#define atomic_swap_64 atomic_swap_long
#define atomic_readandclear_64 atomic_readandclear_long
#define atomic_fetchadd_64 atomic_fetchadd_long
@@ -617,6 +665,9 @@ u_long atomic_swap_long(volatile u_long *p, u_long v);
#define atomic_cmpset_ptr atomic_cmpset_long
#define atomic_cmpset_acq_ptr atomic_cmpset_acq_long
#define atomic_cmpset_rel_ptr atomic_cmpset_rel_long
+#define atomic_fcmpset_ptr atomic_fcmpset_long
+#define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_long
+#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_long
#define atomic_swap_ptr atomic_swap_long
#define atomic_readandclear_ptr atomic_readandclear_long
diff --git a/sys/amd64/include/pc/bios.h b/sys/amd64/include/pc/bios.h
index 1dbf110..32bbf16 100644
--- a/sys/amd64/include/pc/bios.h
+++ b/sys/amd64/include/pc/bios.h
@@ -40,6 +40,9 @@
#define SMAP_TYPE_ACPI_RECLAIM 3
#define SMAP_TYPE_ACPI_NVS 4
#define SMAP_TYPE_ACPI_ERROR 5
+#define SMAP_TYPE_DISABLED 6
+#define SMAP_TYPE_PMEM 7
+#define SMAP_TYPE_PRAM 12
#define SMAP_XATTR_ENABLED 0x00000001
#define SMAP_XATTR_NON_VOLATILE 0x00000002
diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h
index b30568f..c56cb80 100644
--- a/sys/amd64/linux/linux.h
+++ b/sys/amd64/linux/linux.h
@@ -69,7 +69,9 @@ typedef l_long l_clock_t;
typedef l_int l_daddr_t;
typedef l_ulong l_dev_t;
typedef l_uint l_gid_t;
+typedef l_ushort l_gid16_t;
typedef l_uint l_uid_t;
+typedef l_ushort l_uid16_t;
typedef l_ulong l_ino_t;
typedef l_int l_key_t;
typedef l_long l_loff_t;
@@ -381,60 +383,6 @@ union l_semun {
l_uintptr_t __pad;
};
-struct l_ipc_perm {
- l_key_t key;
- l_uid_t uid;
- l_gid_t gid;
- l_uid_t cuid;
- l_gid_t cgid;
- l_ushort mode;
- l_ushort seq;
-};
-
-/*
- * Socket defines
- */
-
-#define LINUX_SOL_SOCKET 1
-#define LINUX_SOL_IP 0
-#define LINUX_SOL_IPX 256
-#define LINUX_SOL_AX25 257
-#define LINUX_SOL_TCP 6
-#define LINUX_SOL_UDP 17
-
-#define LINUX_SO_DEBUG 1
-#define LINUX_SO_REUSEADDR 2
-#define LINUX_SO_TYPE 3
-#define LINUX_SO_ERROR 4
-#define LINUX_SO_DONTROUTE 5
-#define LINUX_SO_BROADCAST 6
-#define LINUX_SO_SNDBUF 7
-#define LINUX_SO_RCVBUF 8
-#define LINUX_SO_KEEPALIVE 9
-#define LINUX_SO_OOBINLINE 10
-#define LINUX_SO_NO_CHECK 11
-#define LINUX_SO_PRIORITY 12
-#define LINUX_SO_LINGER 13
-#define LINUX_SO_PASSCRED 16
-#define LINUX_SO_PEERCRED 17
-#define LINUX_SO_RCVLOWAT 18
-#define LINUX_SO_SNDLOWAT 19
-#define LINUX_SO_RCVTIMEO 20
-#define LINUX_SO_SNDTIMEO 21
-#define LINUX_SO_TIMESTAMP 29
-#define LINUX_SO_ACCEPTCONN 30
-
-#define LINUX_IP_TOS 1
-#define LINUX_IP_TTL 2
-#define LINUX_IP_HDRINCL 3
-#define LINUX_IP_OPTIONS 4
-
-#define LINUX_IP_MULTICAST_IF 32
-#define LINUX_IP_MULTICAST_TTL 33
-#define LINUX_IP_MULTICAST_LOOP 34
-#define LINUX_IP_ADD_MEMBERSHIP 35
-#define LINUX_IP_DROP_MEMBERSHIP 36
-
struct l_sockaddr {
l_ushort sa_family;
char sa_data[14];
@@ -464,7 +412,7 @@ struct l_ifreq {
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
- l_int ifru_metric;
+ l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
@@ -474,6 +422,7 @@ struct l_ifreq {
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
+#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
struct l_ifconf {
int ifc_len;
diff --git a/sys/amd64/linux/linux_dummy.c b/sys/amd64/linux/linux_dummy.c
index 85b6757..96f0559 100644
--- a/sys/amd64/linux/linux_dummy.c
+++ b/sys/amd64/linux/linux_dummy.c
@@ -43,9 +43,23 @@ __FBSDID("$FreeBSD$");
/* DTrace init */
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
-DUMMY(mincore);
+UNIMPLEMENTED(afs_syscall);
+UNIMPLEMENTED(create_module); /* added in linux 1.0 removed in 2.6 */
+UNIMPLEMENTED(epoll_ctl_old);
+UNIMPLEMENTED(epoll_wait_old);
+UNIMPLEMENTED(get_kernel_syms); /* added in linux 1.0 removed in 2.6 */
+UNIMPLEMENTED(get_thread_area);
+UNIMPLEMENTED(getpmsg);
+UNIMPLEMENTED(nfsservctl); /* added in linux 2.2 removed in 3.1 */
+UNIMPLEMENTED(putpmsg);
+UNIMPLEMENTED(query_module); /* added in linux 2.2 removed in 2.6 */
+UNIMPLEMENTED(security);
+UNIMPLEMENTED(set_thread_area);
+UNIMPLEMENTED(tuxcall);
+UNIMPLEMENTED(uselib);
+UNIMPLEMENTED(vserver);
+
DUMMY(sendfile);
-DUMMY(ptrace);
DUMMY(syslog);
DUMMY(setfsuid);
DUMMY(setfsgid);
@@ -54,22 +68,10 @@ DUMMY(vhangup);
DUMMY(pivot_root);
DUMMY(adjtimex);
DUMMY(swapoff);
-DUMMY(create_module);
DUMMY(init_module);
DUMMY(delete_module);
-DUMMY(get_kernel_syms);
-DUMMY(query_module);
DUMMY(quotactl);
-DUMMY(nfsservctl);
-DUMMY(getpmsg);
-DUMMY(putpmsg);
-DUMMY(afs_syscall);
-DUMMY(tuxcall);
-DUMMY(security);
-DUMMY(set_thread_area);
DUMMY(lookup_dcookie);
-DUMMY(epoll_ctl_old);
-DUMMY(epoll_wait_old);
DUMMY(remap_file_pages);
DUMMY(semtimedop);
DUMMY(mbind);
@@ -104,15 +106,10 @@ DUMMY(vmsplice);
DUMMY(move_pages);
/* linux 2.6.22: */
DUMMY(signalfd);
-DUMMY(timerfd_create);
-/* linux 2.6.25: */
-DUMMY(timerfd_settime);
-DUMMY(timerfd_gettime);
/* linux 2.6.27: */
DUMMY(signalfd4);
DUMMY(inotify_init1);
/* linux 2.6.31: */
-DUMMY(rt_tgsigqueueinfo);
DUMMY(perf_event_open);
/* linux 2.6.38: */
DUMMY(fanotify_init);
@@ -137,7 +134,6 @@ DUMMY(sched_getattr);
DUMMY(renameat2);
/* linux 3.15: */
DUMMY(seccomp);
-DUMMY(getrandom);
DUMMY(memfd_create);
DUMMY(kexec_file_load);
/* linux 3.18: */
diff --git a/sys/amd64/linux/linux_ipc64.h b/sys/amd64/linux/linux_ipc64.h
deleted file mode 100644
index 913fc1a..0000000
--- a/sys/amd64/linux/linux_ipc64.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*-
- * Copyright (c) 2002 Maxim Sobolev <sobomax@FreeBSD.org>
- * 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 without 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _AMD64_LINUX_LINUX_IPC64_H_
-#define _AMD64_LINUX_LINUX_IPC64_H_
-
-/*
- * The ipc64_perm structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_ipc64_perm
-{
- l_key_t key;
- l_uid_t uid;
- l_gid_t gid;
- l_uid_t cuid;
- l_gid_t cgid;
- l_mode_t mode;
- l_ushort __pad1;
- l_ushort seq;
- l_ushort __pad2;
- l_ulong __unused1;
- l_ulong __unused2;
-};
-
-/*
- * The msqid64_ds structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_msqid64_ds {
- struct l_ipc64_perm msg_perm;
- l_time_t msg_stime; /* last msgsnd time */
- l_ulong __unused1;
- l_time_t msg_rtime; /* last msgrcv time */
- l_ulong __unused2;
- l_time_t msg_ctime; /* last change time */
- l_ulong __unused3;
- l_ulong msg_cbytes; /* current number of bytes on queue */
- l_ulong msg_qnum; /* number of messages in queue */
- l_ulong msg_qbytes; /* max number of bytes on queue */
- l_pid_t msg_lspid; /* pid of last msgsnd */
- l_pid_t msg_lrpid; /* last receive pid */
- l_ulong __unused4;
- l_ulong __unused5;
-};
-
-/*
- * The semid64_ds structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_semid64_ds {
- struct l_ipc64_perm sem_perm; /* permissions */
- l_time_t sem_otime; /* last semop time */
- l_ulong __unused1;
- l_time_t sem_ctime; /* last change time */
- l_ulong __unused2;
- l_ulong sem_nsems; /* no. of semaphores in array */
- l_ulong __unused3;
- l_ulong __unused4;
-};
-
-/*
- * The shmid64_ds structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_shmid64_ds {
- struct l_ipc64_perm shm_perm; /* operation perms */
- l_size_t shm_segsz; /* size of segment (bytes) */
- l_time_t shm_atime; /* last attach time */
- l_time_t shm_dtime; /* last detach time */
- l_time_t shm_ctime; /* last change time */
- l_pid_t shm_cpid; /* pid of creator */
- l_pid_t shm_lpid; /* pid of last operator */
- l_ulong shm_nattch; /* no. of current attaches */
- l_ulong __unused4;
- l_ulong __unused5;
-};
-
-struct l_shminfo64 {
- l_ulong shmmax;
- l_ulong shmmin;
- l_ulong shmmni;
- l_ulong shmseg;
- l_ulong shmall;
- l_ulong __unused1;
- l_ulong __unused2;
- l_ulong __unused3;
- l_ulong __unused4;
-};
-
-#endif /* !_AMD64_LINUX_LINUX_IPC64_H_ */
diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c
index 3a6db17..a7fe90f 100644
--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
#include <compat/linux/linux_util.h>
#include <compat/linux/linux_emul.h>
+#include <x86/include/sysarch.h>
int
linux_execve(struct thread *td, struct linux_execve_args *args)
@@ -226,28 +227,34 @@ int
linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args)
{
int error;
- struct pcb *pcb;
+ struct sysarch_args bsd_args;
LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr);
- error = ENOTSUP;
- pcb = td->td_pcb;
-
switch (args->code) {
- case LINUX_ARCH_GET_GS:
- error = copyout(&pcb->pcb_gsbase, (unsigned long *)args->addr,
- sizeof(args->addr));
- break;
case LINUX_ARCH_SET_GS:
- if (args->addr >= VM_MAXUSER_ADDRESS)
- return(EPERM);
+ bsd_args.op = AMD64_SET_GSBASE;
+ bsd_args.parms = (void *)args->addr;
+ error = sysarch(td, &bsd_args);
+ if (error == EINVAL)
+ error = EPERM;
+ break;
+ case LINUX_ARCH_SET_FS:
+ bsd_args.op = AMD64_SET_FSBASE;
+ bsd_args.parms = (void *)args->addr;
+ error = sysarch(td, &bsd_args);
+ if (error == EINVAL)
+ error = EPERM;
break;
case LINUX_ARCH_GET_FS:
- error = copyout(&pcb->pcb_fsbase, (unsigned long *)args->addr,
- sizeof(args->addr));
+ bsd_args.op = AMD64_GET_FSBASE;
+ bsd_args.parms = (void *)args->addr;
+ error = sysarch(td, &bsd_args);
break;
- case LINUX_ARCH_SET_FS:
- error = linux_set_cloned_tls(td, (void *)args->addr);
+ case LINUX_ARCH_GET_GS:
+ bsd_args.op = AMD64_GET_GSBASE;
+ bsd_args.parms = (void *)args->addr;
+ error = sysarch(td, &bsd_args);
break;
default:
error = EINVAL;
diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h
index a4cdb41..11d3051 100644
--- a/sys/amd64/linux/linux_proto.h
+++ b/sys/amd64/linux/linux_proto.h
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -424,8 +423,8 @@ struct linux_times_args {
struct linux_ptrace_args {
char req_l_[PADL_(l_long)]; l_long req; char req_r_[PADR_(l_long)];
char pid_l_[PADL_(l_long)]; l_long pid; char pid_r_[PADR_(l_long)];
- char addr_l_[PADL_(l_long)]; l_long addr; char addr_r_[PADR_(l_long)];
- char data_l_[PADL_(l_long)]; l_long data; char data_r_[PADR_(l_long)];
+ char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)];
+ char data_l_[PADL_(l_ulong)]; l_ulong data; char data_r_[PADR_(l_ulong)];
};
struct linux_getuid_args {
register_t dummy;
@@ -606,42 +605,15 @@ struct linux_setdomainname_args {
struct linux_iopl_args {
char level_l_[PADL_(l_uint)]; l_uint level; char level_r_[PADR_(l_uint)];
};
-struct linux_create_module_args {
- register_t dummy;
-};
struct linux_init_module_args {
register_t dummy;
};
struct linux_delete_module_args {
register_t dummy;
};
-struct linux_get_kernel_syms_args {
- register_t dummy;
-};
-struct linux_query_module_args {
- register_t dummy;
-};
struct linux_quotactl_args {
register_t dummy;
};
-struct linux_nfsservctl_args {
- register_t dummy;
-};
-struct linux_getpmsg_args {
- register_t dummy;
-};
-struct linux_putpmsg_args {
- register_t dummy;
-};
-struct linux_afs_syscall_args {
- register_t dummy;
-};
-struct linux_tuxcall_args {
- register_t dummy;
-};
-struct linux_security_args {
- register_t dummy;
-};
struct linux_gettid_args {
register_t dummy;
};
@@ -706,21 +678,12 @@ struct linux_sched_getaffinity_args {
char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)];
char user_mask_ptr_l_[PADL_(l_ulong *)]; l_ulong * user_mask_ptr; char user_mask_ptr_r_[PADR_(l_ulong *)];
};
-struct linux_set_thread_area_args {
- register_t dummy;
-};
struct linux_lookup_dcookie_args {
register_t dummy;
};
struct linux_epoll_create_args {
char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)];
};
-struct linux_epoll_ctl_old_args {
- register_t dummy;
-};
-struct linux_epoll_wait_old_args {
- register_t dummy;
-};
struct linux_remap_file_pages_args {
register_t dummy;
};
@@ -996,12 +959,14 @@ struct linux_epoll_pwait_args {
char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
+ char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
};
struct linux_signalfd_args {
register_t dummy;
};
struct linux_timerfd_create_args {
- register_t dummy;
+ char clockid_l_[PADL_(l_int)]; l_int clockid; char clockid_r_[PADR_(l_int)];
+ char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
};
struct linux_eventfd_args {
char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
@@ -1013,10 +978,14 @@ struct linux_fallocate_args {
char len_l_[PADL_(l_loff_t)]; l_loff_t len; char len_r_[PADR_(l_loff_t)];
};
struct linux_timerfd_settime_args {
- register_t dummy;
+ char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+ char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
+ char new_value_l_[PADL_(const struct l_itimerspec *)]; const struct l_itimerspec * new_value; char new_value_r_[PADR_(const struct l_itimerspec *)];
+ char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * old_value; char old_value_r_[PADR_(struct l_itimerspec *)];
};
struct linux_timerfd_gettime_args {
- register_t dummy;
+ char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+ char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * old_value; char old_value_r_[PADR_(struct l_itimerspec *)];
};
struct linux_accept4_args {
char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
@@ -1372,18 +1341,9 @@ int linux_reboot(struct thread *, struct linux_reboot_args *);
int linux_sethostname(struct thread *, struct linux_sethostname_args *);
int linux_setdomainname(struct thread *, struct linux_setdomainname_args *);
int linux_iopl(struct thread *, struct linux_iopl_args *);
-int linux_create_module(struct thread *, struct linux_create_module_args *);
int linux_init_module(struct thread *, struct linux_init_module_args *);
int linux_delete_module(struct thread *, struct linux_delete_module_args *);
-int linux_get_kernel_syms(struct thread *, struct linux_get_kernel_syms_args *);
-int linux_query_module(struct thread *, struct linux_query_module_args *);
int linux_quotactl(struct thread *, struct linux_quotactl_args *);
-int linux_nfsservctl(struct thread *, struct linux_nfsservctl_args *);
-int linux_getpmsg(struct thread *, struct linux_getpmsg_args *);
-int linux_putpmsg(struct thread *, struct linux_putpmsg_args *);
-int linux_afs_syscall(struct thread *, struct linux_afs_syscall_args *);
-int linux_tuxcall(struct thread *, struct linux_tuxcall_args *);
-int linux_security(struct thread *, struct linux_security_args *);
int linux_gettid(struct thread *, struct linux_gettid_args *);
int linux_setxattr(struct thread *, struct linux_setxattr_args *);
int linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *);
@@ -1402,11 +1362,8 @@ int linux_time(struct thread *, struct linux_time_args *);
int linux_sys_futex(struct thread *, struct linux_sys_futex_args *);
int linux_sched_setaffinity(struct thread *, struct linux_sched_setaffinity_args *);
int linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *);
-int linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *);
int linux_lookup_dcookie(struct thread *, struct linux_lookup_dcookie_args *);
int linux_epoll_create(struct thread *, struct linux_epoll_create_args *);
-int linux_epoll_ctl_old(struct thread *, struct linux_epoll_ctl_old_args *);
-int linux_epoll_wait_old(struct thread *, struct linux_epoll_wait_old_args *);
int linux_remap_file_pages(struct thread *, struct linux_remap_file_pages_args *);
int linux_getdents64(struct thread *, struct linux_getdents64_args *);
int linux_set_tid_address(struct thread *, struct linux_set_tid_address_args *);
@@ -1684,18 +1641,9 @@ int linux_pkey_free(struct thread *, struct linux_pkey_free_args *);
#define LINUX_SYS_AUE_linux_sethostname AUE_SYSCTL
#define LINUX_SYS_AUE_linux_setdomainname AUE_SYSCTL
#define LINUX_SYS_AUE_linux_iopl AUE_NULL
-#define LINUX_SYS_AUE_linux_create_module AUE_NULL
#define LINUX_SYS_AUE_linux_init_module AUE_NULL
#define LINUX_SYS_AUE_linux_delete_module AUE_NULL
-#define LINUX_SYS_AUE_linux_get_kernel_syms AUE_NULL
-#define LINUX_SYS_AUE_linux_query_module AUE_NULL
#define LINUX_SYS_AUE_linux_quotactl AUE_QUOTACTL
-#define LINUX_SYS_AUE_linux_nfsservctl AUE_NULL
-#define LINUX_SYS_AUE_linux_getpmsg AUE_GETPMSG
-#define LINUX_SYS_AUE_linux_putpmsg AUE_PUTPMSG
-#define LINUX_SYS_AUE_linux_afs_syscall AUE_NULL
-#define LINUX_SYS_AUE_linux_tuxcall AUE_NULL
-#define LINUX_SYS_AUE_linux_security AUE_NULL
#define LINUX_SYS_AUE_linux_gettid AUE_NULL
#define LINUX_SYS_AUE_linux_setxattr AUE_NULL
#define LINUX_SYS_AUE_linux_lsetxattr AUE_NULL
@@ -1714,11 +1662,8 @@ int linux_pkey_free(struct thread *, struct linux_pkey_free_args *);
#define LINUX_SYS_AUE_linux_sys_futex AUE_NULL
#define LINUX_SYS_AUE_linux_sched_setaffinity AUE_NULL
#define LINUX_SYS_AUE_linux_sched_getaffinity AUE_NULL
-#define LINUX_SYS_AUE_linux_set_thread_area AUE_NULL
#define LINUX_SYS_AUE_linux_lookup_dcookie AUE_NULL
#define LINUX_SYS_AUE_linux_epoll_create AUE_NULL
-#define LINUX_SYS_AUE_linux_epoll_ctl_old AUE_NULL
-#define LINUX_SYS_AUE_linux_epoll_wait_old AUE_NULL
#define LINUX_SYS_AUE_linux_remap_file_pages AUE_NULL
#define LINUX_SYS_AUE_linux_getdents64 AUE_GETDIRENTRIES
#define LINUX_SYS_AUE_linux_set_tid_address AUE_NULL
diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c
new file mode 100644
index 0000000..e7d4867
--- /dev/null
+++ b/sys/amd64/linux/linux_ptrace.c
@@ -0,0 +1,414 @@
+/*-
+ * Copyright (c) 2017 Edward Tomasz Napierala <trasz@FreeBSD.org>
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/ptrace.h>
+#include <sys/syscallsubr.h>
+
+#include <machine/pcb.h>
+#include <machine/reg.h>
+
+#include <amd64/linux/linux.h>
+#include <amd64/linux/linux_proto.h>
+#include <compat/linux/linux_signal.h>
+
+#define LINUX_PTRACE_TRACEME 0
+#define LINUX_PTRACE_PEEKTEXT 1
+#define LINUX_PTRACE_PEEKDATA 2
+#define LINUX_PTRACE_PEEKUSER 3
+#define LINUX_PTRACE_POKETEXT 4
+#define LINUX_PTRACE_POKEDATA 5
+#define LINUX_PTRACE_POKEUSER 6
+#define LINUX_PTRACE_CONT 7
+#define LINUX_PTRACE_KILL 8
+#define LINUX_PTRACE_SINGLESTEP 9
+#define LINUX_PTRACE_GETREGS 12
+#define LINUX_PTRACE_SETREGS 13
+#define LINUX_PTRACE_GETFPREGS 14
+#define LINUX_PTRACE_SETFPREGS 15
+#define LINUX_PTRACE_ATTACH 16
+#define LINUX_PTRACE_DETACH 17
+#define LINUX_PTRACE_SYSCALL 24
+#define LINUX_PTRACE_SETOPTIONS 0x4200
+#define LINUX_PTRACE_GETREGSET 0x4204
+#define LINUX_PTRACE_SEIZE 0x4206
+
+#define LINUX_PTRACE_O_TRACESYSGOOD 1
+#define LINUX_PTRACE_O_TRACEFORK 2
+#define LINUX_PTRACE_O_TRACEVFORK 4
+#define LINUX_PTRACE_O_TRACECLONE 8
+#define LINUX_PTRACE_O_TRACEEXEC 16
+#define LINUX_PTRACE_O_TRACEVFORKDONE 32
+#define LINUX_PTRACE_O_TRACEEXIT 64
+#define LINUX_PTRACE_O_TRACESECCOMP 128
+#define LINUX_PTRACE_O_EXITKILL 1048576
+#define LINUX_PTRACE_O_SUSPEND_SECCOMP 2097152
+
+#define LINUX_NT_PRSTATUS 1
+
+#define LINUX_PTRACE_O_MASK (LINUX_PTRACE_O_TRACESYSGOOD | \
+ LINUX_PTRACE_O_TRACEFORK | LINUX_PTRACE_O_TRACEVFORK | \
+ LINUX_PTRACE_O_TRACECLONE | LINUX_PTRACE_O_TRACEEXEC | \
+ LINUX_PTRACE_O_TRACEVFORKDONE | LINUX_PTRACE_O_TRACEEXIT | \
+ LINUX_PTRACE_O_TRACESECCOMP | LINUX_PTRACE_O_EXITKILL | \
+ LINUX_PTRACE_O_SUSPEND_SECCOMP)
+
+static int
+map_signum(int lsig, int *bsigp)
+{
+ int bsig;
+
+ if (lsig == 0) {
+ *bsigp = 0;
+ return (0);
+ }
+
+ if (lsig < 0 || lsig > LINUX_SIGRTMAX)
+ return (EINVAL);
+
+ bsig = linux_to_bsd_signal(lsig);
+ if (bsig == SIGSTOP)
+ bsig = 0;
+
+ *bsigp = bsig;
+ return (0);
+}
+
+struct linux_pt_reg {
+ l_ulong r15;
+ l_ulong r14;
+ l_ulong r13;
+ l_ulong r12;
+ l_ulong rbp;
+ l_ulong rbx;
+ l_ulong r11;
+ l_ulong r10;
+ l_ulong r9;
+ l_ulong r8;
+ l_ulong rax;
+ l_ulong rcx;
+ l_ulong rdx;
+ l_ulong rsi;
+ l_ulong rdi;
+ l_ulong orig_rax;
+ l_ulong rip;
+ l_ulong cs;
+ l_ulong eflags;
+ l_ulong rsp;
+ l_ulong ss;
+};
+
+/*
+ * Translate amd64 ptrace registers between Linux and FreeBSD formats.
+ * The translation is pretty straighforward, for all registers but
+ * orig_rax on Linux side and r_trapno and r_err in FreeBSD.
+ */
+static void
+map_regs_to_linux(struct reg *b_reg, struct linux_pt_reg *l_reg)
+{
+
+ l_reg->r15 = b_reg->r_r15;
+ l_reg->r14 = b_reg->r_r14;
+ l_reg->r13 = b_reg->r_r13;
+ l_reg->r12 = b_reg->r_r12;
+ l_reg->rbp = b_reg->r_rbp;
+ l_reg->rbx = b_reg->r_rbx;
+ l_reg->r11 = b_reg->r_r11;
+ l_reg->r10 = b_reg->r_r10;
+ l_reg->r9 = b_reg->r_r9;
+ l_reg->r8 = b_reg->r_r8;
+ l_reg->rax = b_reg->r_rax;
+ l_reg->rcx = b_reg->r_rcx;
+ l_reg->rdx = b_reg->r_rdx;
+ l_reg->rsi = b_reg->r_rsi;
+ l_reg->rdi = b_reg->r_rdi;
+ l_reg->orig_rax = b_reg->r_rax;
+ l_reg->rip = b_reg->r_rip;
+ l_reg->cs = b_reg->r_cs;
+ l_reg->eflags = b_reg->r_rflags;
+ l_reg->rsp = b_reg->r_rsp;
+ l_reg->ss = b_reg->r_ss;
+}
+
+static void
+map_regs_from_linux(struct reg *b_reg, struct linux_pt_reg *l_reg)
+{
+ b_reg->r_r15 = l_reg->r15;
+ b_reg->r_r14 = l_reg->r14;
+ b_reg->r_r13 = l_reg->r13;
+ b_reg->r_r12 = l_reg->r12;
+ b_reg->r_r11 = l_reg->r11;
+ b_reg->r_r10 = l_reg->r10;
+ b_reg->r_r9 = l_reg->r9;
+ b_reg->r_r8 = l_reg->r8;
+ b_reg->r_rdi = l_reg->rdi;
+ b_reg->r_rsi = l_reg->rsi;
+ b_reg->r_rbp = l_reg->rbp;
+ b_reg->r_rbx = l_reg->rbx;
+ b_reg->r_rdx = l_reg->rdx;
+ b_reg->r_rcx = l_reg->rcx;
+ b_reg->r_rax = l_reg->rax;
+
+ /*
+ * XXX: Are zeroes the right thing to put here?
+ */
+ b_reg->r_trapno = 0;
+ b_reg->r_fs = 0;
+ b_reg->r_gs = 0;
+ b_reg->r_err = 0;
+ b_reg->r_es = 0;
+ b_reg->r_ds = 0;
+
+ b_reg->r_rip = l_reg->rip;
+ b_reg->r_cs = l_reg->cs;
+ b_reg->r_rflags = l_reg->eflags;
+ b_reg->r_rsp = l_reg->rsp;
+ b_reg->r_ss = l_reg->ss;
+}
+
+static int
+linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data)
+{
+ int error;
+
+ error = kern_ptrace(td, PT_READ_I, pid, addr, 0);
+ if (error == 0)
+ error = copyout(td->td_retval, data, sizeof(l_int));
+ td->td_retval[0] = error;
+
+ return (error);
+}
+
+static int
+linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data)
+{
+ int mask;
+
+ mask = 0;
+
+ if (data & ~LINUX_PTRACE_O_MASK) {
+ printf("%s: unknown ptrace option %lx set; "
+ "returning EINVAL\n",
+ __func__, data & ~LINUX_PTRACE_O_MASK);
+ return (EINVAL);
+ }
+
+ /*
+ * PTRACE_O_EXITKILL is ignored, we do that by default.
+ */
+
+ if (data & LINUX_PTRACE_O_TRACESYSGOOD) {
+ printf("%s: PTRACE_O_TRACESYSGOOD not implemented; "
+ "returning EINVAL\n", __func__);
+ return (EINVAL);
+ }
+
+ if (data & LINUX_PTRACE_O_TRACEFORK)
+ mask |= PTRACE_FORK;
+
+ if (data & LINUX_PTRACE_O_TRACEVFORK)
+ mask |= PTRACE_VFORK;
+
+ if (data & LINUX_PTRACE_O_TRACECLONE)
+ mask |= PTRACE_VFORK;
+
+ if (data & LINUX_PTRACE_O_TRACEEXEC)
+ mask |= PTRACE_EXEC;
+
+ if (data & LINUX_PTRACE_O_TRACEVFORKDONE)
+ mask |= PTRACE_VFORK; /* XXX: Close enough? */
+
+ if (data & LINUX_PTRACE_O_TRACEEXIT) {
+ printf("%s: PTRACE_O_TRACEEXIT not implemented; "
+ "returning EINVAL\n", __func__);
+ return (EINVAL);
+ }
+
+ return (kern_ptrace(td, PT_SET_EVENT_MASK, pid, &mask, sizeof(mask)));
+}
+
+static int
+linux_ptrace_getregs(struct thread *td, pid_t pid, void *data)
+{
+ struct ptrace_lwpinfo lwpinfo;
+ struct reg b_reg;
+ struct linux_pt_reg l_reg;
+ int error;
+
+ error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0);
+ if (error != 0)
+ return (error);
+
+ map_regs_to_linux(&b_reg, &l_reg);
+
+ /*
+ * The strace(1) utility depends on RAX being set to -ENOSYS
+ * on syscall entry.
+ */
+ error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo));
+ if (error != 0) {
+ printf("%s: PT_LWPINFO failed with error %d\n", __func__, error);
+ return (error);
+ }
+ if (lwpinfo.pl_flags & PL_FLAG_SCE)
+ l_reg.rax = -38; // XXX: Don't hardcode?
+
+ error = copyout(&l_reg, (void *)data, sizeof(l_reg));
+ return (error);
+}
+
+static int
+linux_ptrace_setregs(struct thread *td, pid_t pid, void *data)
+{
+ struct reg b_reg;
+ struct linux_pt_reg l_reg;
+ int error;
+
+ error = copyin(data, &l_reg, sizeof(l_reg));
+ if (error != 0)
+ return (error);
+ map_regs_from_linux(&b_reg, &l_reg);
+ error = kern_ptrace(td, PT_SETREGS, pid, &b_reg, 0);
+ return (error);
+}
+
+static int
+linux_ptrace_getregset(struct thread *td, pid_t pid, l_ulong addr, l_ulong data)
+{
+
+ switch (addr) {
+ case LINUX_NT_PRSTATUS:
+ printf("%s: NT_PRSTATUS not implemented; returning EINVAL\n",
+ __func__);
+ return (EINVAL);
+ default:
+ printf("%s: PTRACE_GETREGSET request %ld not implemented; "
+ "returning EINVAL\n", __func__, addr);
+ return (EINVAL);
+ }
+}
+
+static int
+linux_ptrace_seize(struct thread *td, pid_t pid, l_ulong addr, l_ulong data)
+{
+
+ printf("%s: PTRACE_SEIZE not implemented; returning EINVAL\n", __func__);
+ return (EINVAL);
+}
+
+int
+linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
+{
+ void *addr;
+ pid_t pid;
+ int error, sig;
+
+ pid = (pid_t)uap->pid;
+ addr = (void *)uap->addr;
+
+ switch (uap->req) {
+ case LINUX_PTRACE_TRACEME:
+ error = kern_ptrace(td, PT_TRACE_ME, 0, 0, 0);
+ break;
+ case LINUX_PTRACE_PEEKTEXT:
+ case LINUX_PTRACE_PEEKDATA:
+ error = linux_ptrace_peek(td, pid, addr, (void *)uap->data);
+ if (error != 0)
+ return (error);
+ /*
+ * Linux expects this syscall to read 64 bits, not 32.
+ */
+ error = linux_ptrace_peek(td, pid,
+ (void *)(uap->addr + 4), (void *)(uap->data + 4));
+ break;
+ case LINUX_PTRACE_POKETEXT:
+ error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data);
+ break;
+ case LINUX_PTRACE_POKEDATA:
+ error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data);
+ break;
+ case LINUX_PTRACE_CONT:
+ error = map_signum(uap->data, &sig);
+ if (error != 0)
+ break;
+ error = kern_ptrace(td, PT_CONTINUE, pid, (void *)1, sig);
+ break;
+ case LINUX_PTRACE_KILL:
+ error = kern_ptrace(td, PT_KILL, pid, addr, uap->data);
+ break;
+ case LINUX_PTRACE_SINGLESTEP:
+ error = map_signum(uap->data, &sig);
+ if (error != 0)
+ break;
+ error = kern_ptrace(td, PT_STEP, pid, (void *)1, sig);
+ break;
+ case LINUX_PTRACE_GETREGS:
+ error = linux_ptrace_getregs(td, pid, (void *)uap->data);
+ break;
+ case LINUX_PTRACE_SETREGS:
+ error = linux_ptrace_setregs(td, pid, (void *)uap->data);
+ break;
+ case LINUX_PTRACE_ATTACH:
+ error = kern_ptrace(td, PT_ATTACH, pid, addr, uap->data);
+ break;
+ case LINUX_PTRACE_DETACH:
+ error = map_signum(uap->data, &sig);
+ if (error != 0)
+ break;
+ error = kern_ptrace(td, PT_DETACH, pid, (void *)1, sig);
+ break;
+ case LINUX_PTRACE_SYSCALL:
+ error = map_signum(uap->data, &sig);
+ if (error != 0)
+ break;
+ error = kern_ptrace(td, PT_SYSCALL, pid, (void *)1, sig);
+ break;
+ case LINUX_PTRACE_SETOPTIONS:
+ error = linux_ptrace_setoptions(td, pid, uap->data);
+ break;
+ case LINUX_PTRACE_GETREGSET:
+ error = linux_ptrace_getregset(td, pid, uap->addr, uap->data);
+ break;
+ case LINUX_PTRACE_SEIZE:
+ error = linux_ptrace_seize(td, pid, uap->addr, uap->data);
+ break;
+ default:
+ printf("%s: ptrace(%ld, ...) not implemented; returning EINVAL\n",
+ __func__, uap->req);
+ error = EINVAL;
+ break;
+ }
+
+ return (error);
+}
diff --git a/sys/amd64/linux/linux_syscall.h b/sys/amd64/linux/linux_syscall.h
index 05af0ac..717f0fa 100644
--- a/sys/amd64/linux/linux_syscall.h
+++ b/sys/amd64/linux/linux_syscall.h
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
#define LINUX_SYS_read 0
@@ -177,18 +176,9 @@
#define LINUX_SYS_linux_sethostname 170
#define LINUX_SYS_linux_setdomainname 171
#define LINUX_SYS_linux_iopl 172
-#define LINUX_SYS_linux_create_module 174
#define LINUX_SYS_linux_init_module 175
#define LINUX_SYS_linux_delete_module 176
-#define LINUX_SYS_linux_get_kernel_syms 177
-#define LINUX_SYS_linux_query_module 178
#define LINUX_SYS_linux_quotactl 179
-#define LINUX_SYS_linux_nfsservctl 180
-#define LINUX_SYS_linux_getpmsg 181
-#define LINUX_SYS_linux_putpmsg 182
-#define LINUX_SYS_linux_afs_syscall 183
-#define LINUX_SYS_linux_tuxcall 184
-#define LINUX_SYS_linux_security 185
#define LINUX_SYS_linux_gettid 186
#define LINUX_SYS_linux_setxattr 188
#define LINUX_SYS_linux_lsetxattr 189
@@ -207,11 +197,8 @@
#define LINUX_SYS_linux_sys_futex 202
#define LINUX_SYS_linux_sched_setaffinity 203
#define LINUX_SYS_linux_sched_getaffinity 204
-#define LINUX_SYS_linux_set_thread_area 205
#define LINUX_SYS_linux_lookup_dcookie 212
#define LINUX_SYS_linux_epoll_create 213
-#define LINUX_SYS_linux_epoll_ctl_old 214
-#define LINUX_SYS_linux_epoll_wait_old 215
#define LINUX_SYS_linux_remap_file_pages 216
#define LINUX_SYS_linux_getdents64 217
#define LINUX_SYS_linux_set_tid_address 218
diff --git a/sys/amd64/linux/linux_syscalls.c b/sys/amd64/linux/linux_syscalls.c
index 4158729..98f4f40 100644
--- a/sys/amd64/linux/linux_syscalls.c
+++ b/sys/amd64/linux/linux_syscalls.c
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
const char *linux_syscallnames[] = {
@@ -182,18 +181,18 @@ const char *linux_syscallnames[] = {
"linux_setdomainname", /* 171 = linux_setdomainname */
"linux_iopl", /* 172 = linux_iopl */
"#173", /* 173 = ioperm */
- "linux_create_module", /* 174 = linux_create_module */
+ "#174", /* 174 = create_module */
"linux_init_module", /* 175 = linux_init_module */
"linux_delete_module", /* 176 = linux_delete_module */
- "linux_get_kernel_syms", /* 177 = linux_get_kernel_syms */
- "linux_query_module", /* 178 = linux_query_module */
+ "#177", /* 177 = get_kernel_syms */
+ "#178", /* 178 = query_module */
"linux_quotactl", /* 179 = linux_quotactl */
- "linux_nfsservctl", /* 180 = linux_nfsservctl */
- "linux_getpmsg", /* 181 = linux_getpmsg */
- "linux_putpmsg", /* 182 = linux_putpmsg */
- "linux_afs_syscall", /* 183 = linux_afs_syscall */
- "linux_tuxcall", /* 184 = linux_tuxcall */
- "linux_security", /* 185 = linux_security */
+ "#180", /* 180 = nfsservctl */
+ "#181", /* 181 = getpmsg */
+ "#182", /* 182 = putpmsg */
+ "#183", /* 183 = afs_syscall */
+ "#184", /* 184 = tuxcall */
+ "#185", /* 185 = security */
"linux_gettid", /* 186 = linux_gettid */
"#187", /* 187 = linux_readahead */
"linux_setxattr", /* 188 = linux_setxattr */
@@ -213,17 +212,17 @@ const char *linux_syscallnames[] = {
"linux_sys_futex", /* 202 = linux_sys_futex */
"linux_sched_setaffinity", /* 203 = linux_sched_setaffinity */
"linux_sched_getaffinity", /* 204 = linux_sched_getaffinity */
- "linux_set_thread_area", /* 205 = linux_set_thread_area */
+ "#205", /* 205 = set_thread_area */
"#206", /* 206 = linux_io_setup */
"#207", /* 207 = linux_io_destroy */
"#208", /* 208 = linux_io_getevents */
"#209", /* 209 = linux_io_submit */
"#210", /* 210 = linux_io_cancel */
- "#211", /* 211 = linux_get_thread_area */
+ "#211", /* 211 = get_thread_area */
"linux_lookup_dcookie", /* 212 = linux_lookup_dcookie */
"linux_epoll_create", /* 213 = linux_epoll_create */
- "linux_epoll_ctl_old", /* 214 = linux_epoll_ctl_old */
- "linux_epoll_wait_old", /* 215 = linux_epoll_wait_old */
+ "#214", /* 214 = epoll_ctl_old */
+ "#215", /* 215 = epoll_wait_old */
"linux_remap_file_pages", /* 216 = linux_remap_file_pages */
"linux_getdents64", /* 217 = linux_getdents64 */
"linux_set_tid_address", /* 218 = linux_set_tid_address */
diff --git a/sys/amd64/linux/linux_sysent.c b/sys/amd64/linux/linux_sysent.c
index f52fd83..3b672b1 100644
--- a/sys/amd64/linux/linux_sysent.c
+++ b/sys/amd64/linux/linux_sysent.c
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
#include <sys/param.h>
@@ -192,18 +191,18 @@ struct sysent linux_sysent[] = {
{ AS(linux_setdomainname_args), (sy_call_t *)linux_setdomainname, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 171 = linux_setdomainname */
{ AS(linux_iopl_args), (sy_call_t *)linux_iopl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 172 = linux_iopl */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 173 = ioperm */
- { 0, (sy_call_t *)linux_create_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 174 = linux_create_module */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 174 = create_module */
{ 0, (sy_call_t *)linux_init_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 175 = linux_init_module */
{ 0, (sy_call_t *)linux_delete_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 176 = linux_delete_module */
- { 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 177 = linux_get_kernel_syms */
- { 0, (sy_call_t *)linux_query_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 178 = linux_query_module */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 177 = get_kernel_syms */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 178 = query_module */
{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 179 = linux_quotactl */
- { 0, (sy_call_t *)linux_nfsservctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 180 = linux_nfsservctl */
- { 0, (sy_call_t *)linux_getpmsg, AUE_GETPMSG, NULL, 0, 0, 0, SY_THR_STATIC }, /* 181 = linux_getpmsg */
- { 0, (sy_call_t *)linux_putpmsg, AUE_PUTPMSG, NULL, 0, 0, 0, SY_THR_STATIC }, /* 182 = linux_putpmsg */
- { 0, (sy_call_t *)linux_afs_syscall, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 183 = linux_afs_syscall */
- { 0, (sy_call_t *)linux_tuxcall, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 184 = linux_tuxcall */
- { 0, (sy_call_t *)linux_security, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 185 = linux_security */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 180 = nfsservctl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 181 = getpmsg */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 182 = putpmsg */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 183 = afs_syscall */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 184 = tuxcall */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 185 = security */
{ 0, (sy_call_t *)linux_gettid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 186 = linux_gettid */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 187 = linux_readahead */
{ 0, (sy_call_t *)linux_setxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 188 = linux_setxattr */
@@ -223,17 +222,17 @@ struct sysent linux_sysent[] = {
{ AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 202 = linux_sys_futex */
{ AS(linux_sched_setaffinity_args), (sy_call_t *)linux_sched_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 203 = linux_sched_setaffinity */
{ AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 204 = linux_sched_getaffinity */
- { 0, (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 205 = linux_set_thread_area */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 205 = set_thread_area */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 206 = linux_io_setup */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 207 = linux_io_destroy */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 208 = linux_io_getevents */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 209 = linux_io_submit */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 210 = linux_io_cancel */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 211 = linux_get_thread_area */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 211 = get_thread_area */
{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 212 = linux_lookup_dcookie */
{ AS(linux_epoll_create_args), (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 213 = linux_epoll_create */
- { 0, (sy_call_t *)linux_epoll_ctl_old, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 214 = linux_epoll_ctl_old */
- { 0, (sy_call_t *)linux_epoll_wait_old, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 215 = linux_epoll_wait_old */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 214 = epoll_ctl_old */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 215 = epoll_wait_old */
{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 216 = linux_remap_file_pages */
{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_GETDIRENTRIES, NULL, 0, 0, 0, SY_THR_STATIC }, /* 217 = linux_getdents64 */
{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 218 = linux_set_tid_address */
@@ -301,11 +300,11 @@ struct sysent linux_sysent[] = {
{ AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 280 = linux_utimensat */
{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 281 = linux_epoll_pwait */
{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 282 = linux_signalfd */
- { 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 283 = linux_timerfd_create */
+ { AS(linux_timerfd_create_args), (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 283 = linux_timerfd_create */
{ AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 284 = linux_eventfd */
{ AS(linux_fallocate_args), (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 285 = linux_fallocate */
- { 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 286 = linux_timerfd_settime */
- { 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 287 = linux_timerfd_gettime */
+ { AS(linux_timerfd_settime_args), (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 286 = linux_timerfd_settime */
+ { AS(linux_timerfd_gettime_args), (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 287 = linux_timerfd_gettime */
{ AS(linux_accept4_args), (sy_call_t *)linux_accept4, AUE_ACCEPT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 288 = linux_accept4 */
{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 289 = linux_signalfd4 */
{ AS(linux_eventfd2_args), (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 290 = linux_eventfd2 */
diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c
index 2baaf60..a695d0f 100644
--- a/sys/amd64/linux/linux_systrace_args.c
+++ b/sys/amd64/linux/linux_systrace_args.c
@@ -874,8 +874,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct linux_ptrace_args *p = params;
iarg[0] = p->req; /* l_long */
iarg[1] = p->pid; /* l_long */
- iarg[2] = p->addr; /* l_long */
- iarg[3] = p->data; /* l_long */
+ iarg[2] = p->addr; /* l_ulong */
+ iarg[3] = p->data; /* l_ulong */
*n_args = 4;
break;
}
@@ -1396,11 +1396,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 1;
break;
}
- /* linux_create_module */
- case 174: {
- *n_args = 0;
- break;
- }
/* linux_init_module */
case 175: {
*n_args = 0;
@@ -1411,51 +1406,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 0;
break;
}
- /* linux_get_kernel_syms */
- case 177: {
- *n_args = 0;
- break;
- }
- /* linux_query_module */
- case 178: {
- *n_args = 0;
- break;
- }
/* linux_quotactl */
case 179: {
*n_args = 0;
break;
}
- /* linux_nfsservctl */
- case 180: {
- *n_args = 0;
- break;
- }
- /* linux_getpmsg */
- case 181: {
- *n_args = 0;
- break;
- }
- /* linux_putpmsg */
- case 182: {
- *n_args = 0;
- break;
- }
- /* linux_afs_syscall */
- case 183: {
- *n_args = 0;
- break;
- }
- /* linux_tuxcall */
- case 184: {
- *n_args = 0;
- break;
- }
- /* linux_security */
- case 185: {
- *n_args = 0;
- break;
- }
/* linux_gettid */
case 186: {
*n_args = 0;
@@ -1566,11 +1521,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 3;
break;
}
- /* linux_set_thread_area */
- case 205: {
- *n_args = 0;
- break;
- }
/* linux_lookup_dcookie */
case 212: {
*n_args = 0;
@@ -1583,16 +1533,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 1;
break;
}
- /* linux_epoll_ctl_old */
- case 214: {
- *n_args = 0;
- break;
- }
- /* linux_epoll_wait_old */
- case 215: {
- *n_args = 0;
- break;
- }
/* linux_remap_file_pages */
case 216: {
*n_args = 0;
@@ -2068,7 +2008,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
iarg[2] = p->maxevents; /* l_int */
iarg[3] = p->timeout; /* l_int */
uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
- *n_args = 5;
+ iarg[5] = p->sigsetsize; /* l_size_t */
+ *n_args = 6;
break;
}
/* linux_signalfd */
@@ -2078,7 +2019,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
}
/* linux_timerfd_create */
case 283: {
- *n_args = 0;
+ struct linux_timerfd_create_args *p = params;
+ iarg[0] = p->clockid; /* l_int */
+ iarg[1] = p->flags; /* l_int */
+ *n_args = 2;
break;
}
/* linux_eventfd */
@@ -2100,12 +2044,20 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
}
/* linux_timerfd_settime */
case 286: {
- *n_args = 0;
+ struct linux_timerfd_settime_args *p = params;
+ iarg[0] = p->fd; /* l_int */
+ iarg[1] = p->flags; /* l_int */
+ uarg[2] = (intptr_t) p->new_value; /* const struct l_itimerspec * */
+ uarg[3] = (intptr_t) p->old_value; /* struct l_itimerspec * */
+ *n_args = 4;
break;
}
/* linux_timerfd_gettime */
case 287: {
- *n_args = 0;
+ struct linux_timerfd_gettime_args *p = params;
+ iarg[0] = p->fd; /* l_int */
+ uarg[1] = (intptr_t) p->old_value; /* struct l_itimerspec * */
+ *n_args = 2;
break;
}
/* linux_accept4 */
@@ -3971,10 +3923,10 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_long";
break;
case 2:
- p = "l_long";
+ p = "l_ulong";
break;
case 3:
- p = "l_long";
+ p = "l_ulong";
break;
default:
break;
@@ -4759,42 +4711,15 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* linux_create_module */
- case 174:
- break;
/* linux_init_module */
case 175:
break;
/* linux_delete_module */
case 176:
break;
- /* linux_get_kernel_syms */
- case 177:
- break;
- /* linux_query_module */
- case 178:
- break;
/* linux_quotactl */
case 179:
break;
- /* linux_nfsservctl */
- case 180:
- break;
- /* linux_getpmsg */
- case 181:
- break;
- /* linux_putpmsg */
- case 182:
- break;
- /* linux_afs_syscall */
- case 183:
- break;
- /* linux_tuxcall */
- case 184:
- break;
- /* linux_security */
- case 185:
- break;
/* linux_gettid */
case 186:
break;
@@ -4914,9 +4839,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* linux_set_thread_area */
- case 205:
- break;
/* linux_lookup_dcookie */
case 212:
break;
@@ -4930,12 +4852,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* linux_epoll_ctl_old */
- case 214:
- break;
- /* linux_epoll_wait_old */
- case 215:
- break;
/* linux_remap_file_pages */
case 216:
break;
@@ -5635,6 +5551,9 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 4:
p = "l_sigset_t *";
break;
+ case 5:
+ p = "l_size_t";
+ break;
default:
break;
};
@@ -5644,6 +5563,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timerfd_create */
case 283:
+ switch(ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "l_int";
+ break;
+ default:
+ break;
+ };
break;
/* linux_eventfd */
case 284:
@@ -5676,9 +5605,35 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timerfd_settime */
case 286:
+ switch(ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "l_int";
+ break;
+ case 2:
+ p = "const struct l_itimerspec *";
+ break;
+ case 3:
+ p = "struct l_itimerspec *";
+ break;
+ default:
+ break;
+ };
break;
/* linux_timerfd_gettime */
case 287:
+ switch(ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "struct l_itimerspec *";
+ break;
+ default:
+ break;
+ };
break;
/* linux_accept4 */
case 288:
@@ -5771,7 +5726,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland struct iovec *";
+ p = "struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -5793,7 +5748,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland struct iovec *";
+ p = "struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -5821,7 +5776,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 3:
- p = "userland l_siginfo_t *";
+ p = "l_siginfo_t *";
break;
default:
break;
@@ -5932,13 +5887,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 309:
switch(ndx) {
case 0:
- p = "userland l_uint *";
+ p = "l_uint *";
break;
case 1:
- p = "userland l_uint *";
+ p = "l_uint *";
break;
case 2:
- p = "userland void *";
+ p = "void *";
break;
default:
break;
@@ -5951,13 +5906,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
break;
case 3:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 4:
p = "l_ulong";
@@ -5976,13 +5931,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
break;
case 3:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 4:
p = "l_ulong";
@@ -6023,7 +5978,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland const char *";
+ p = "const char *";
break;
case 2:
p = "l_int";
@@ -6039,7 +5994,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland void *";
+ p = "void *";
break;
case 2:
p = "l_uint";
@@ -6055,7 +6010,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland void *";
+ p = "void *";
break;
case 2:
p = "l_uint";
@@ -6074,13 +6029,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland const char *";
+ p = "const char *";
break;
case 2:
p = "l_int";
break;
case 3:
- p = "userland const char *";
+ p = "const char *";
break;
case 4:
p = "unsigned int";
@@ -6099,7 +6054,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_uint";
break;
case 2:
- p = "userland const char *";
+ p = "const char *";
break;
default:
break;
@@ -6109,7 +6064,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 318:
switch(ndx) {
case 0:
- p = "userland char *";
+ p = "char *";
break;
case 1:
p = "l_size_t";
@@ -6125,7 +6080,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 319:
switch(ndx) {
case 0:
- p = "userland const char *";
+ p = "const char *";
break;
case 1:
p = "l_uint";
@@ -6147,7 +6102,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 3:
- p = "userland const char *";
+ p = "const char *";
break;
case 4:
p = "l_ulong";
@@ -6163,7 +6118,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland void *";
+ p = "void *";
break;
case 2:
p = "l_uint";
@@ -6179,13 +6134,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland const char *";
+ p = "const char *";
break;
case 2:
- p = "userland const char **";
+ p = "const char **";
break;
case 3:
- p = "userland const char **";
+ p = "const char **";
break;
case 4:
p = "l_int";
@@ -6240,13 +6195,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland l_loff_t *";
+ p = "l_loff_t *";
break;
case 2:
p = "l_int";
break;
case 3:
- p = "userland l_loff_t *";
+ p = "l_loff_t *";
break;
case 4:
p = "l_size_t";
@@ -6265,7 +6220,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -6290,7 +6245,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -7163,30 +7118,12 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* linux_create_module */
- case 174:
/* linux_init_module */
case 175:
/* linux_delete_module */
case 176:
- /* linux_get_kernel_syms */
- case 177:
- /* linux_query_module */
- case 178:
/* linux_quotactl */
case 179:
- /* linux_nfsservctl */
- case 180:
- /* linux_getpmsg */
- case 181:
- /* linux_putpmsg */
- case 182:
- /* linux_afs_syscall */
- case 183:
- /* linux_tuxcall */
- case 184:
- /* linux_security */
- case 185:
/* linux_gettid */
case 186:
/* linux_setxattr */
@@ -7238,8 +7175,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* linux_set_thread_area */
- case 205:
/* linux_lookup_dcookie */
case 212:
/* linux_epoll_create */
@@ -7247,10 +7182,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* linux_epoll_ctl_old */
- case 214:
- /* linux_epoll_wait_old */
- case 215:
/* linux_remap_file_pages */
case 216:
/* linux_getdents64 */
@@ -7494,6 +7425,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 282:
/* linux_timerfd_create */
case 283:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_eventfd */
case 284:
if (ndx == 0 || ndx == 1)
@@ -7506,8 +7440,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timerfd_settime */
case 286:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_timerfd_gettime */
case 287:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_accept4 */
case 288:
if (ndx == 0 || ndx == 1)
diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master
index 291953b..3981ff3 100644
--- a/sys/amd64/linux/syscalls.master
+++ b/sys/amd64/linux/syscalls.master
@@ -219,7 +219,7 @@
99 AUE_NULL STD { int linux_sysinfo(struct l_sysinfo *info); }
100 AUE_NULL STD { int linux_times(struct l_times_argv *buf); }
101 AUE_PTRACE STD { int linux_ptrace(l_long req, l_long pid, \
- l_long addr, l_long data); }
+ l_ulong addr, l_ulong data); }
102 AUE_GETUID STD { int linux_getuid(void); }
103 AUE_NULL STD { int linux_syslog(l_int type, char *buf, \
l_int len); }
@@ -333,18 +333,18 @@
l_int len); }
172 AUE_NULL STD { int linux_iopl(l_uint level); }
173 AUE_NULL UNIMPL ioperm
-174 AUE_NULL STD { int linux_create_module(void); }
+174 AUE_NULL UNIMPL create_module
175 AUE_NULL STD { int linux_init_module(void); }
176 AUE_NULL STD { int linux_delete_module(void); }
-177 AUE_NULL STD { int linux_get_kernel_syms(void); }
-178 AUE_NULL STD { int linux_query_module(void); }
+177 AUE_NULL UNIMPL get_kernel_syms
+178 AUE_NULL UNIMPL query_module
179 AUE_QUOTACTL STD { int linux_quotactl(void); }
-180 AUE_NULL STD { int linux_nfsservctl(void); }
-181 AUE_GETPMSG STD { int linux_getpmsg(void); }
-182 AUE_PUTPMSG STD { int linux_putpmsg(void); }
-183 AUE_NULL STD { int linux_afs_syscall(void); }
-184 AUE_NULL STD { int linux_tuxcall(void); }
-185 AUE_NULL STD { int linux_security(void); }
+180 AUE_NULL UNIMPL nfsservctl
+181 AUE_GETPMSG UNIMPL getpmsg
+182 AUE_PUTPMSG UNIMPL putpmsg
+183 AUE_NULL UNIMPL afs_syscall
+184 AUE_NULL UNIMPL tuxcall
+185 AUE_NULL UNIMPL security
186 AUE_NULL STD { int linux_gettid(void); }
187 AUE_NULL UNIMPL linux_readahead
188 AUE_NULL STD { int linux_setxattr(void); }
@@ -367,17 +367,17 @@
l_ulong *user_mask_ptr); }
204 AUE_NULL STD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
l_ulong *user_mask_ptr); }
-205 AUE_NULL STD { int linux_set_thread_area(void); }
+205 AUE_NULL UNIMPL set_thread_area
206 AUE_NULL UNIMPL linux_io_setup
207 AUE_NULL UNIMPL linux_io_destroy
208 AUE_NULL UNIMPL linux_io_getevents
209 AUE_NULL UNIMPL linux_io_submit
210 AUE_NULL UNIMPL linux_io_cancel
-211 AUE_NULL UNIMPL linux_get_thread_area
+211 AUE_NULL UNIMPL get_thread_area
212 AUE_NULL STD { int linux_lookup_dcookie(void); }
213 AUE_NULL STD { int linux_epoll_create(l_int size); }
-214 AUE_NULL STD { int linux_epoll_ctl_old(void); }
-215 AUE_NULL STD { int linux_epoll_wait_old(void); }
+214 AUE_NULL UNIMPL epoll_ctl_old
+215 AUE_NULL UNIMPL epoll_wait_old
216 AUE_NULL STD { int linux_remap_file_pages(void); }
217 AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \
void *dirent, l_uint count); }
@@ -473,14 +473,18 @@
280 AUE_FUTIMESAT STD { int linux_utimensat(l_int dfd, const char *pathname, \
const struct l_timespec *times, l_int flags); }
281 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \
- l_int maxevents, l_int timeout, l_sigset_t *mask); }
+ l_int maxevents, l_int timeout, l_sigset_t *mask, \
+ l_size_t sigsetsize); }
282 AUE_NULL STD { int linux_signalfd(void); }
-283 AUE_NULL STD { int linux_timerfd_create(void); }
+283 AUE_NULL STD { int linux_timerfd_create(l_int clockid, l_int flags); }
284 AUE_NULL STD { int linux_eventfd(l_uint initval); }
285 AUE_NULL STD { int linux_fallocate(l_int fd, l_int mode, \
l_loff_t offset, l_loff_t len); }
-286 AUE_NULL STD { int linux_timerfd_settime(void); }
-287 AUE_NULL STD { int linux_timerfd_gettime(void); }
+286 AUE_NULL STD { int linux_timerfd_settime(l_int fd, l_int flags, \
+ const struct l_itimerspec *new_value, \
+ struct l_itimerspec *old_value); }
+287 AUE_NULL STD { int linux_timerfd_gettime(l_int fd, \
+ struct l_itimerspec *old_value); }
288 AUE_ACCEPT STD { int linux_accept4(l_int s, l_uintptr_t addr, \
l_uintptr_t namelen, int flags); }
; linux 2.6.27:
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h
index 687f8e8..ad6d9fa 100644
--- a/sys/amd64/linux32/linux.h
+++ b/sys/amd64/linux32/linux.h
@@ -250,7 +250,9 @@ struct l_statfs64 {
uint64_t f_ffree;
l_fsid_t f_fsid;
l_int f_namelen;
- l_int f_spare[6];
+ l_int f_frsize;
+ l_int f_flags;
+ l_int f_spare[4];
} __packed;
/* sigaction flags */
@@ -472,47 +474,6 @@ union l_semun {
l_uintptr_t __pad;
} __packed;
-struct l_ipc_perm {
- l_key_t key;
- l_uid16_t uid;
- l_gid16_t gid;
- l_uid16_t cuid;
- l_gid16_t cgid;
- l_ushort mode;
- l_ushort seq;
-};
-
-/*
- * Socket defines
- */
-#define LINUX_SOL_SOCKET 1
-#define LINUX_SOL_IP 0
-#define LINUX_SOL_IPX 256
-#define LINUX_SOL_AX25 257
-#define LINUX_SOL_TCP 6
-#define LINUX_SOL_UDP 17
-
-#define LINUX_SO_DEBUG 1
-#define LINUX_SO_REUSEADDR 2
-#define LINUX_SO_TYPE 3
-#define LINUX_SO_ERROR 4
-#define LINUX_SO_DONTROUTE 5
-#define LINUX_SO_BROADCAST 6
-#define LINUX_SO_SNDBUF 7
-#define LINUX_SO_RCVBUF 8
-#define LINUX_SO_KEEPALIVE 9
-#define LINUX_SO_OOBINLINE 10
-#define LINUX_SO_NO_CHECK 11
-#define LINUX_SO_PRIORITY 12
-#define LINUX_SO_LINGER 13
-#define LINUX_SO_PEERCRED 17
-#define LINUX_SO_RCVLOWAT 18
-#define LINUX_SO_SNDLOWAT 19
-#define LINUX_SO_RCVTIMEO 20
-#define LINUX_SO_SNDTIMEO 21
-#define LINUX_SO_TIMESTAMP 29
-#define LINUX_SO_ACCEPTCONN 30
-
struct l_sockaddr {
l_ushort sa_family;
char sa_data[14];
@@ -542,7 +503,7 @@ struct l_ifreq {
struct l_sockaddr ifru_netmask;
struct l_sockaddr ifru_hwaddr;
l_short ifru_flags[1];
- l_int ifru_metric;
+ l_int ifru_ivalue;
l_int ifru_mtu;
struct l_ifmap ifru_map;
char ifru_slave[LINUX_IFNAMSIZ];
@@ -552,6 +513,7 @@ struct l_ifreq {
#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
+#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */
struct l_ifconf {
int ifc_len;
diff --git a/sys/amd64/linux32/linux32_dummy.c b/sys/amd64/linux32/linux32_dummy.c
index 27f26f4..d0f04b1 100644
--- a/sys/amd64/linux32/linux32_dummy.c
+++ b/sys/amd64/linux32/linux32_dummy.c
@@ -45,6 +45,24 @@ __FBSDID("$FreeBSD$");
/* DTrace init */
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
+UNIMPLEMENTED(afs_syscall);
+UNIMPLEMENTED(break);
+UNIMPLEMENTED(create_module); /* added in linux 1.0 removed in 2.6 */
+UNIMPLEMENTED(ftime);
+UNIMPLEMENTED(get_kernel_syms); /* added in linux 1.0 removed in 2.6 */
+UNIMPLEMENTED(getpmsg);
+UNIMPLEMENTED(gtty);
+UNIMPLEMENTED(stty);
+UNIMPLEMENTED(lock);
+UNIMPLEMENTED(mpx);
+UNIMPLEMENTED(nfsservctl); /* added in linux 2.2 removed in 3.1 */
+UNIMPLEMENTED(prof);
+UNIMPLEMENTED(profil);
+UNIMPLEMENTED(putpmsg);
+UNIMPLEMENTED(query_module); /* added in linux 2.2 removed in 2.6 */
+UNIMPLEMENTED(ulimit);
+UNIMPLEMENTED(vserver);
+
DUMMY(stime);
DUMMY(olduname);
DUMMY(syslog);
@@ -52,20 +70,15 @@ DUMMY(uname);
DUMMY(vhangup);
DUMMY(swapoff);
DUMMY(adjtimex);
-DUMMY(create_module);
DUMMY(init_module);
DUMMY(delete_module);
-DUMMY(get_kernel_syms);
DUMMY(quotactl);
DUMMY(bdflush);
DUMMY(sysfs);
-DUMMY(query_module);
-DUMMY(nfsservctl);
DUMMY(sendfile);
DUMMY(setfsuid);
DUMMY(setfsgid);
DUMMY(pivot_root);
-DUMMY(mincore);
DUMMY(ptrace);
DUMMY(lookup_dcookie);
DUMMY(remap_file_pages);
@@ -103,15 +116,10 @@ DUMMY(move_pages);
DUMMY(getcpu);
/* linux 2.6.22: */
DUMMY(signalfd);
-DUMMY(timerfd_create);
-/* linux 2.6.25: */
-DUMMY(timerfd_settime);
-DUMMY(timerfd_gettime);
/* linux 2.6.27: */
DUMMY(signalfd4);
DUMMY(inotify_init1);
/* linux 2.6.31: */
-DUMMY(rt_tgsigqueueinfo);
DUMMY(perf_event_open);
/* linux 2.6.33: */
DUMMY(fanotify_init);
@@ -135,7 +143,6 @@ DUMMY(sched_getattr);
DUMMY(renameat2);
/* linux 3.15: */
DUMMY(seccomp);
-DUMMY(getrandom);
DUMMY(memfd_create);
/* linux 3.18: */
DUMMY(bpf);
diff --git a/sys/amd64/linux32/linux32_ipc64.h b/sys/amd64/linux32/linux32_ipc64.h
deleted file mode 100644
index f8c92c4..0000000
--- a/sys/amd64/linux32/linux32_ipc64.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * Copyright (c) 2002 Maxim Sobolev <sobomax@FreeBSD.org>
- * 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 without 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _AMD64_LINUX_LINUX_IPC64_H_
-#define _AMD64_LINUX_LINUX_IPC64_H_
-
-/*
- * The ipc64_perm structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_ipc64_perm
-{
- l_key_t key;
- l_uid_t uid;
- l_gid_t gid;
- l_uid_t cuid;
- l_gid_t cgid;
- l_mode_t mode;
- l_ushort __pad1;
- l_ushort seq;
- l_ushort __pad2;
- l_ulong __unused1;
- l_ulong __unused2;
-} __packed;
-
-/*
- * The msqid64_ds structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_msqid64_ds {
- struct l_ipc64_perm msg_perm;
- l_time_t msg_stime; /* last msgsnd time */
- l_ulong __unused1;
- l_time_t msg_rtime; /* last msgrcv time */
- l_ulong __unused2;
- l_time_t msg_ctime; /* last change time */
- l_ulong __unused3;
- l_ulong msg_cbytes; /* current number of bytes on queue */
- l_ulong msg_qnum; /* number of messages in queue */
- l_ulong msg_qbytes; /* max number of bytes on queue */
- l_pid_t msg_lspid; /* pid of last msgsnd */
- l_pid_t msg_lrpid; /* last receive pid */
- l_ulong __unused4;
- l_ulong __unused5;
-} __packed;
-
-/*
- * The semid64_ds structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_semid64_ds {
- struct l_ipc64_perm sem_perm; /* permissions */
- l_time_t sem_otime; /* last semop time */
- l_ulong __unused1;
- l_time_t sem_ctime; /* last change time */
- l_ulong __unused2;
- l_ulong sem_nsems; /* no. of semaphores in array */
- l_ulong __unused3;
- l_ulong __unused4;
-} __packed;
-
-/*
- * The shmid64_ds structure for i386 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct l_shmid64_ds {
- struct l_ipc64_perm shm_perm; /* operation perms */
- l_size_t shm_segsz; /* size of segment (bytes) */
- l_time_t shm_atime; /* last attach time */
- l_ulong __unused1;
- l_time_t shm_dtime; /* last detach time */
- l_ulong __unused2;
- l_time_t shm_ctime; /* last change time */
- l_ulong __unused3;
- l_pid_t shm_cpid; /* pid of creator */
- l_pid_t shm_lpid; /* pid of last operator */
- l_ulong shm_nattch; /* no. of current attaches */
- l_ulong __unused4;
- l_ulong __unused5;
-} __packed;
-
-struct l_shminfo64 {
- l_ulong shmmax;
- l_ulong shmmin;
- l_ulong shmmni;
- l_ulong shmseg;
- l_ulong shmall;
- l_ulong __unused1;
- l_ulong __unused2;
- l_ulong __unused3;
- l_ulong __unused4;
-} __packed;
-
-#endif /* !_AMD64_LINUX_LINUX_IPC64_H_ */
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 74f9315..dd741e6 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -645,7 +645,6 @@ linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
int
linux_ftruncate64(struct thread *td, struct linux_ftruncate64_args *args)
{
- struct ftruncate_args sa;
#ifdef DEBUG
if (ldebug(ftruncate64))
@@ -653,9 +652,7 @@ linux_ftruncate64(struct thread *td, struct linux_ftruncate64_args *args)
(intmax_t)args->length);
#endif
- sa.fd = args->fd;
- sa.length = args->length;
- return sys_ftruncate(td, &sa);
+ return (kern_ftruncate(td, args->fd, args->length));
}
int
diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h
index a22f17f..266db5c 100644
--- a/sys/amd64/linux32/linux32_proto.h
+++ b/sys/amd64/linux32/linux32_proto.h
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
#ifndef _LINUX32_SYSPROTO_H_
@@ -403,18 +402,12 @@ struct linux_sigprocmask_args {
char mask_l_[PADL_(l_osigset_t *)]; l_osigset_t * mask; char mask_r_[PADR_(l_osigset_t *)];
char omask_l_[PADL_(l_osigset_t *)]; l_osigset_t * omask; char omask_r_[PADR_(l_osigset_t *)];
};
-struct linux_create_module_args {
- register_t dummy;
-};
struct linux_init_module_args {
register_t dummy;
};
struct linux_delete_module_args {
register_t dummy;
};
-struct linux_get_kernel_syms_args {
- register_t dummy;
-};
struct linux_quotactl_args {
register_t dummy;
};
@@ -525,12 +518,6 @@ struct linux_getresuid16_args {
char euid_l_[PADL_(l_uid16_t *)]; l_uid16_t * euid; char euid_r_[PADR_(l_uid16_t *)];
char suid_l_[PADL_(l_uid16_t *)]; l_uid16_t * suid; char suid_r_[PADR_(l_uid16_t *)];
};
-struct linux_query_module_args {
- register_t dummy;
-};
-struct linux_nfsservctl_args {
- register_t dummy;
-};
struct linux_setresgid16_args {
char rgid_l_[PADL_(l_gid16_t)]; l_gid16_t rgid; char rgid_r_[PADR_(l_gid16_t)];
char egid_l_[PADL_(l_gid16_t)]; l_gid16_t egid; char egid_r_[PADR_(l_gid16_t)];
@@ -1052,6 +1039,7 @@ struct linux_epoll_pwait_args {
char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
+ char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
};
struct linux_utimensat_args {
char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
@@ -1063,7 +1051,8 @@ struct linux_signalfd_args {
register_t dummy;
};
struct linux_timerfd_create_args {
- register_t dummy;
+ char clockid_l_[PADL_(l_int)]; l_int clockid; char clockid_r_[PADR_(l_int)];
+ char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
};
struct linux_eventfd_args {
char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
@@ -1075,10 +1064,14 @@ struct linux_fallocate_args {
char len_l_[PADL_(l_loff_t)]; l_loff_t len; char len_r_[PADR_(l_loff_t)];
};
struct linux_timerfd_settime_args {
- register_t dummy;
+ char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+ char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
+ char new_value_l_[PADL_(const struct l_itimerspec *)]; const struct l_itimerspec * new_value; char new_value_r_[PADR_(const struct l_itimerspec *)];
+ char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * old_value; char old_value_r_[PADR_(struct l_itimerspec *)];
};
struct linux_timerfd_gettime_args {
- register_t dummy;
+ char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+ char old_value_l_[PADL_(struct l_itimerspec *)]; struct l_itimerspec * old_value; char old_value_r_[PADR_(struct l_itimerspec *)];
};
struct linux_signalfd4_args {
register_t dummy;
@@ -1465,10 +1458,8 @@ int linux_newuname(struct thread *, struct linux_newuname_args *);
int linux_adjtimex(struct thread *, struct linux_adjtimex_args *);
int linux_mprotect(struct thread *, struct linux_mprotect_args *);
int linux_sigprocmask(struct thread *, struct linux_sigprocmask_args *);
-int linux_create_module(struct thread *, struct linux_create_module_args *);
int linux_init_module(struct thread *, struct linux_init_module_args *);
int linux_delete_module(struct thread *, struct linux_delete_module_args *);
-int linux_get_kernel_syms(struct thread *, struct linux_get_kernel_syms_args *);
int linux_quotactl(struct thread *, struct linux_quotactl_args *);
int linux_bdflush(struct thread *, struct linux_bdflush_args *);
int linux_sysfs(struct thread *, struct linux_sysfs_args *);
@@ -1495,8 +1486,6 @@ int linux_nanosleep(struct thread *, struct linux_nanosleep_args *);
int linux_mremap(struct thread *, struct linux_mremap_args *);
int linux_setresuid16(struct thread *, struct linux_setresuid16_args *);
int linux_getresuid16(struct thread *, struct linux_getresuid16_args *);
-int linux_query_module(struct thread *, struct linux_query_module_args *);
-int linux_nfsservctl(struct thread *, struct linux_nfsservctl_args *);
int linux_setresgid16(struct thread *, struct linux_setresgid16_args *);
int linux_getresgid16(struct thread *, struct linux_getresgid16_args *);
int linux_prctl(struct thread *, struct linux_prctl_args *);
@@ -1811,10 +1800,8 @@ int linux_pkey_free(struct thread *, struct linux_pkey_free_args *);
#define LINUX32_SYS_AUE_linux_adjtimex AUE_ADJTIME
#define LINUX32_SYS_AUE_linux_mprotect AUE_MPROTECT
#define LINUX32_SYS_AUE_linux_sigprocmask AUE_SIGPROCMASK
-#define LINUX32_SYS_AUE_linux_create_module AUE_NULL
#define LINUX32_SYS_AUE_linux_init_module AUE_NULL
#define LINUX32_SYS_AUE_linux_delete_module AUE_NULL
-#define LINUX32_SYS_AUE_linux_get_kernel_syms AUE_NULL
#define LINUX32_SYS_AUE_linux_quotactl AUE_QUOTACTL
#define LINUX32_SYS_AUE_linux_bdflush AUE_BDFLUSH
#define LINUX32_SYS_AUE_linux_sysfs AUE_NULL
@@ -1841,8 +1828,6 @@ int linux_pkey_free(struct thread *, struct linux_pkey_free_args *);
#define LINUX32_SYS_AUE_linux_mremap AUE_NULL
#define LINUX32_SYS_AUE_linux_setresuid16 AUE_SETRESUID
#define LINUX32_SYS_AUE_linux_getresuid16 AUE_GETRESUID
-#define LINUX32_SYS_AUE_linux_query_module AUE_NULL
-#define LINUX32_SYS_AUE_linux_nfsservctl AUE_NULL
#define LINUX32_SYS_AUE_linux_setresgid16 AUE_SETRESGID
#define LINUX32_SYS_AUE_linux_getresgid16 AUE_GETRESGID
#define LINUX32_SYS_AUE_linux_prctl AUE_PRCTL
diff --git a/sys/amd64/linux32/linux32_syscall.h b/sys/amd64/linux32/linux32_syscall.h
index bf653ed..3a62ef3 100644
--- a/sys/amd64/linux32/linux32_syscall.h
+++ b/sys/amd64/linux32/linux32_syscall.h
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
#define LINUX32_SYS_linux_exit 1
@@ -117,10 +116,8 @@
#define LINUX32_SYS_linux_adjtimex 124
#define LINUX32_SYS_linux_mprotect 125
#define LINUX32_SYS_linux_sigprocmask 126
-#define LINUX32_SYS_linux_create_module 127
#define LINUX32_SYS_linux_init_module 128
#define LINUX32_SYS_linux_delete_module 129
-#define LINUX32_SYS_linux_get_kernel_syms 130
#define LINUX32_SYS_linux_quotactl 131
#define LINUX32_SYS_getpgid 132
#define LINUX32_SYS_fchdir 133
@@ -155,9 +152,7 @@
#define LINUX32_SYS_linux_mremap 163
#define LINUX32_SYS_linux_setresuid16 164
#define LINUX32_SYS_linux_getresuid16 165
-#define LINUX32_SYS_linux_query_module 167
#define LINUX32_SYS_poll 168
-#define LINUX32_SYS_linux_nfsservctl 169
#define LINUX32_SYS_linux_setresgid16 170
#define LINUX32_SYS_linux_getresgid16 171
#define LINUX32_SYS_linux_prctl 172
diff --git a/sys/amd64/linux32/linux32_syscalls.c b/sys/amd64/linux32/linux32_syscalls.c
index fe18999..6b010e1 100644
--- a/sys/amd64/linux32/linux32_syscalls.c
+++ b/sys/amd64/linux32/linux32_syscalls.c
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
const char *linux32_syscallnames[] = {
@@ -135,10 +134,10 @@ const char *linux32_syscallnames[] = {
"linux_adjtimex", /* 124 = linux_adjtimex */
"linux_mprotect", /* 125 = linux_mprotect */
"linux_sigprocmask", /* 126 = linux_sigprocmask */
- "linux_create_module", /* 127 = linux_create_module */
+ "#127", /* 127 = create_module */
"linux_init_module", /* 128 = linux_init_module */
"linux_delete_module", /* 129 = linux_delete_module */
- "linux_get_kernel_syms", /* 130 = linux_get_kernel_syms */
+ "#130", /* 130 = get_kernel_syms */
"linux_quotactl", /* 131 = linux_quotactl */
"getpgid", /* 132 = getpgid */
"fchdir", /* 133 = fchdir */
@@ -175,9 +174,9 @@ const char *linux32_syscallnames[] = {
"linux_setresuid16", /* 164 = linux_setresuid16 */
"linux_getresuid16", /* 165 = linux_getresuid16 */
"#166", /* 166 = vm86 */
- "linux_query_module", /* 167 = linux_query_module */
+ "#167", /* 167 = query_module */
"poll", /* 168 = poll */
- "linux_nfsservctl", /* 169 = linux_nfsservctl */
+ "#169", /* 169 = nfsservctl */
"linux_setresgid16", /* 170 = linux_setresgid16 */
"linux_getresgid16", /* 171 = linux_getresgid16 */
"linux_prctl", /* 172 = linux_prctl */
diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c
index 9f94ebf..9995d87 100644
--- a/sys/amd64/linux32/linux32_sysent.c
+++ b/sys/amd64/linux32/linux32_sysent.c
@@ -3,7 +3,6 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 313284 2017-02-05 14:17:09Z dchagin
*/
#include "opt_compat.h"
@@ -146,10 +145,10 @@ struct sysent linux32_sysent[] = {
{ 0, (sy_call_t *)linux_adjtimex, AUE_ADJTIME, NULL, 0, 0, 0, SY_THR_STATIC }, /* 124 = linux_adjtimex */
{ AS(linux_mprotect_args), (sy_call_t *)linux_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 125 = linux_mprotect */
{ AS(linux_sigprocmask_args), (sy_call_t *)linux_sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 126 = linux_sigprocmask */
- { 0, (sy_call_t *)linux_create_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 127 = linux_create_module */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 127 = create_module */
{ 0, (sy_call_t *)linux_init_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 128 = linux_init_module */
{ 0, (sy_call_t *)linux_delete_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 129 = linux_delete_module */
- { 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 130 = linux_get_kernel_syms */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 130 = get_kernel_syms */
{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 131 = linux_quotactl */
{ AS(getpgid_args), (sy_call_t *)sys_getpgid, AUE_GETPGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 132 = getpgid */
{ AS(fchdir_args), (sy_call_t *)sys_fchdir, AUE_FCHDIR, NULL, 0, 0, 0, SY_THR_STATIC }, /* 133 = fchdir */
@@ -186,9 +185,9 @@ struct sysent linux32_sysent[] = {
{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 164 = linux_setresuid16 */
{ AS(linux_getresuid16_args), (sy_call_t *)linux_getresuid16, AUE_GETRESUID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 165 = linux_getresuid16 */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 166 = vm86 */
- { 0, (sy_call_t *)linux_query_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 167 = linux_query_module */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 167 = query_module */
{ AS(poll_args), (sy_call_t *)sys_poll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 168 = poll */
- { 0, (sy_call_t *)linux_nfsservctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 169 = linux_nfsservctl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 169 = nfsservctl */
{ AS(linux_setresgid16_args), (sy_call_t *)linux_setresgid16, AUE_SETRESGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 170 = linux_setresgid16 */
{ AS(linux_getresgid16_args), (sy_call_t *)linux_getresgid16, AUE_GETRESGID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 171 = linux_getresgid16 */
{ AS(linux_prctl_args), (sy_call_t *)linux_prctl, AUE_PRCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 172 = linux_prctl */
@@ -341,11 +340,11 @@ struct sysent linux32_sysent[] = {
{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 319 = linux_epoll_pwait */
{ AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 320 = linux_utimensat */
{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 321 = linux_signalfd */
- { 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 322 = linux_timerfd_create */
+ { AS(linux_timerfd_create_args), (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 322 = linux_timerfd_create */
{ AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 323 = linux_eventfd */
{ AS(linux_fallocate_args), (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 324 = linux_fallocate */
- { 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 325 = linux_timerfd_settime */
- { 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 326 = linux_timerfd_gettime */
+ { AS(linux_timerfd_settime_args), (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 325 = linux_timerfd_settime */
+ { AS(linux_timerfd_gettime_args), (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 326 = linux_timerfd_gettime */
{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 327 = linux_signalfd4 */
{ AS(linux_eventfd2_args), (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 328 = linux_eventfd2 */
{ AS(linux_epoll_create1_args), (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 329 = linux_epoll_create1 */
diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c
index 2e4c2be..30a430a 100644
--- a/sys/amd64/linux32/linux32_systrace_args.c
+++ b/sys/amd64/linux32/linux32_systrace_args.c
@@ -854,11 +854,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 3;
break;
}
- /* linux_create_module */
- case 127: {
- *n_args = 0;
- break;
- }
/* linux_init_module */
case 128: {
*n_args = 0;
@@ -869,11 +864,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 0;
break;
}
- /* linux_get_kernel_syms */
- case 130: {
- *n_args = 0;
- break;
- }
/* linux_quotactl */
case 131: {
*n_args = 0;
@@ -1139,11 +1129,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 3;
break;
}
- /* linux_query_module */
- case 167: {
- *n_args = 0;
- break;
- }
/* poll */
case 168: {
struct poll_args *p = params;
@@ -1153,11 +1138,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 3;
break;
}
- /* linux_nfsservctl */
- case 169: {
- *n_args = 0;
- break;
- }
/* linux_setresgid16 */
case 170: {
struct linux_setresgid16_args *p = params;
@@ -2169,7 +2149,8 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
iarg[2] = p->maxevents; /* l_int */
iarg[3] = p->timeout; /* l_int */
uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
- *n_args = 5;
+ iarg[5] = p->sigsetsize; /* l_size_t */
+ *n_args = 6;
break;
}
/* linux_utimensat */
@@ -2189,7 +2170,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
}
/* linux_timerfd_create */
case 322: {
- *n_args = 0;
+ struct linux_timerfd_create_args *p = params;
+ iarg[0] = p->clockid; /* l_int */
+ iarg[1] = p->flags; /* l_int */
+ *n_args = 2;
break;
}
/* linux_eventfd */
@@ -2211,12 +2195,20 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
}
/* linux_timerfd_settime */
case 325: {
- *n_args = 0;
+ struct linux_timerfd_settime_args *p = params;
+ iarg[0] = p->fd; /* l_int */
+ iarg[1] = p->flags; /* l_int */
+ uarg[2] = (intptr_t) p->new_value; /* const struct l_itimerspec * */
+ uarg[3] = (intptr_t) p->old_value; /* struct l_itimerspec * */
+ *n_args = 4;
break;
}
/* linux_timerfd_gettime */
case 326: {
- *n_args = 0;
+ struct linux_timerfd_gettime_args *p = params;
+ iarg[0] = p->fd; /* l_int */
+ uarg[1] = (intptr_t) p->old_value; /* struct l_itimerspec * */
+ *n_args = 2;
break;
}
/* linux_signalfd4 */
@@ -4014,18 +4006,12 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* linux_create_module */
- case 127:
- break;
/* linux_init_module */
case 128:
break;
/* linux_delete_module */
case 129:
break;
- /* linux_get_kernel_syms */
- case 130:
- break;
/* linux_quotactl */
case 131:
break;
@@ -4443,9 +4429,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* linux_query_module */
- case 167:
- break;
/* poll */
case 168:
switch(ndx) {
@@ -4462,9 +4445,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* linux_nfsservctl */
- case 169:
- break;
/* linux_setresgid16 */
case 170:
switch(ndx) {
@@ -5970,6 +5950,9 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 4:
p = "l_sigset_t *";
break;
+ case 5:
+ p = "l_size_t";
+ break;
default:
break;
};
@@ -5998,6 +5981,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timerfd_create */
case 322:
+ switch(ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "l_int";
+ break;
+ default:
+ break;
+ };
break;
/* linux_eventfd */
case 323:
@@ -6030,9 +6023,35 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timerfd_settime */
case 325:
+ switch(ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "l_int";
+ break;
+ case 2:
+ p = "const struct l_itimerspec *";
+ break;
+ case 3:
+ p = "struct l_itimerspec *";
+ break;
+ default:
+ break;
+ };
break;
/* linux_timerfd_gettime */
case 326:
+ switch(ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "struct l_itimerspec *";
+ break;
+ default:
+ break;
+ };
break;
/* linux_signalfd4 */
case 327:
@@ -6099,7 +6118,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland struct iovec *";
+ p = "struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -6121,7 +6140,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland struct iovec *";
+ p = "struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -6149,7 +6168,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 3:
- p = "userland l_siginfo_t *";
+ p = "l_siginfo_t *";
break;
default:
break;
@@ -6253,13 +6272,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
break;
case 3:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 4:
p = "l_ulong";
@@ -6278,13 +6297,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
break;
case 3:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 4:
p = "l_ulong";
@@ -6325,7 +6344,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland const char *";
+ p = "const char *";
break;
case 2:
p = "l_int";
@@ -6341,7 +6360,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland void *";
+ p = "void *";
break;
case 2:
p = "l_uint";
@@ -6357,7 +6376,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "userland void *";
+ p = "void *";
break;
case 2:
p = "l_uint";
@@ -6376,13 +6395,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland const char *";
+ p = "const char *";
break;
case 2:
p = "l_int";
break;
case 3:
- p = "userland const char *";
+ p = "const char *";
break;
case 4:
p = "unsigned int";
@@ -6401,7 +6420,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_uint";
break;
case 2:
- p = "userland const char *";
+ p = "const char *";
break;
default:
break;
@@ -6411,7 +6430,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 355:
switch(ndx) {
case 0:
- p = "userland char *";
+ p = "char *";
break;
case 1:
p = "l_size_t";
@@ -6427,7 +6446,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 356:
switch(ndx) {
case 0:
- p = "userland const char *";
+ p = "const char *";
break;
case 1:
p = "l_uint";
@@ -6443,7 +6462,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland void *";
+ p = "void *";
break;
case 2:
p = "l_uint";
@@ -6459,13 +6478,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland const char *";
+ p = "const char *";
break;
case 2:
- p = "userland const char **";
+ p = "const char **";
break;
case 3:
- p = "userland const char **";
+ p = "const char **";
break;
case 4:
p = "l_int";
@@ -6790,13 +6809,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
- p = "userland l_loff_t *";
+ p = "l_loff_t *";
break;
case 2:
p = "l_int";
break;
case 3:
- p = "userland l_loff_t *";
+ p = "l_loff_t *";
break;
case 4:
p = "l_size_t";
@@ -6815,7 +6834,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -6840,7 +6859,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_ulong";
break;
case 1:
- p = "userland const struct iovec *";
+ p = "const struct iovec *";
break;
case 2:
p = "l_ulong";
@@ -7413,14 +7432,10 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* linux_create_module */
- case 127:
/* linux_init_module */
case 128:
/* linux_delete_module */
case 129:
- /* linux_get_kernel_syms */
- case 130:
/* linux_quotactl */
case 131:
/* getpgid */
@@ -7579,15 +7594,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* linux_query_module */
- case 167:
/* poll */
case 168:
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* linux_nfsservctl */
- case 169:
/* linux_setresgid16 */
case 170:
if (ndx == 0 || ndx == 1)
@@ -8128,6 +8139,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
case 321:
/* linux_timerfd_create */
case 322:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_eventfd */
case 323:
if (ndx == 0 || ndx == 1)
@@ -8140,8 +8154,14 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
/* linux_timerfd_settime */
case 325:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_timerfd_gettime */
case 326:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_signalfd4 */
case 327:
/* linux_eventfd2 */
diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master
index 1c261f9..db713e2 100644
--- a/sys/amd64/linux32/syscalls.master
+++ b/sys/amd64/linux32/syscalls.master
@@ -230,10 +230,10 @@
int prot); }
126 AUE_SIGPROCMASK STD { int linux_sigprocmask(l_int how, \
l_osigset_t *mask, l_osigset_t *omask); }
-127 AUE_NULL STD { int linux_create_module(void); }
+127 AUE_NULL UNIMPL create_module
128 AUE_NULL STD { int linux_init_module(void); }
129 AUE_NULL STD { int linux_delete_module(void); }
-130 AUE_NULL STD { int linux_get_kernel_syms(void); }
+130 AUE_NULL UNIMPL get_kernel_syms
131 AUE_QUOTACTL STD { int linux_quotactl(void); }
132 AUE_GETPGID NOPROTO { int getpgid(int pid); }
133 AUE_FCHDIR NOPROTO { int fchdir(int fd); }
@@ -296,10 +296,10 @@
165 AUE_GETRESUID STD { int linux_getresuid16(l_uid16_t *ruid, \
l_uid16_t *euid, l_uid16_t *suid); }
166 AUE_NULL UNIMPL vm86
-167 AUE_NULL STD { int linux_query_module(void); }
+167 AUE_NULL UNIMPL query_module
168 AUE_POLL NOPROTO { int poll(struct pollfd *fds, \
unsigned int nfds, int timeout); }
-169 AUE_NULL STD { int linux_nfsservctl(void); }
+169 AUE_NULL UNIMPL nfsservctl
170 AUE_SETRESGID STD { int linux_setresgid16(l_gid16_t rgid, \
l_gid16_t egid, l_gid16_t sgid); }
171 AUE_GETRESGID STD { int linux_getresgid16(l_gid16_t *rgid, \
@@ -533,19 +533,23 @@
; linux 2.6.19:
318 AUE_NULL STD { int linux_getcpu(void); }
319 AUE_NULL STD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \
- l_int maxevents, l_int timeout, l_sigset_t *mask); }
+ l_int maxevents, l_int timeout, l_sigset_t *mask, \
+ l_size_t sigsetsize); }
; linux 2.6.22:
320 AUE_FUTIMESAT STD { int linux_utimensat(l_int dfd, const char *pathname, \
const struct l_timespec *times, l_int flags); }
321 AUE_NULL STD { int linux_signalfd(void); }
-322 AUE_NULL STD { int linux_timerfd_create(void); }
+322 AUE_NULL STD { int linux_timerfd_create(l_int clockid, l_int flags); }
323 AUE_NULL STD { int linux_eventfd(l_uint initval); }
; linux 2.6.23:
324 AUE_NULL STD { int linux_fallocate(l_int fd, l_int mode, \
l_loff_t offset, l_loff_t len); }
; linux 2.6.25:
-325 AUE_NULL STD { int linux_timerfd_settime(void); }
-326 AUE_NULL STD { int linux_timerfd_gettime(void); }
+325 AUE_NULL STD { int linux_timerfd_settime(l_int fd, l_int flags, \
+ const struct l_itimerspec *new_value, \
+ struct l_itimerspec *old_value); }
+326 AUE_NULL STD { int linux_timerfd_gettime(l_int fd, \
+ struct l_itimerspec *old_value); }
; linux 2.6.27:
327 AUE_NULL STD { int linux_signalfd4(void); }
328 AUE_NULL STD { int linux_eventfd2(l_uint initval, l_int flags); }
diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 525e1d9..61d99d5 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -176,6 +176,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id,
/* Don't advertise the OS visible workaround feature */
regs[2] &= ~AMDID2_OSVW;
+ /* Hide mwaitx/monitorx capability from the guest */
+ regs[2] &= ~AMDID2_MWAITX;
+
/*
* Hide rdtscp/ia32_tsc_aux until we know how
* to deal with them.
OpenPOWER on IntegriCloud