entry.S (f163f0302ab69722c052519f4014814bf10026a9) entry.S (24a9c54182b3758801b8ca6c8c237cc2ff654732)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 * Copyright (C) 2017 SiFive
5 */
6
7#include <linux/init.h>
8#include <linux/linkage.h>

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

106.option norelax
107 la gp, __global_pointer$
108.option pop
109
110#ifdef CONFIG_TRACE_IRQFLAGS
111 call __trace_hardirqs_off
112#endif
113
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 * Copyright (C) 2017 SiFive
5 */
6
7#include <linux/init.h>
8#include <linux/linkage.h>

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

106.option norelax
107 la gp, __global_pointer$
108.option pop
109
110#ifdef CONFIG_TRACE_IRQFLAGS
111 call __trace_hardirqs_off
112#endif
113
114#ifdef CONFIG_CONTEXT_TRACKING
114#ifdef CONFIG_CONTEXT_TRACKING_USER
115 /* If previous state is in user mode, call user_exit_callable(). */
116 li a0, SR_PP
117 and a0, s1, a0
118 bnez a0, skip_context_tracking
119 call user_exit_callable
120skip_context_tracking:
121#endif
122

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

171 /*
172 * When running is M-Mode (no MMU config), MPIE does not get set.
173 * As a result, we need to force enable interrupts here because
174 * handle_exception did not do set SR_IE as it always sees SR_PIE
175 * being cleared.
176 */
177 csrs CSR_STATUS, SR_IE
178#endif
115 /* If previous state is in user mode, call user_exit_callable(). */
116 li a0, SR_PP
117 and a0, s1, a0
118 bnez a0, skip_context_tracking
119 call user_exit_callable
120skip_context_tracking:
121#endif
122

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

171 /*
172 * When running is M-Mode (no MMU config), MPIE does not get set.
173 * As a result, we need to force enable interrupts here because
174 * handle_exception did not do set SR_IE as it always sees SR_PIE
175 * being cleared.
176 */
177 csrs CSR_STATUS, SR_IE
178#endif
179#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
179#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING_USER)
180 /* Recover a0 - a7 for system calls */
181 REG_L a0, PT_A0(sp)
182 REG_L a1, PT_A1(sp)
183 REG_L a2, PT_A2(sp)
184 REG_L a3, PT_A3(sp)
185 REG_L a4, PT_A4(sp)
186 REG_L a5, PT_A5(sp)
187 REG_L a6, PT_A6(sp)

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

264 bnez s0, resume_kernel
265
266resume_userspace:
267 /* Interrupts must be disabled here so flags are checked atomically */
268 REG_L s0, TASK_TI_FLAGS(tp) /* current_thread_info->flags */
269 andi s1, s0, _TIF_WORK_MASK
270 bnez s1, work_pending
271
180 /* Recover a0 - a7 for system calls */
181 REG_L a0, PT_A0(sp)
182 REG_L a1, PT_A1(sp)
183 REG_L a2, PT_A2(sp)
184 REG_L a3, PT_A3(sp)
185 REG_L a4, PT_A4(sp)
186 REG_L a5, PT_A5(sp)
187 REG_L a6, PT_A6(sp)

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

264 bnez s0, resume_kernel
265
266resume_userspace:
267 /* Interrupts must be disabled here so flags are checked atomically */
268 REG_L s0, TASK_TI_FLAGS(tp) /* current_thread_info->flags */
269 andi s1, s0, _TIF_WORK_MASK
270 bnez s1, work_pending
271
272#ifdef CONFIG_CONTEXT_TRACKING
272#ifdef CONFIG_CONTEXT_TRACKING_USER
273 call user_enter_callable
274#endif
275
276 /* Save unwound kernel stack pointer in thread_info */
277 addi s0, sp, PT_SIZE_ON_STACK
278 REG_S s0, TASK_TI_KERNEL_SP(tp)
279
280 /*

--- 322 unchanged lines hidden ---
273 call user_enter_callable
274#endif
275
276 /* Save unwound kernel stack pointer in thread_info */
277 addi s0, sp, PT_SIZE_ON_STACK
278 REG_S s0, TASK_TI_KERNEL_SP(tp)
279
280 /*

--- 322 unchanged lines hidden ---