clock_getres.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Userland implementation of clock_getres() for 32 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. basr %r1,0
  22. la %r1,4f-.(%r1)
  23. chi %r2,__CLOCK_REALTIME
  24. je 0f
  25. chi %r2,__CLOCK_MONOTONIC
  26. je 0f
  27. la %r1,5f-4f(%r1)
  28. chi %r2,__CLOCK_REALTIME_COARSE
  29. je 0f
  30. chi %r2,__CLOCK_MONOTONIC_COARSE
  31. jne 3f
  32. 0: ltr %r3,%r3
  33. jz 2f /* res == NULL */
  34. 1: l %r0,0(%r1)
  35. xc 0(4,%r3),0(%r3) /* set tp->tv_sec to zero */
  36. st %r0,4(%r3) /* store tp->tv_usec */
  37. 2: lhi %r2,0
  38. br %r14
  39. 3: lhi %r1,__NR_clock_getres /* fallback to svc */
  40. svc 0
  41. br %r14
  42. 4: .long __CLOCK_REALTIME_RES
  43. 5: .long __CLOCK_COARSE_RES
  44. .cfi_endproc
  45. .size __kernel_clock_getres,.-__kernel_clock_getres