1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Userland implementation of getcpu() for 64 bits processes in a
4 * s390 kernel for use in the vDSO
5 *
6 *  Copyright IBM Corp. 2016
7 *  Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
8 */
9#include <asm/vdso.h>
10#include <asm/asm-offsets.h>
11#include <asm/dwarf.h>
12
13	.text
14	.align 4
15	.globl __kernel_getcpu
16	.type  __kernel_getcpu,@function
17__kernel_getcpu:
18	CFI_STARTPROC
19	sacf	256
20	lm	%r4,%r5,__VDSO_GETCPU_VAL(%r0)
21	sacf	0
22	ltgr	%r2,%r2
23	jz	2f
24	st	%r5,0(%r2)
252:	ltgr	%r3,%r3
26	jz	3f
27	st	%r4,0(%r3)
283:	lghi	%r2,0
29	br	%r14
30	CFI_ENDPROC
31	.size	__kernel_getcpu,.-__kernel_getcpu
32