clock_getres.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. cghi %r2,__CLOCK_REALTIME
  22. je 0f
  23. cghi %r2,__CLOCK_MONOTONIC
  24. je 0f
  25. cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
  26. jne 2f
  27. larl %r5,_vdso_data
  28. icm %r0,15,__LC_ECTG_OK(%r5)
  29. jz 2f
  30. 0: ltgr %r3,%r3
  31. jz 1f /* res == NULL */
  32. larl %r1,3f
  33. lg %r0,0(%r1)
  34. xc 0(8,%r3),0(%r3) /* set tp->tv_sec to zero */
  35. stg %r0,8(%r3) /* store tp->tv_usec */
  36. 1: lghi %r2,0
  37. br %r14
  38. 2: lghi %r1,__NR_clock_getres /* fallback to svc */
  39. svc 0
  40. br %r14
  41. 3: .quad __CLOCK_REALTIME_RES
  42. .cfi_endproc
  43. .size __kernel_clock_getres,.-__kernel_clock_getres