entry.S (87a0b2fafc09766d8c55461a18345a1cfb10a7fe) entry.S (22e2100b1b07d6f5acc71cc1acb53f680c677d77)
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>

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

103
104 /* Load the global pointer */
105.option push
106.option norelax
107 la gp, __global_pointer$
108.option pop
109
110#ifdef CONFIG_TRACE_IRQFLAGS
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>

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

103
104 /* Load the global pointer */
105.option push
106.option norelax
107 la gp, __global_pointer$
108.option pop
109
110#ifdef CONFIG_TRACE_IRQFLAGS
111 call trace_hardirqs_off
111 call __trace_hardirqs_off
112#endif
113
114#ifdef CONFIG_CONTEXT_TRACKING
115 /* If previous state is in user mode, call context_tracking_user_exit. */
116 li a0, SR_PP
117 and a0, s1, a0
118 bnez a0, skip_context_tracking
119 call context_tracking_user_exit

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

138 * state of SR_PIE in m/sstatus.
139 */
140 andi t0, s1, SR_PIE
141 beqz t0, 1f
142 /* kprobes, entered via ebreak, must have interrupts disabled. */
143 li t0, EXC_BREAKPOINT
144 beq s4, t0, 1f
145#ifdef CONFIG_TRACE_IRQFLAGS
112#endif
113
114#ifdef CONFIG_CONTEXT_TRACKING
115 /* If previous state is in user mode, call context_tracking_user_exit. */
116 li a0, SR_PP
117 and a0, s1, a0
118 bnez a0, skip_context_tracking
119 call context_tracking_user_exit

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

138 * state of SR_PIE in m/sstatus.
139 */
140 andi t0, s1, SR_PIE
141 beqz t0, 1f
142 /* kprobes, entered via ebreak, must have interrupts disabled. */
143 li t0, EXC_BREAKPOINT
144 beq s4, t0, 1f
145#ifdef CONFIG_TRACE_IRQFLAGS
146 call trace_hardirqs_on
146 call __trace_hardirqs_on
147#endif
148 csrs CSR_STATUS, SR_IE
149
1501:
151 la ra, ret_from_exception
152 /* Handle syscalls */
153 li t0, EXC_SYSCALL
154 beq s4, t0, handle_syscall

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

229 REG_L t0, TASK_TI_FLAGS(tp)
230 andi t0, t0, _TIF_SYSCALL_WORK
231 bnez t0, handle_syscall_trace_exit
232
233ret_from_exception:
234 REG_L s0, PT_STATUS(sp)
235 csrc CSR_STATUS, SR_IE
236#ifdef CONFIG_TRACE_IRQFLAGS
147#endif
148 csrs CSR_STATUS, SR_IE
149
1501:
151 la ra, ret_from_exception
152 /* Handle syscalls */
153 li t0, EXC_SYSCALL
154 beq s4, t0, handle_syscall

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

229 REG_L t0, TASK_TI_FLAGS(tp)
230 andi t0, t0, _TIF_SYSCALL_WORK
231 bnez t0, handle_syscall_trace_exit
232
233ret_from_exception:
234 REG_L s0, PT_STATUS(sp)
235 csrc CSR_STATUS, SR_IE
236#ifdef CONFIG_TRACE_IRQFLAGS
237 call trace_hardirqs_off
237 call __trace_hardirqs_off
238#endif
239#ifdef CONFIG_RISCV_M_MODE
240 /* the MPP value is too large to be used as an immediate arg for addi */
241 li t0, SR_MPP
242 and s0, s0, t0
243#else
244 andi s0, s0, SR_SPP
245#endif

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

265 */
266 csrw CSR_SCRATCH, tp
267
268restore_all:
269#ifdef CONFIG_TRACE_IRQFLAGS
270 REG_L s1, PT_STATUS(sp)
271 andi t0, s1, SR_PIE
272 beqz t0, 1f
238#endif
239#ifdef CONFIG_RISCV_M_MODE
240 /* the MPP value is too large to be used as an immediate arg for addi */
241 li t0, SR_MPP
242 and s0, s0, t0
243#else
244 andi s0, s0, SR_SPP
245#endif

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

265 */
266 csrw CSR_SCRATCH, tp
267
268restore_all:
269#ifdef CONFIG_TRACE_IRQFLAGS
270 REG_L s1, PT_STATUS(sp)
271 andi t0, s1, SR_PIE
272 beqz t0, 1f
273 call trace_hardirqs_on
273 call __trace_hardirqs_on
274 j 2f
2751:
274 j 2f
2751:
276 call trace_hardirqs_off
276 call __trace_hardirqs_off
2772:
278#endif
279 REG_L a0, PT_STATUS(sp)
280 /*
281 * The current load reservation is effectively part of the processor's
282 * state, in the sense that load reservations cannot be shared between
283 * different hart contexts. We can't actually save and restore a load
284 * reservation, so instead here we clear any existing reservation --

--- 300 unchanged lines hidden ---
2772:
278#endif
279 REG_L a0, PT_STATUS(sp)
280 /*
281 * The current load reservation is effectively part of the processor's
282 * state, in the sense that load reservations cannot be shared between
283 * different hart contexts. We can't actually save and restore a load
284 * reservation, so instead here we clear any existing reservation --

--- 300 unchanged lines hidden ---