commit 4a79e45e0a03843489de0987eb6be84222201c10 Author: Aliaksei Dabryian Date: Fri Mar 13 12:56:37 2015 +0300 sys_nr_irq() diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 547e344..cc4d656 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -35,6 +35,7 @@ struct thread_info { void __user *sysenter_return; unsigned int sig_on_uaccess_error:1; unsigned int uaccess_err:1; /* uaccess failed */ + __u64 nr_irq; }; #define INIT_THREAD_INFO(tsk) \ diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c index 9f6b934..1b2158d 100644 --- a/arch/x86/kernel/asm-offsets.c +++ b/arch/x86/kernel/asm-offsets.c @@ -32,6 +32,7 @@ void common(void) { OFFSET(TI_flags, thread_info, flags); OFFSET(TI_status, thread_info, status); OFFSET(TI_addr_limit, thread_info, addr_limit); + OFFSET(TI_nr_irq, thread_info, nr_irq); BLANK(); OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 9ebaf63..c4ee124 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -808,6 +808,7 @@ ret_from_intr: exit_intr: GET_THREAD_INFO(%rcx) + addq $1, TI_nr_irq(%rcx) testl $3,CS-ARGOFFSET(%rsp) je retint_kernel diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl index 8d656fb..f61a380 100644 --- a/arch/x86/syscalls/syscall_64.tbl +++ b/arch/x86/syscalls/syscall_64.tbl @@ -329,6 +329,7 @@ 320 common kexec_file_load sys_kexec_file_load 321 common bpf sys_bpf 322 64 execveat stub_execveat +323 64 nr_irq sys_nr_irq # # x32-specific system call numbers start at 512 to avoid cache impact diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 85893d7..811b0dc 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -205,6 +205,8 @@ extern struct trace_event_functions exit_syscall_print_funcs; } \ static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) +asmlinkage long sys_nr_irq(void); + asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr); asmlinkage long sys_time(time_t __user *tloc); diff --git a/kernel/Makefile b/kernel/Makefile index a59481a..3d3d425 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -27,6 +27,8 @@ obj-y += printk/ obj-y += irq/ obj-y += rcu/ +obj-y += sys_nr_irq.o + obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o obj-$(CONFIG_FREEZER) += freezer.o obj-$(CONFIG_PROFILING) += profile.o diff --git a/kernel/sys_nr_irq.c b/kernel/sys_nr_irq.c new file mode 100644 index 0000000..b57f482 --- /dev/null +++ b/kernel/sys_nr_irq.c @@ -0,0 +1,7 @@ +#include +#include + +SYSCALL_DEFINE0(nr_irq) +{ + return current_thread_info()->nr_irq; +}