getcpu.S 730 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Userland implementation of getcpu() for 32 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. .text
  11. .align 4
  12. .globl __kernel_getcpu
  13. .type __kernel_getcpu,@function
  14. __kernel_getcpu:
  15. .cfi_startproc
  16. ear %r1,%a4
  17. lhi %r4,1
  18. sll %r4,24
  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
  31. 0: sacf 0
  32. 1: sar %a4,%r1
  33. ltr %r2,%r2
  34. jz 2f
  35. st %r5,0(%r2)
  36. 2: ltr %r3,%r3
  37. jz 3f
  38. st %r4,0(%r3)
  39. 3: lhi %r2,0
  40. br %r14
  41. .cfi_endproc
  42. .size __kernel_getcpu,.-__kernel_getcpu