blob: 4cbe98291931402766f3fe3ff49e3d0bbee82eb9 [file] [log] [blame]
Martin Schwidefsky249c5432016-01-05 13:29:38 +01001/*
2 * Userland implementation of getcpu() for 64 bits processes in a
3 * s390 kernel for use in the vDSO
4 *
5 * Copyright IBM Corp. 2016
6 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 */
8#include <asm/vdso.h>
9#include <asm/asm-offsets.h>
10
11 .text
12 .align 4
13 .globl __kernel_getcpu
14 .type __kernel_getcpu,@function
15__kernel_getcpu:
16 .cfi_startproc
17 ear %r1,%a4
18 llilh %r4,0x0100
19 sar %a4,%r4
20 la %r4,0
21 epsw %r0,0
22 sacf 512
23 l %r5,__VDSO_CPU_NR(%r4)
24 l %r4,__VDSO_NODE_ID(%r4)
25 tml %r0,0x4000
26 jo 1f
27 tml %r0,0x8000
28 jno 0f
29 sacf 256
30 j 1f
310: sacf 0
321: sar %a4,%r1
33 ltgr %r2,%r2
34 jz 2f
35 st %r5,0(%r2)
362: ltgr %r3,%r3
37 jz 3f
38 st %r4,0(%r3)
393: lghi %r2,0
40 br %r14
41 .cfi_endproc
42 .size __kernel_getcpu,.-__kernel_getcpu