clock_getres.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Userland implementation of clock_getres() for 64 bits processes in a
  3. * s390 kernel for use in the vDSO
  4. *
  5. * Copyright IBM Corp. 2008
  6. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License (version 2 only)
  10. * as published by the Free Software Foundation.
  11. */
  12. #include <asm/vdso.h>
  13. #include <asm/asm-offsets.h>
  14. #include <asm/unistd.h>
  15. .text
  16. .align 4
  17. .globl __kernel_clock_getres
  18. .type __kernel_clock_getres,@function
  19. __kernel_clock_getres:
  20. .cfi_startproc
  21. larl %r1,4f
  22. cghi %r2,__CLOCK_REALTIME_COARSE
  23. je 0f
  24. cghi %r2,__CLOCK_MONOTONIC_COARSE
  25. je 0f
  26. larl %r1,3f
  27. cghi %r2,__CLOCK_REALTIME
  28. je 0f
  29. cghi %r2,__CLOCK_MONOTONIC
  30. je 0f
  31. cghi %r2,__CLOCK_THREAD_CPUTIME_ID
  32. je 0f
  33. cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
  34. jne 2f
  35. larl %r5,_vdso_data
  36. icm %r0,15,__LC_ECTG_OK(%r5)
  37. jz 2f
  38. 0: ltgr %r3,%r3
  39. jz 1f /* res == NULL */
  40. lg %r0,0(%r1)
  41. xc 0(8,%r3),0(%r3) /* set tp->tv_sec to zero */
  42. stg %r0,8(%r3) /* store tp->tv_usec */
  43. 1: lghi %r2,0
  44. br %r14
  45. 2: lghi %r1,__NR_clock_getres /* fallback to svc */
  46. svc 0
  47. br %r14
  48. 3: .quad __CLOCK_REALTIME_RES
  49. 4: .quad __CLOCK_COARSE_RES
  50. .cfi_endproc
  51. .size __kernel_clock_getres,.-__kernel_clock_getres