Linux Audio

Check our new training course

Loading...
v6.2
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef ARCH_S390_ENTRY_COMMON_H
 3#define ARCH_S390_ENTRY_COMMON_H
 4
 5#include <linux/sched.h>
 6#include <linux/audit.h>
 7#include <linux/randomize_kstack.h>
 
 8#include <linux/processor.h>
 9#include <linux/uaccess.h>
10#include <asm/timex.h>
11#include <asm/fpu/api.h>
12#include <asm/pai.h>
13
14#define ARCH_EXIT_TO_USER_MODE_WORK (_TIF_GUARDED_STORAGE | _TIF_PER_TRAP)
15
16void do_per_trap(struct pt_regs *regs);
17
18static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs)
 
19{
20	if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
21		debug_user_asce(0);
22
23	pai_kernel_enter(regs);
24}
25
26#define arch_enter_from_user_mode arch_enter_from_user_mode
 
27
28static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
29							unsigned long ti_work)
30{
31	if (ti_work & _TIF_PER_TRAP) {
32		clear_thread_flag(TIF_PER_TRAP);
33		do_per_trap(regs);
34	}
35
36	if (ti_work & _TIF_GUARDED_STORAGE)
37		gs_load_bc_cb(regs);
38}
39
40#define arch_exit_to_user_mode_work arch_exit_to_user_mode_work
41
42static __always_inline void arch_exit_to_user_mode(void)
43{
44	if (test_cpu_flag(CIF_FPU))
45		__load_fpu_regs();
46
47	if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
48		debug_user_asce(1);
49
50	pai_kernel_exit(current_pt_regs());
51}
52
53#define arch_exit_to_user_mode arch_exit_to_user_mode
54
55static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
56						  unsigned long ti_work)
57{
58	choose_random_kstack_offset(get_tod_clock_fast() & 0xff);
59}
60
61#define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
62
63static inline bool on_thread_stack(void)
64{
65	return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
66}
67
68#endif
v5.14.15
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef ARCH_S390_ENTRY_COMMON_H
 3#define ARCH_S390_ENTRY_COMMON_H
 4
 5#include <linux/sched.h>
 6#include <linux/audit.h>
 7#include <linux/randomize_kstack.h>
 8#include <linux/tracehook.h>
 9#include <linux/processor.h>
10#include <linux/uaccess.h>
11#include <asm/timex.h>
12#include <asm/fpu/api.h>
 
13
14#define ARCH_EXIT_TO_USER_MODE_WORK (_TIF_GUARDED_STORAGE | _TIF_PER_TRAP)
15
16void do_per_trap(struct pt_regs *regs);
17
18#ifdef CONFIG_DEBUG_ENTRY
19static __always_inline void arch_check_user_regs(struct pt_regs *regs)
20{
21	debug_user_asce(0);
 
 
 
22}
23
24#define arch_check_user_regs arch_check_user_regs
25#endif /* CONFIG_DEBUG_ENTRY */
26
27static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
28							unsigned long ti_work)
29{
30	if (ti_work & _TIF_PER_TRAP) {
31		clear_thread_flag(TIF_PER_TRAP);
32		do_per_trap(regs);
33	}
34
35	if (ti_work & _TIF_GUARDED_STORAGE)
36		gs_load_bc_cb(regs);
37}
38
39#define arch_exit_to_user_mode_work arch_exit_to_user_mode_work
40
41static __always_inline void arch_exit_to_user_mode(void)
42{
43	if (test_cpu_flag(CIF_FPU))
44		__load_fpu_regs();
45
46	if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
47		debug_user_asce(1);
 
 
48}
49
50#define arch_exit_to_user_mode arch_exit_to_user_mode
51
52static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
53						  unsigned long ti_work)
54{
55	choose_random_kstack_offset(get_tod_clock_fast() & 0xff);
56}
57
58#define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
59
60static inline bool on_thread_stack(void)
61{
62	return !(((unsigned long)(current->stack) ^ current_stack_pointer()) & ~(THREAD_SIZE - 1));
63}
64
65#endif