blob: 63e914539e1a2f4c2fcfc36458793f1cd338a0f7 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-or-later */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00003 *
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 */
18V_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)
271: beq cr1,2f
28 stw r7,0(r4)
292: crclr cr0*4+so
30 li r3,0 /* always success */
31 blr
32 .cfi_endproc
33V_FUNCTION_END(__kernel_getcpu)