OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // | 263 // |
264 // All CPUs that Apple is known to have shipped should support DAZ. | 264 // All CPUs that Apple is known to have shipped should support DAZ. |
265 | 265 |
266 // Test for fxsave support. | 266 // Test for fxsave support. |
267 uint64_t features = CPUX86Features(); | 267 uint64_t features = CPUX86Features(); |
268 if (!(features & (UINT64_C(1) << 24))) { | 268 if (!(features & (UINT64_C(1) << 24))) { |
269 return false; | 269 return false; |
270 } | 270 } |
271 | 271 |
272 // Call fxsave. | 272 // Call fxsave. |
| 273 #if defined(ARCH_CPU_X86) |
273 CPUContextX86::Fxsave fxsave __attribute__((aligned(16))) = {}; | 274 CPUContextX86::Fxsave fxsave __attribute__((aligned(16))) = {}; |
| 275 #elif defined(ARCH_CPU_X86_64) |
| 276 CPUContextX86_64::Fxsave fxsave __attribute__((aligned(16))) = {}; |
| 277 #endif |
274 static_assert(sizeof(fxsave) == 512, "fxsave size"); | 278 static_assert(sizeof(fxsave) == 512, "fxsave size"); |
275 static_assert(offsetof(decltype(fxsave), mxcsr_mask) == 28, | 279 static_assert(offsetof(decltype(fxsave), mxcsr_mask) == 28, |
276 "mxcsr_mask offset"); | 280 "mxcsr_mask offset"); |
277 asm("fxsave %0" : "=m"(fxsave)); | 281 asm("fxsave %0" : "=m"(fxsave)); |
278 | 282 |
279 // Test the DAZ bit. | 283 // Test the DAZ bit. |
280 return fxsave.mxcsr_mask & (1 << 6); | 284 return fxsave.mxcsr_mask & (1 << 6); |
281 #else | 285 #else |
282 NOTREACHED(); | 286 NOTREACHED(); |
283 return false; | 287 return false; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } else { | 390 } else { |
387 *daylight_name = tzname[0]; | 391 *daylight_name = tzname[0]; |
388 *dst_status = kDoesNotObserveDaylightSavingTime; | 392 *dst_status = kDoesNotObserveDaylightSavingTime; |
389 *standard_offset_seconds = local.tm_gmtoff; | 393 *standard_offset_seconds = local.tm_gmtoff; |
390 *daylight_offset_seconds = local.tm_gmtoff; | 394 *daylight_offset_seconds = local.tm_gmtoff; |
391 } | 395 } |
392 } | 396 } |
393 | 397 |
394 } // namespace internal | 398 } // namespace internal |
395 } // namespace crashpad | 399 } // namespace crashpad |
OLD | NEW |