Commit e0697f78 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

compel: plugins,std -- Add syscall-types.h header

Both std and criu will use it for syscalls sake.
Note I've to disable x86 compat mode for a while:
we have to provide native types there thus will
back once everything else is complete.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 0264fdcc
......@@ -19,13 +19,15 @@ CONFIG_FILE = $(SRC_DIR)/.config
$(CONFIG_FILE):
touch $(CONFIG_FILE)
ifeq ($(SRCARCH),x86)
# CONFIG_COMPAT is only for x86 now, no need for compile-test other archs
ifeq ($(call try-cc,$(FEATURE_TEST_X86_COMPAT),-m32),true)
export CONFIG_COMPAT := y
FEATURE_DEFINES += -DCONFIG_COMPAT
endif
endif
#
# FIXME Bring back once libcompel complete
#ifeq ($(SRCARCH),x86)
## CONFIG_COMPAT is only for x86 now, no need for compile-test other archs
#ifeq ($(call try-cc,$(FEATURE_TEST_X86_COMPAT),-m32),true)
# export CONFIG_COMPAT := y
# FEATURE_DEFINES += -DCONFIG_COMPAT
#endif
#endif
export DEFINES += $(FEATURE_DEFINES)
export CFLAGS += $(FEATURE_DEFINES)
......
......@@ -40,3 +40,13 @@ endif
cleanup-y += compel/compel
cleanup-y += compel/compel-host
cleanup-y += compel/libcompel.so
#
# FIXME Fake target for syscalls headers generation,
# drop after syscalls generation.
$(obj)/plugins/include/uapi/std/asm/syscall-types.h: $(obj)/arch/$(ARCH)/plugins/include/asm/syscall-types.h
$(call msg-gen,$@)
$(Q) ln -s ../../../../../arch/$(ARCH)/plugins/include/asm/syscall-types.h $@
cleanup-y += $(obj)/plugins/include/uapi/std/asm/syscall-types.h
$(obj)/compel-host: $(obj)/plugins/include/uapi/std/asm/syscall-types.h
#ifndef COMPEL_ARCH_SYSCALL_TYPES_H__
#define COMPEL_ARCH_SYSCALL_TYPES_H__
#define SA_RESTORER 0x04000000
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
#define _NSIG_BPW 64
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_KNSIG_WORDS];
} k_rtsigset_t;
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#endif /* COMPEL_ARCH_SYSCALL_TYPES_H__ */
#ifndef COMPEL_ARCH_SYSCALL_TYPES_H__
#define COMPEL_ARCH_SYSCALL_TYPES_H__
#define SA_RESTORER 0x04000000
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
#define _NSIG_BPW 32
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_KNSIG_WORDS];
} k_rtsigset_t;
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#endif /* COMPEL_ARCH_SYSCALL_TYPES_H__ */
#ifndef COMPEL_ARCH_SYSCALL_TYPES_H__
#define COMPEL_ARCH_SYSCALL_TYPES_H__
#define SA_RESTORER 0x04000000U
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
#define _NSIG_BPW 64
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_KNSIG_WORDS];
} k_rtsigset_t;
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#endif /* COMPEL_ARCH_SYSCALL_TYPES_H__ */
......@@ -8,13 +8,20 @@ typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
# define _NSIG_BPW 64
#define SA_RESTORER 0x04000000
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
#define _KNSIG 64
#ifndef CONFIG_COMPAT
#define _NSIG_BPW 64
#else
#define _NSIG_BPW 32
#endif
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
u64 sig[_KNSIG_WORDS];
unsigned long sig[_KNSIG_WORDS];
} k_rtsigset_t;
typedef struct {
......@@ -30,9 +37,9 @@ typedef struct {
* with unaligned rt_sa_mask.
*/
typedef struct __attribute__((packed)) {
u32 rt_sa_handler;
u32 rt_sa_flags;
u32 rt_sa_restorer;
unsigned int rt_sa_handler;
unsigned int rt_sa_flags;
unsigned int rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t_compat;
......
......@@ -52,6 +52,6 @@ struct krlimit {
/* Type of timers in the kernel. */
typedef int kernel_timer_t;
#include "asm/syscall-types.h"
#include "uapi/std/asm/syscall-types.h"
#endif /* COMPEL_SYSCALL_TYPES_H__ */
......@@ -17,6 +17,9 @@ ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)
ccflags-y += -iquote $(SRC_DIR)/$(ARCH_DIR)/include
ccflags-y += -iquote $(SRC_DIR)/
ccflags-y += -I/usr/include/libnl3
ccflags-y += -iquote compel/plugins/include
ccflags-y += -iquote compel/include
ccflags-y += -iquote compel/arch/$(ARCH)/plugins/std
export ccflags-y
......
ccflags-y += -iquote criu/$(ARCH)
ccflags-y += -iquote compel/plugins/include
ccflags-y += -iquote compel/include
ccflags-y += -iquote compel/arch/$(ARCH)/plugins/std
obj-y += action-scripts.o
obj-y += external.o
obj-y += aio.o
......
......@@ -10,29 +10,7 @@
#include "bitops.h"
#include "asm/int.h"
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
#define _NSIG_BPW 64
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_KNSIG_WORDS];
} k_rtsigset_t;
#define SA_RESTORER 0x00000000
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#include "uapi/std/asm/syscall-types.h"
#define core_is_compat(core) false
......
......@@ -9,29 +9,7 @@
#include "bitops.h"
#include "asm/int.h"
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
#define _NSIG_BPW 32
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_KNSIG_WORDS];
} k_rtsigset_t;
#define SA_RESTORER 0x04000000
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
#include "uapi/std/asm/syscall-types.h"
#define core_is_compat(core) false
......
......@@ -9,40 +9,14 @@
#include "bitops.h"
#include "asm/int.h"
/*
* Copied from kernel header include/uapi/asm-generic/signal-defs.h
*/
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
/*Copied from the Linux kernel arch/powerpc/include/uapi/asm/signal.h */
#define _KNSIG 64
#define _NSIG_BPW 64
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
uint64_t sig[_KNSIG_WORDS];
} k_rtsigset_t;
/* Copied from the Linux kernel arch/powerpc/include/uapi/asm/signal.h */
#define SA_RESTORER 0x04000000U
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask; /* mask last for extensibility */
} rt_sigaction_t;
#define core_is_compat(core) false
#include "uapi/std/asm/syscall-types.h"
typedef UserPpc64RegsEntry UserRegsEntry;
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__PPC64
#define core_is_compat(core) false
#define CORE_THREAD_ARCH_INFO(core) core->ti_ppc64
static inline void *decode_pointer(uint64_t v) { return (void*)v; }
......
......@@ -8,6 +8,8 @@
#include "bitops.h"
#include "asm/int.h"
#include "uapi/std/asm/syscall-types.h"
#include "images/core.pb-c.h"
#ifdef CONFIG_X86_64
......@@ -26,55 +28,6 @@ static inline int core_is_compat(CoreEntry *c)
static inline int core_is_compat(CoreEntry *c) { return 0; }
#endif /* CONFIG_X86_64 */
typedef void rt_signalfn_t(int, siginfo_t *, void *);
typedef rt_signalfn_t *rt_sighandler_t;
typedef void rt_restorefn_t(void);
typedef rt_restorefn_t *rt_sigrestore_t;
#define _KNSIG 64
# define _NSIG_BPW 64
#define _KNSIG_WORDS (_KNSIG / _NSIG_BPW)
typedef struct {
u64 sig[_KNSIG_WORDS];
} k_rtsigset_t;
#define SA_RESTORER 0x04000000
typedef struct {
rt_sighandler_t rt_sa_handler;
unsigned long rt_sa_flags;
rt_sigrestore_t rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t;
/*
* Note: there is unaligned access on x86_64 and it's fine.
* However, when porting this code -- keep in mind about possible issues
* with unaligned rt_sa_mask.
*/
typedef struct __attribute__((packed)) {
u32 rt_sa_handler;
u32 rt_sa_flags;
u32 rt_sa_restorer;
k_rtsigset_t rt_sa_mask;
} rt_sigaction_t_compat;
typedef struct {
unsigned int entry_number;
unsigned int base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
unsigned int seg_not_present:1;
unsigned int useable:1;
unsigned int lm:1;
} user_desc_t;
#define CORE_ENTRY__MARCH CORE_ENTRY__MARCH__X86_64
#define CORE_THREAD_ARCH_INFO(core) core->thread_info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment