History

sh: Rearrange blocks in entry-common.S

This avoids out-of-range jumps that get auto-replaced by the assembler and prepares for the changes needed to implement SECCOMP_FILTER cleanly.

Michael Karcher committed 6 years ago

Commit 9d2ec8f1 parent e1cc9d81 file · +29 −28Browse files

Unified · Split

arch/sh/kernel/entry-common.S+29−28
@@ -178,34 +178,6 @@ syscall_exit_work: · 177 unmodified lines
178178 bra resume_userspace
179179 nop
180180
181− .align 2
182−syscall_trace_entry:
183− ! Yes it is traced.
184− mov r15, r4
185− mov.l 7f, r11 ! Call do_syscall_trace_enter which notifies
186− jsr @r11 ! superior (will chomp R[0-7])
187− nop
188− mov.l r0, @(OFF_R0,r15) ! Save return value
189− ! Reload R0-R4 from kernel stack, where the
190− ! parent may have modified them using
191− ! ptrace(POKEUSR). (Note that R0-R2 are
192− ! reloaded from the kernel stack by syscall_call
193− ! below, so don't need to be reloaded here.)
194− ! This allows the parent to rewrite system calls
195− ! and args on the fly.
196− mov.l @(OFF_R4,r15), r4 ! arg0
197− mov.l @(OFF_R5,r15), r5
198− mov.l @(OFF_R6,r15), r6
199− mov.l @(OFF_R7,r15), r7 ! arg3
200− mov.l @(OFF_R3,r15), r3 ! syscall_nr
201− !
202− mov.l 6f, r10 ! Number of syscalls
203− cmp/hs r10, r3
204− bf syscall_call
205− mov #-ENOSYS, r0
206− bra syscall_exit
207− mov.l r0, @(OFF_R0,r15) ! Return value
208−
209181 __restore_all:
210182 mov #OFF_SR, r0
211183 mov.l @(r0,r15), r0 ! get status register
@@ -388,6 +360,35 @@ syscall_exit: · 176 unmodified lines
388360 bf syscall_exit_work
389361 bra __restore_all
390362 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+ mov.l r0, @(OFF_R0,r15) ! Save return value
372+ ! Reload R0-R4 from kernel stack, where the
373+ ! parent may have modified them using
374+ ! ptrace(POKEUSR). (Note that R0-R2 are
375+ ! reloaded from the kernel stack by syscall_call
376+ ! below, so don't need to be reloaded here.)
377+ ! This allows the parent to rewrite system calls
378+ ! and args on the fly.
379+ mov.l @(OFF_R4,r15), r4 ! arg0
380+ mov.l @(OFF_R5,r15), r5
381+ mov.l @(OFF_R6,r15), r6
382+ mov.l @(OFF_R7,r15), r7 ! arg3
383+ mov.l @(OFF_R3,r15), r3 ! syscall_nr
384+ !
385+ mov.l 6f, r10 ! Number of syscalls
386+ cmp/hs r10, r3
387+ bf syscall_call
388+ mov #-ENOSYS, r0
389+ bra syscall_exit
390+ mov.l r0, @(OFF_R0,r15) ! Return value
391+
391392 .align 2
392393 #if !defined(CONFIG_CPU_SH2)
393394 1: .long TRA

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t