2 * 64-bit switch cpu code
4 * Copyright IBM Corp. 2009
8 #include <asm/asm-offsets.h>
9 #include <asm/ptrace.h>
11 # smp_switch_to_cpu switches to destination cpu and executes the passed function
12 # Parameter: %r2 - function to call
13 # %r3 - function parameter
16 # %r6 - destination cpu
20 .globl smp_switch_to_cpu
22 stmg %r6,%r15,__SF_GPRS(%r15)
24 aghi %r15,-STACK_FRAME_OVERHEAD
25 stg %r1,__SF_BACKCHAIN(%r15)
28 1: sigp %r0,%r6,__SIGP_RESTART /* start destination CPU */
29 brc 2,1b /* busy, try again */
30 2: sigp %r0,%r5,__SIGP_STOP /* stop current CPU */
31 brc 2,2b /* busy, try again */
34 .globl smp_restart_cpu
38 1: 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 */
42 ltgr %r4,%r4 /* New stack ? */
45 1: lgr %r14,%r2 /* r14: Function to call */
46 lgr %r2,%r3 /* r2 : Parameter for function*/
47 basr %r14,%r14 /* Call function */
49 .section .data,"aw",@progbits