OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if (!(features & (UINT64_C(1) << 24))) { | 267 if (!(features & (UINT64_C(1) << 24))) { |
268 return false; | 268 return false; |
269 } | 269 } |
270 | 270 |
271 // Call fxsave. | 271 // Call fxsave. |
272 __declspec(align(16)) uint32_t extended_registers[128]; | 272 __declspec(align(16)) uint32_t extended_registers[128]; |
273 _fxsave(&extended_registers); | 273 _fxsave(&extended_registers); |
274 uint32_t mxcsr_mask = extended_registers[7]; | 274 uint32_t mxcsr_mask = extended_registers[7]; |
275 | 275 |
276 // Test the DAZ bit. | 276 // Test the DAZ bit. |
277 return mxcsr_mask & (1 << 6); | 277 return (mxcsr_mask & (1 << 6)) != 0; |
278 } | 278 } |
279 | 279 |
280 SystemSnapshot::OperatingSystem SystemSnapshotWin::GetOperatingSystem() const { | 280 SystemSnapshot::OperatingSystem SystemSnapshotWin::GetOperatingSystem() const { |
281 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 281 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
282 return kOperatingSystemWindows; | 282 return kOperatingSystemWindows; |
283 } | 283 } |
284 | 284 |
285 bool SystemSnapshotWin::OSServer() const { | 285 bool SystemSnapshotWin::OSServer() const { |
286 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 286 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
287 return os_server_; | 287 return os_server_; |
(...skipping 16 matching lines...) Expand all Loading... |
304 } | 304 } |
305 | 305 |
306 std::string SystemSnapshotWin::MachineDescription() const { | 306 std::string SystemSnapshotWin::MachineDescription() const { |
307 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 307 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
308 // TODO(scottmg): Not sure if there's anything sensible to put here. | 308 // TODO(scottmg): Not sure if there's anything sensible to put here. |
309 return std::string(); | 309 return std::string(); |
310 } | 310 } |
311 | 311 |
312 bool SystemSnapshotWin::NXEnabled() const { | 312 bool SystemSnapshotWin::NXEnabled() const { |
313 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 313 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
314 return IsProcessorFeaturePresent(PF_NX_ENABLED); | 314 return !!IsProcessorFeaturePresent(PF_NX_ENABLED); |
315 } | 315 } |
316 | 316 |
317 void SystemSnapshotWin::TimeZone(DaylightSavingTimeStatus* dst_status, | 317 void SystemSnapshotWin::TimeZone(DaylightSavingTimeStatus* dst_status, |
318 int* standard_offset_seconds, | 318 int* standard_offset_seconds, |
319 int* daylight_offset_seconds, | 319 int* daylight_offset_seconds, |
320 std::string* standard_name, | 320 std::string* standard_name, |
321 std::string* daylight_name) const { | 321 std::string* daylight_name) const { |
322 // This returns the current time zone status rather than the status at the | 322 // This returns the current time zone status rather than the status at the |
323 // time of the snapshot. This differs from the Mac implementation. | 323 // time of the snapshot. This differs from the Mac implementation. |
324 TIME_ZONE_INFORMATION time_zone_information; | 324 TIME_ZONE_INFORMATION time_zone_information; |
325 *dst_status = static_cast<DaylightSavingTimeStatus>( | 325 *dst_status = static_cast<DaylightSavingTimeStatus>( |
326 GetTimeZoneInformation(&time_zone_information)); | 326 GetTimeZoneInformation(&time_zone_information)); |
327 *standard_offset_seconds = | 327 *standard_offset_seconds = |
328 (time_zone_information.Bias + time_zone_information.StandardBias) * -60; | 328 (time_zone_information.Bias + time_zone_information.StandardBias) * -60; |
329 *daylight_offset_seconds = | 329 *daylight_offset_seconds = |
330 (time_zone_information.Bias + time_zone_information.DaylightBias) * -60; | 330 (time_zone_information.Bias + time_zone_information.DaylightBias) * -60; |
331 *standard_name = base::UTF16ToUTF8(time_zone_information.StandardName); | 331 *standard_name = base::UTF16ToUTF8(time_zone_information.StandardName); |
332 *daylight_name = base::UTF16ToUTF8(time_zone_information.DaylightName); | 332 *daylight_name = base::UTF16ToUTF8(time_zone_information.DaylightName); |
333 } | 333 } |
334 | 334 |
335 } // namespace internal | 335 } // namespace internal |
336 } // namespace crashpad | 336 } // namespace crashpad |
OLD | NEW |