| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Userland implementation of gettimeofday() for 64 bits processes in a |
|---|
| 3 | 4 | * ppc64 kernel for use in the vDSO |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), |
|---|
| 6 | 7 | * IBM Corp. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or |
|---|
| 9 | | - * modify it under the terms of the GNU General Public License |
|---|
| 10 | | - * as published by the Free Software Foundation; either version |
|---|
| 11 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | #include <asm/processor.h> |
|---|
| 14 | 10 | #include <asm/ppc_asm.h> |
|---|
| 15 | 11 | #include <asm/vdso.h> |
|---|
| 12 | +#include <asm/vdso_datapage.h> |
|---|
| 16 | 13 | #include <asm/asm-offsets.h> |
|---|
| 17 | 14 | #include <asm/unistd.h> |
|---|
| 18 | 15 | |
|---|
| .. | .. |
|---|
| 30 | 27 | |
|---|
| 31 | 28 | mr r11,r3 /* r11 holds tv */ |
|---|
| 32 | 29 | mr r10,r4 /* r10 holds tz */ |
|---|
| 33 | | - bl V_LOCAL_FUNC(__get_datapage) /* get data page */ |
|---|
| 30 | + get_datapage r3, r0 |
|---|
| 34 | 31 | cmpldi r11,0 /* check if tv is NULL */ |
|---|
| 35 | 32 | beq 2f |
|---|
| 36 | 33 | lis r7,1000000@ha /* load up USEC_PER_SEC */ |
|---|
| .. | .. |
|---|
| 75 | 72 | mflr r12 /* r12 saves lr */ |
|---|
| 76 | 73 | .cfi_register lr,r12 |
|---|
| 77 | 74 | mr r11,r4 /* r11 saves tp */ |
|---|
| 78 | | - bl V_LOCAL_FUNC(__get_datapage) /* get data page */ |
|---|
| 75 | + get_datapage r3, r0 |
|---|
| 79 | 76 | lis r7,NSEC_PER_SEC@h /* want nanoseconds */ |
|---|
| 80 | 77 | ori r7,r7,NSEC_PER_SEC@l |
|---|
| 81 | 78 | beq cr5,70f |
|---|
| .. | .. |
|---|
| 120 | 117 | * CLOCK_REALTIME_COARSE, below values are needed for MONOTONIC_COARSE |
|---|
| 121 | 118 | * too |
|---|
| 122 | 119 | */ |
|---|
| 123 | | - ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) |
|---|
| 124 | | - ld r5,STAMP_XTIME+TSPC64_TV_NSEC(r3) |
|---|
| 120 | + ld r4,STAMP_XTIME_SEC(r3) |
|---|
| 121 | + ld r5,STAMP_XTIME_NSEC(r3) |
|---|
| 125 | 122 | bne cr6,75f |
|---|
| 126 | 123 | |
|---|
| 127 | 124 | /* CLOCK_MONOTONIC_COARSE */ |
|---|
| .. | .. |
|---|
| 192 | 189 | |
|---|
| 193 | 190 | mflr r12 |
|---|
| 194 | 191 | .cfi_register lr,r12 |
|---|
| 195 | | - bl V_LOCAL_FUNC(__get_datapage) |
|---|
| 192 | + get_datapage r3, r0 |
|---|
| 196 | 193 | lwz r5, CLOCK_HRTIMER_RES(r3) |
|---|
| 197 | 194 | mtlr r12 |
|---|
| 198 | 195 | li r3,0 |
|---|
| .. | .. |
|---|
| 225 | 222 | .cfi_register lr,r12 |
|---|
| 226 | 223 | |
|---|
| 227 | 224 | mr r11,r3 /* r11 holds t */ |
|---|
| 228 | | - bl V_LOCAL_FUNC(__get_datapage) |
|---|
| 225 | + get_datapage r3, r0 |
|---|
| 229 | 226 | |
|---|
| 230 | | - ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) |
|---|
| 227 | + ld r4,STAMP_XTIME_SEC(r3) |
|---|
| 231 | 228 | |
|---|
| 232 | 229 | cmpldi r11,0 /* check if t is NULL */ |
|---|
| 233 | 230 | beq 2f |
|---|
| .. | .. |
|---|
| 272 | 269 | mulhdu r6,r6,r5 /* in units of 2^-32 seconds */ |
|---|
| 273 | 270 | |
|---|
| 274 | 271 | /* Add stamp since epoch */ |
|---|
| 275 | | - ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) |
|---|
| 272 | + ld r4,STAMP_XTIME_SEC(r3) |
|---|
| 276 | 273 | lwz r5,STAMP_SEC_FRAC(r3) |
|---|
| 277 | 274 | or r0,r4,r5 |
|---|
| 278 | 275 | or r0,r0,r6 |
|---|