Skip to content

Commit 11f494f

Browse files
raskyianlancetaylor
authored andcommitted
runtime: rename offsets macros to prepare for multiple versions
High Sierra has a new commpage layout (this is issue #3188), so we need to adjust the code to handle multiple versions of the layout. In preparation for this change, we rename the existing offset macros with a prefix that identifies the commpage version they refer to. Updates #22037 Change-Id: Idca4b7a855a2ff6dbc434cd12453fc3194707aa8 Reviewed-on: https://go-review.googlesource.com/67331 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 630d176 commit 11f494f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/runtime/sys_darwin_amd64.s

+22-22
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,28 @@ TEXT runtime·madvise(SB), NOSPLIT, $0
108108

109109
// OS X comm page time offsets
110110
// http://www.opensource.apple.com/source/xnu/xnu-1699.26.8/osfmk/i386/cpu_capabilities.h
111-
#define nt_tsc_base 0x50
112-
#define nt_scale 0x58
113-
#define nt_shift 0x5c
114-
#define nt_ns_base 0x60
115-
#define nt_generation 0x68
116-
#define gtod_generation 0x6c
117-
#define gtod_ns_base 0x70
118-
#define gtod_sec_base 0x78
111+
#define v12_nt_tsc_base 0x50
112+
#define v12_nt_scale 0x58
113+
#define v12_nt_shift 0x5c
114+
#define v12_nt_ns_base 0x60
115+
#define v12_nt_generation 0x68
116+
#define v12_gtod_generation 0x6c
117+
#define v12_gtod_ns_base 0x70
118+
#define v12_gtod_sec_base 0x78
119119

120120
TEXT runtime·nanotime(SB),NOSPLIT,$0-8
121121
MOVQ $0x7fffffe00000, BP /* comm page base */
122122
// Loop trying to take a consistent snapshot
123123
// of the time parameters.
124124
timeloop:
125-
MOVL nt_generation(BP), R9
125+
MOVL v12_nt_generation(BP), R9
126126
TESTL R9, R9
127127
JZ timeloop
128128
RDTSC
129-
MOVQ nt_tsc_base(BP), R10
130-
MOVL nt_scale(BP), R11
131-
MOVQ nt_ns_base(BP), R12
132-
CMPL nt_generation(BP), R9
129+
MOVQ v12_nt_tsc_base(BP), R10
130+
MOVL v12_nt_scale(BP), R11
131+
MOVQ v12_nt_ns_base(BP), R12
132+
CMPL v12_nt_generation(BP), R9
133133
JNE timeloop
134134

135135
// Gathered all the data we need. Compute monotonic time:
@@ -154,19 +154,19 @@ TEXT time·now(SB), NOSPLIT, $32-24
154154
// Loop trying to take a consistent snapshot
155155
// of the time parameters.
156156
timeloop:
157-
MOVL gtod_generation(BP), R8
158-
MOVL nt_generation(BP), R9
157+
MOVL v12_gtod_generation(BP), R8
158+
MOVL v12_nt_generation(BP), R9
159159
TESTL R9, R9
160160
JZ timeloop
161161
RDTSC
162-
MOVQ nt_tsc_base(BP), R10
163-
MOVL nt_scale(BP), R11
164-
MOVQ nt_ns_base(BP), R12
165-
CMPL nt_generation(BP), R9
162+
MOVQ v12_nt_tsc_base(BP), R10
163+
MOVL v12_nt_scale(BP), R11
164+
MOVQ v12_nt_ns_base(BP), R12
165+
CMPL v12_nt_generation(BP), R9
166166
JNE timeloop
167-
MOVQ gtod_ns_base(BP), R13
168-
MOVQ gtod_sec_base(BP), R14
169-
CMPL gtod_generation(BP), R8
167+
MOVQ v12_gtod_ns_base(BP), R13
168+
MOVQ v12_gtod_sec_base(BP), R14
169+
CMPL v12_gtod_generation(BP), R8
170170
JNE timeloop
171171

172172
// Gathered all the data we need. Compute:

0 commit comments

Comments
 (0)