diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt index 131bdbf9f4..28a92c07b1 100644 --- a/driver/CMakeLists.txt +++ b/driver/CMakeLists.txt @@ -107,7 +107,6 @@ set(DRIVER_SOURCES ppm_fillers.h ppm_flag_helpers.h ppm_ringbuffer.h - ppm_syscall.h syscall_table.c syscall_table32.c syscall_table64.c diff --git a/driver/main.c b/driver/main.c index 4cea5b04a4..36e2cd86af 100644 --- a/driver/main.c +++ b/driver/main.c @@ -11,14 +11,7 @@ or GPL2.txt for full copies of the license. #include #include - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) -#include -#include -#include "ppm_syscall.h" -#else #include -#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) */ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)) #include diff --git a/driver/ppm.h b/driver/ppm.h index 0a064e813d..ee0392a453 100644 --- a/driver/ppm.h +++ b/driver/ppm.h @@ -109,9 +109,6 @@ extern void ppm_syscall_get_arguments(struct task_struct *task, struct pt_regs * // used in main.c, ppm_events.c and ppm_fillers.c so include it just once here #ifdef __KERNEL__ #include -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) -#include "ppm_syscall.h" -#endif #endif #endif /* PPM_H_ */ diff --git a/driver/ppm_events.c b/driver/ppm_events.c index a572dff2d6..45f12494c3 100644 --- a/driver/ppm_events.c +++ b/driver/ppm_events.c @@ -29,12 +29,7 @@ or GPL2.txt for full copies of the license. #include #include #include -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) -#include -#include "ppm_syscall.h" -#else #include -#endif #else // UDIG #define _GNU_SOURCE #include diff --git a/driver/ppm_fillers.c b/driver/ppm_fillers.c index 9afb27a0cd..7b99686160 100644 --- a/driver/ppm_fillers.c +++ b/driver/ppm_fillers.c @@ -32,11 +32,7 @@ or GPL2.txt for full copies of the license. #ifdef CONFIG_CGROUPS #include #endif -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) -#include "ppm_syscall.h" -#else #include -#endif #else /* UDIG */ #define _GNU_SOURCE #include diff --git a/driver/ppm_syscall.h b/driver/ppm_syscall.h deleted file mode 100644 index fdbc0605dd..0000000000 --- a/driver/ppm_syscall.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Access to user system call parameters and results - * - * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. - * - * This copyrighted material is made available to anyone wishing to use, - * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License v.2. - * - * See asm-generic/syscall.h for descriptions of what we must do here. - */ - -#ifndef _ASM_X86_SYSCALL_H -#define _ASM_X86_SYSCALL_H - -//#include -#include -#include -#include /* For NR_syscalls */ -#include /* for TS_COMPAT */ -#include - -#ifndef NR_syscalls -#define NR_syscalls (__NR_syscall_max + 1) -#endif - -typedef void (*sys_call_ptr_t)(void); -extern const sys_call_ptr_t sys_call_table[]; - -/* - * Only the low 32 bits of orig_ax are meaningful, so we return int. - * This importantly ignores the high bits on 64-bit, so comparisons - * sign-extend the low 32 bits. - */ -static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) -{ - return regs->orig_rax; -} - -static inline void syscall_rollback(struct task_struct *task, - struct pt_regs *regs) -{ - regs->rax = regs->orig_rax; -} - -static inline long syscall_get_error(struct task_struct *task, - struct pt_regs *regs) -{ - unsigned long error = regs->rax; -#ifdef CONFIG_IA32_EMULATION - /* - * TS_COMPAT is set for 32-bit syscall entries and then - * remains set until we return to user mode. - */ - if (task_thread_info(task)->status & TS_COMPAT) - /* - * Sign-extend the value so (int)-EFOO becomes (long)-EFOO - * and will match correctly in comparisons. - */ - error = (long) (int) error; -#endif - return IS_ERR_VALUE(error) ? error : 0; -} - -static inline long syscall_get_return_value(struct task_struct *task, - struct pt_regs *regs) -{ - return regs->rax; -} - -static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) -{ - regs->rax = (long) error ?: val; -} - -#ifdef CONFIG_X86_32 - -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ - BUG_ON(i + n > 6); - memcpy(args, ®s->rbx + i, n * sizeof(args[0])); -} - -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ - BUG_ON(i + n > 6); - memcpy(®s->rbx + i, args, n * sizeof(args[0])); -} - -static inline int syscall_get_arch(void) -{ - return AUDIT_ARCH_I386; -} - -#else /* CONFIG_X86_64 */ - -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ -# ifdef CONFIG_IA32_EMULATION - if (task_thread_info(task)->status & TS_COMPAT) - switch (i) { - case 0: - if (!n--) break; - *args++ = regs->rbx; - case 1: - if (!n--) break; - *args++ = regs->rcx; - case 2: - if (!n--) break; - *args++ = regs->rdx; - case 3: - if (!n--) break; - *args++ = regs->rsi; - case 4: - if (!n--) break; - *args++ = regs->rdi; - case 5: - if (!n--) break; - *args++ = regs->rbp; - case 6: - if (!n--) break; - default: - BUG(); - break; - } - else -# endif - switch (i) { - case 0: - if (!n--) break; - *args++ = regs->rdi; - case 1: - if (!n--) break; - *args++ = regs->rsi; - case 2: - if (!n--) break; - *args++ = regs->rdx; - case 3: - if (!n--) break; - *args++ = regs->r10; - case 4: - if (!n--) break; - *args++ = regs->r8; - case 5: - if (!n--) break; - *args++ = regs->r9; - case 6: - if (!n--) break; - default: - BUG(); - break; - } -} - -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ -# ifdef CONFIG_IA32_EMULATION - if (task_thread_info(task)->status & TS_COMPAT) - switch (i) { - case 0: - if (!n--) break; - regs->rbx = *args++; - case 1: - if (!n--) break; - regs->rcx = *args++; - case 2: - if (!n--) break; - regs->rdx = *args++; - case 3: - if (!n--) break; - regs->rsi = *args++; - case 4: - if (!n--) break; - regs->rdi = *args++; - case 5: - if (!n--) break; - regs->rbp = *args++; - case 6: - if (!n--) break; - default: - BUG(); - break; - } - else -# endif - switch (i) { - case 0: - if (!n--) break; - regs->rdi = *args++; - case 1: - if (!n--) break; - regs->rsi = *args++; - case 2: - if (!n--) break; - regs->rdx = *args++; - case 3: - if (!n--) break; - regs->r10 = *args++; - case 4: - if (!n--) break; - regs->r8 = *args++; - case 5: - if (!n--) break; - regs->r9 = *args++; - case 6: - if (!n--) break; - default: - BUG(); - break; - } -} - -#endif /* CONFIG_X86_32 */ - -#endif /* _ASM_X86_SYSCALL_H */