1/* 2 * 64-bit switch cpu code 3 * 4 * Copyright IBM Corp. 2009 5 * 6 */ 7 8#include <asm/asm-offsets.h> 9#include <asm/ptrace.h> 10 11# smp_switch_to_cpu switches to destination cpu and executes the passed function 12# Parameter: %r2 - function to call 13# %r3 - function parameter 14# %r4 - stack poiner 15# %r5 - current cpu 16# %r6 - destination cpu 17 18 .section .text 19 .align 4 20 .globl smp_switch_to_cpu 21smp_switch_to_cpu: 22 stmg %r6,%r15,__SF_GPRS(%r15) 23 lgr %r1,%r15 24 aghi %r15,-STACK_FRAME_OVERHEAD 25 stg %r1,__SF_BACKCHAIN(%r15) 26 larl %r1,.gprregs 27 stmg %r0,%r15,0(%r1) 281: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */ 29 brc 2,1b /* busy, try again */ 302: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */ 31 brc 2,2b /* busy, try again */ 323: j 3b 33 34 .globl smp_restart_cpu 35smp_restart_cpu: 36 larl %r1,.gprregs 37 lmg %r0,%r15,0(%r1) 381: sigp %r0,%r5,__SIGP_SENSE /* Wait for calling CPU */ 39 brc 10,1b /* busy, accepted (status 0), running */ 40 tmll %r0,0x40 /* Test if calling CPU is stopped */ 41 jz 1b 42 ltgr %r4,%r4 /* New stack ? */ 43 jz 1f 44 lgr %r15,%r4 451: basr %r14,%r2 46 47 .section .data,"aw",@progbits 48.gprregs: 49 .rept 16 50 .quad 0 51 .endr 52