common.c (b8bc3bde9c8c90500c648627d53f846642ff8639) common.c (1e423bff959e48166f5b7efca01fdb0dbdf05846)
1/*
2 * common.c - C code for kernel entry and exit
3 * Copyright (c) 2015 Andrew Lutomirski
4 * GPL v2
5 *
6 * Based on asm and ptrace code by many authors. The code here originated
7 * in ptrace.c and signal.c.
8 */

--- 330 unchanged lines hidden (view full) ---

339 */
340 ti->status &= ~TS_COMPAT;
341#endif
342
343 local_irq_disable();
344 prepare_exit_to_usermode(regs);
345}
346
1/*
2 * common.c - C code for kernel entry and exit
3 * Copyright (c) 2015 Andrew Lutomirski
4 * GPL v2
5 *
6 * Based on asm and ptrace code by many authors. The code here originated
7 * in ptrace.c and signal.c.
8 */

--- 330 unchanged lines hidden (view full) ---

339 */
340 ti->status &= ~TS_COMPAT;
341#endif
342
343 local_irq_disable();
344 prepare_exit_to_usermode(regs);
345}
346
347#ifdef CONFIG_X86_64
348__visible void do_syscall_64(struct pt_regs *regs)
349{
350 struct thread_info *ti = pt_regs_to_thread_info(regs);
351 unsigned long nr = regs->orig_ax;
352
353 local_irq_enable();
354
355 if (READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY)
356 nr = syscall_trace_enter(regs);
357
358 /*
359 * NB: Native and x32 syscalls are dispatched from the same
360 * table. The only functional difference is the x32 bit in
361 * regs->orig_ax, which changes the behavior of some syscalls.
362 */
363 if (likely((nr & __SYSCALL_MASK) < NR_syscalls)) {
364 regs->ax = sys_call_table[nr & __SYSCALL_MASK](
365 regs->di, regs->si, regs->dx,
366 regs->r10, regs->r8, regs->r9);
367 }
368
369 syscall_return_slowpath(regs);
370}
371#endif
372
347#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
348/*
349 * Does a 32-bit syscall. Called with IRQs on and does all entry and
350 * exit work and returns with IRQs off. This function is extremely hot
351 * in workloads that use it, and it's usually called from
352 * do_fast_syscall_32, so forcibly inline it to improve performance.
353 */
354#ifdef CONFIG_X86_32

--- 132 unchanged lines hidden ---
373#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
374/*
375 * Does a 32-bit syscall. Called with IRQs on and does all entry and
376 * exit work and returns with IRQs off. This function is extremely hot
377 * in workloads that use it, and it's usually called from
378 * do_fast_syscall_32, so forcibly inline it to improve performance.
379 */
380#ifdef CONFIG_X86_32

--- 132 unchanged lines hidden ---