| .. | .. |
|---|
| 1 | | -/* |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | + * |
|---|
| 2 | 3 | * Copyright (C) 1999, 2000, 2002 Niibe Yutaka |
|---|
| 3 | 4 | * Copyright (C) 2003 - 2008 Paul Mundt |
|---|
| 4 | | - * |
|---|
| 5 | | - * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 6 | | - * License. See the file "COPYING" in the main directory of this archive |
|---|
| 7 | | - * for more details. |
|---|
| 8 | | - * |
|---|
| 9 | 5 | */ |
|---|
| 10 | 6 | |
|---|
| 11 | 7 | ! NOTE: |
|---|
| .. | .. |
|---|
| 45 | 41 | */ |
|---|
| 46 | 42 | #include <asm/dwarf.h> |
|---|
| 47 | 43 | |
|---|
| 48 | | -#if defined(CONFIG_PREEMPT) |
|---|
| 44 | +#if defined(CONFIG_PREEMPTION) |
|---|
| 49 | 45 | # define preempt_stop() cli ; TRACE_IRQS_OFF |
|---|
| 50 | 46 | #else |
|---|
| 51 | 47 | # define preempt_stop() |
|---|
| .. | .. |
|---|
| 88 | 84 | get_current_thread_info r8, r0 |
|---|
| 89 | 85 | bt resume_kernel ! Yes, it's from kernel, go back soon |
|---|
| 90 | 86 | |
|---|
| 91 | | -#ifdef CONFIG_PREEMPT |
|---|
| 87 | +#ifdef CONFIG_PREEMPTION |
|---|
| 92 | 88 | bra resume_userspace |
|---|
| 93 | 89 | nop |
|---|
| 94 | 90 | ENTRY(resume_kernel) |
|---|
| .. | .. |
|---|
| 181 | 177 | nop |
|---|
| 182 | 178 | bra resume_userspace |
|---|
| 183 | 179 | nop |
|---|
| 184 | | - |
|---|
| 185 | | - .align 2 |
|---|
| 186 | | -syscall_trace_entry: |
|---|
| 187 | | - ! Yes it is traced. |
|---|
| 188 | | - mov r15, r4 |
|---|
| 189 | | - mov.l 7f, r11 ! Call do_syscall_trace_enter which notifies |
|---|
| 190 | | - jsr @r11 ! superior (will chomp R[0-7]) |
|---|
| 191 | | - nop |
|---|
| 192 | | - mov.l r0, @(OFF_R0,r15) ! Save return value |
|---|
| 193 | | - ! Reload R0-R4 from kernel stack, where the |
|---|
| 194 | | - ! parent may have modified them using |
|---|
| 195 | | - ! ptrace(POKEUSR). (Note that R0-R2 are |
|---|
| 196 | | - ! reloaded from the kernel stack by syscall_call |
|---|
| 197 | | - ! below, so don't need to be reloaded here.) |
|---|
| 198 | | - ! This allows the parent to rewrite system calls |
|---|
| 199 | | - ! and args on the fly. |
|---|
| 200 | | - mov.l @(OFF_R4,r15), r4 ! arg0 |
|---|
| 201 | | - mov.l @(OFF_R5,r15), r5 |
|---|
| 202 | | - mov.l @(OFF_R6,r15), r6 |
|---|
| 203 | | - mov.l @(OFF_R7,r15), r7 ! arg3 |
|---|
| 204 | | - mov.l @(OFF_R3,r15), r3 ! syscall_nr |
|---|
| 205 | | - ! |
|---|
| 206 | | - mov.l 6f, r10 ! Number of syscalls |
|---|
| 207 | | - cmp/hs r10, r3 |
|---|
| 208 | | - bf syscall_call |
|---|
| 209 | | - mov #-ENOSYS, r0 |
|---|
| 210 | | - bra syscall_exit |
|---|
| 211 | | - mov.l r0, @(OFF_R0,r15) ! Return value |
|---|
| 212 | 180 | |
|---|
| 213 | 181 | __restore_all: |
|---|
| 214 | 182 | mov #OFF_SR, r0 |
|---|
| .. | .. |
|---|
| 392 | 360 | bf syscall_exit_work |
|---|
| 393 | 361 | bra __restore_all |
|---|
| 394 | 362 | nop |
|---|
| 363 | + |
|---|
| 364 | + .align 2 |
|---|
| 365 | +syscall_trace_entry: |
|---|
| 366 | + ! Yes it is traced. |
|---|
| 367 | + mov r15, r4 |
|---|
| 368 | + mov.l 7f, r11 ! Call do_syscall_trace_enter which notifies |
|---|
| 369 | + jsr @r11 ! superior (will chomp R[0-7]) |
|---|
| 370 | + nop |
|---|
| 371 | + cmp/eq #-1, r0 |
|---|
| 372 | + bt syscall_exit |
|---|
| 373 | + ! Reload R0-R4 from kernel stack, where the |
|---|
| 374 | + ! parent may have modified them using |
|---|
| 375 | + ! ptrace(POKEUSR). (Note that R0-R2 are |
|---|
| 376 | + ! reloaded from the kernel stack by syscall_call |
|---|
| 377 | + ! below, so don't need to be reloaded here.) |
|---|
| 378 | + ! This allows the parent to rewrite system calls |
|---|
| 379 | + ! and args on the fly. |
|---|
| 380 | + mov.l @(OFF_R4,r15), r4 ! arg0 |
|---|
| 381 | + mov.l @(OFF_R5,r15), r5 |
|---|
| 382 | + mov.l @(OFF_R6,r15), r6 |
|---|
| 383 | + mov.l @(OFF_R7,r15), r7 ! arg3 |
|---|
| 384 | + mov.l @(OFF_R3,r15), r3 ! syscall_nr |
|---|
| 385 | + ! |
|---|
| 386 | + mov.l 6f, r10 ! Number of syscalls |
|---|
| 387 | + cmp/hs r10, r3 |
|---|
| 388 | + bf syscall_call |
|---|
| 389 | + mov #-ENOSYS, r0 |
|---|
| 390 | + bra syscall_exit |
|---|
| 391 | + mov.l r0, @(OFF_R0,r15) ! Return value |
|---|
| 392 | + |
|---|
| 395 | 393 | .align 2 |
|---|
| 396 | 394 | #if !defined(CONFIG_CPU_SH2) |
|---|
| 397 | 395 | 1: .long TRA |
|---|