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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // that the high bits are all clear. | 46 // that the high bits are all clear. |
47 // | 47 // |
48 // Many bit positions in the flags register are reserved and will always read | 48 // Many bit positions in the flags register are reserved and will always read |
49 // a known value. Most reservd bits are always 0, but bit 1 is always 1. Check | 49 // a known value. Most reservd bits are always 0, but bit 1 is always 1. Check |
50 // that the reserved bits are all set to their expected values. Note that the | 50 // that the reserved bits are all set to their expected values. Note that the |
51 // set of reserved bits may be relaxed over time with newer CPUs, and that | 51 // set of reserved bits may be relaxed over time with newer CPUs, and that |
52 // this test may need to be changed to reflect these developments. The current | 52 // this test may need to be changed to reflect these developments. The current |
53 // set of reserved bits are 1, 3, 5, 15, and 22 and higher. See Intel Software | 53 // set of reserved bits are 1, 3, 5, 15, and 22 and higher. See Intel Software |
54 // Developer’s Manual, Volume 1: Basic Architecture (253665-051), 3.4.3 | 54 // Developer’s Manual, Volume 1: Basic Architecture (253665-051), 3.4.3 |
55 // “EFLAGS Register”, and AMD Architecture Programmer’s Manual, Volume 2: | 55 // “EFLAGS Register”, and AMD Architecture Programmer’s Manual, Volume 2: |
56 // System Programming (24593-2.53), 3.1.6 “RFLAGS Register”. | 56 // System Programming (24593-3.24), 3.1.6 “RFLAGS Register”. |
57 #if defined(ARCH_CPU_X86) | 57 #if defined(ARCH_CPU_X86) |
58 EXPECT_EQ(0u, context->uts.ts32.__cs & ~0xffff); | 58 EXPECT_EQ(0u, context->uts.ts32.__cs & ~0xffff); |
59 EXPECT_EQ(0u, context->uts.ts32.__ds & ~0xffff); | 59 EXPECT_EQ(0u, context->uts.ts32.__ds & ~0xffff); |
60 EXPECT_EQ(0u, context->uts.ts32.__es & ~0xffff); | 60 EXPECT_EQ(0u, context->uts.ts32.__es & ~0xffff); |
61 EXPECT_EQ(0u, context->uts.ts32.__fs & ~0xffff); | 61 EXPECT_EQ(0u, context->uts.ts32.__fs & ~0xffff); |
62 EXPECT_EQ(0u, context->uts.ts32.__gs & ~0xffff); | 62 EXPECT_EQ(0u, context->uts.ts32.__gs & ~0xffff); |
63 EXPECT_EQ(0u, context->uts.ts32.__ss & ~0xffff); | 63 EXPECT_EQ(0u, context->uts.ts32.__ss & ~0xffff); |
64 EXPECT_EQ(2u, context->uts.ts32.__eflags & 0xffc0802a); | 64 EXPECT_EQ(2u, context->uts.ts32.__eflags & 0xffc0802a); |
65 #elif defined(ARCH_CPU_X86_64) | 65 #elif defined(ARCH_CPU_X86_64) |
66 EXPECT_EQ(0u, context->uts.ts64.__cs & ~UINT64_C(0xffff)); | 66 EXPECT_EQ(0u, context->uts.ts64.__cs & ~UINT64_C(0xffff)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 | 146 |
147 TEST(CaptureContextMac, CaptureContext) { | 147 TEST(CaptureContextMac, CaptureContext) { |
148 TestCaptureContext(); | 148 TestCaptureContext(); |
149 if (Test::HasFatalFailure()) { | 149 if (Test::HasFatalFailure()) { |
150 return; | 150 return; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } // namespace | 154 } // namespace |
OLD | NEW |