Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] cleanup system call parameter setup

Do the setup of the stack overflow argument for the sixth system
call parameter right before the branch to the system call function.
That simplifies the system call parameter access code.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Martin Schwidefsky and committed by
Martin Schwidefsky
baa07158 178514d7

+5 -9
-4
arch/s390/include/asm/syscall.h
··· 65 65 if (test_tsk_thread_flag(task, TIF_31BIT)) 66 66 mask = 0xffffffff; 67 67 #endif 68 - if (i + n == 6) 69 - args[--n] = regs->args[0] & mask; 70 68 while (n-- > 0) 71 69 if (i + n > 0) 72 70 args[n] = regs->gprs[2 + i + n] & mask; ··· 78 80 const unsigned long *args) 79 81 { 80 82 BUG_ON(i + n > 6); 81 - if (i + n == 6) 82 - regs->args[0] = args[--n]; 83 83 while (n-- > 0) 84 84 if (i + n > 0) 85 85 regs->gprs[2 + i + n] = args[n];
+3 -3
arch/s390/kernel/entry.S
··· 254 254 bnl BASED(sysc_nr_ok) 255 255 lr %r7,%r1 # copy svc number to %r7 256 256 sysc_nr_ok: 257 - mvc SP_ARGS(4,%r15),SP_R7(%r15) 258 - sysc_do_restart: 259 257 sth %r7,SP_SVCNR(%r15) 260 258 sll %r7,2 # svc number *4 261 259 l %r8,BASED(.Lsysc_table) 262 260 tm __TI_flags+2(%r9),_TIF_SYSCALL 261 + mvc SP_ARGS(4,%r15),SP_R7(%r15) 263 262 l %r8,0(%r7,%r8) # get system call addr. 264 263 bnz BASED(sysc_tracesys) 265 264 basr %r14,%r8 # call sys_xxxx ··· 346 347 l %r7,SP_R2(%r15) # load new svc number 347 348 mvc SP_R2(4,%r15),SP_ORIG_R2(%r15) # restore first argument 348 349 lm %r2,%r6,SP_R2(%r15) # load svc arguments 349 - b BASED(sysc_do_restart) # restart svc 350 + b BASED(sysc_nr_ok) # restart svc 350 351 351 352 # 352 353 # _TIF_SINGLE_STEP is set, call do_single_step ··· 379 380 l %r8,0(%r7,%r8) 380 381 sysc_tracego: 381 382 lm %r3,%r6,SP_R3(%r15) 383 + mvc SP_ARGS(4,%r15),SP_R7(%r15) 382 384 l %r2,SP_ORIG_R2(%r15) 383 385 basr %r14,%r8 # call sys_xxx 384 386 st %r2,SP_R2(%r15) # store return value
+2 -2
arch/s390/kernel/entry64.S
··· 246 246 CREATE_STACK_FRAME __LC_SAVE_AREA 247 247 mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 248 248 mvc SP_ILC(4,%r15),__LC_SVC_ILC 249 - stg %r7,SP_ARGS(%r15) 250 249 lg %r12,__LC_THREAD_INFO # load pointer to thread_info struct 251 250 sysc_vtime: 252 251 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER ··· 273 274 sysc_noemu: 274 275 #endif 275 276 tm __TI_flags+6(%r12),_TIF_SYSCALL 277 + mvc SP_ARGS(8,%r15),SP_R7(%r15) 276 278 lgf %r8,0(%r7,%r10) # load address of system call routine 277 279 jnz sysc_tracesys 278 280 basr %r14,%r8 # call sys_xxxx ··· 387 387 lgf %r8,0(%r7,%r10) 388 388 sysc_tracego: 389 389 lmg %r3,%r6,SP_R3(%r15) 390 + mvc SP_ARGS(8,%r15),SP_R7(%r15) 390 391 lg %r2,SP_ORIG_R2(%r15) 391 392 basr %r14,%r8 # call sys_xxx 392 393 stg %r2,SP_R2(%r15) # store return value ··· 954 953 CREATE_STACK_FRAME __LC_SAVE_AREA 955 954 mvc SP_PSW(16,%r15),__LC_SVC_OLD_PSW 956 955 mvc SP_ILC(4,%r15),__LC_SVC_ILC 957 - stg %r7,SP_ARGS(%r15) 958 956 mvc 8(8,%r12),__LC_THREAD_INFO 959 957 cleanup_vtime: 960 958 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24)