1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * 4 * Copyright (C) IBM Corporation, 2012 5 * 6 * Author: Anton Blanchard <anton@au.ibm.com> 7 */ 8 #include <asm/ppc_asm.h> 9 #include <asm/vdso.h> 10 11 .text 12 /* 13 * Exact prototype of getcpu 14 * 15 * int __kernel_getcpu(unsigned *cpu, unsigned *node); 16 * 17 */ 18 V_FUNCTION_BEGIN(__kernel_getcpu) 19 .cfi_startproc 20 mfspr r5,SPRN_SPRG_VDSO_READ 21 cmpwi cr0,r3,0 22 cmpwi cr1,r4,0 23 clrlwi r6,r5,16 24 rlwinm r7,r5,16,31-15,31-0 25 beq cr0,1f 26 stw r6,0(r3) 27 1: beq cr1,2f 28 stw r7,0(r4) 29 2: crclr cr0*4+so 30 li r3,0 /* always success */ 31 blr 32 .cfi_endproc 33 V_FUNCTION_END(__kernel_getcpu)