linux/arch/s390/kernel/vdso64/clock_getres.S
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Userland implementation of clock_getres() for 64 bits processes in a
   4 * s390 kernel for use in the vDSO
   5 *
   6 *  Copyright IBM Corp. 2008
   7 *  Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
   8 */
   9#include <asm/vdso.h>
  10#include <asm/asm-offsets.h>
  11#include <asm/unistd.h>
  12#include <asm/dwarf.h>
  13
  14        .text
  15        .align 4
  16        .globl __kernel_clock_getres
  17        .type  __kernel_clock_getres,@function
  18__kernel_clock_getres:
  19        CFI_STARTPROC
  20        larl    %r1,3f
  21        lg      %r0,0(%r1)
  22        cghi    %r2,__CLOCK_REALTIME_COARSE
  23        je      0f
  24        cghi    %r2,__CLOCK_MONOTONIC_COARSE
  25        je      0f
  26        larl    %r1,_vdso_data
  27        llgf    %r0,__VDSO_CLOCK_REALTIME_RES(%r1)
  28        cghi    %r2,__CLOCK_REALTIME
  29        je      0f
  30        cghi    %r2,__CLOCK_MONOTONIC
  31        je      0f
  32        cghi    %r2,__CLOCK_THREAD_CPUTIME_ID
  33        je      0f
  34        cghi    %r2,-2          /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
  35        jne     2f
  36        larl    %r5,_vdso_data
  37        icm     %r0,15,__LC_ECTG_OK(%r5)
  38        jz      2f
  390:      ltgr    %r3,%r3
  40        jz      1f                              /* res == NULL */
  41        xc      0(8,%r3),0(%r3)                 /* set tp->tv_sec to zero */
  42        stg     %r0,8(%r3)                      /* store tp->tv_usec */
  431:      lghi    %r2,0
  44        br      %r14
  452:      lghi    %r1,__NR_clock_getres           /* fallback to svc */
  46        svc     0
  47        br      %r14
  48        CFI_ENDPROC
  493:      .quad   __CLOCK_COARSE_RES
  50        .size   __kernel_clock_getres,.-__kernel_clock_getres
  51