OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "gtest/gtest.h" | 7 #include "gtest/gtest.h" |
8 | 8 |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const uint8_t ret[] = { 0xc3 }; | 42 const uint8_t ret[] = { 0xc3 }; |
43 #endif | 43 #endif |
44 | 44 |
45 // Example of an instruction which may get "stubbed out" (replaced with | 45 // Example of an instruction which may get "stubbed out" (replaced with |
46 // HLTs) if the CPU does not support it. | 46 // HLTs) if the CPU does not support it. |
47 const uint8_t sse41[] = | 47 const uint8_t sse41[] = |
48 { 0x66, 0x0f, 0x3a, 0x0e, 0xd0, 0xc0 }; // pblendw $0xc0,%xmm0,%xmm2 | 48 { 0x66, 0x0f, 0x3a, 0x0e, 0xd0, 0xc0 }; // pblendw $0xc0,%xmm0,%xmm2 |
49 | 49 |
50 const uint8_t sse41_plus_nontemporal[] = | 50 const uint8_t sse41_plus_nontemporal[] = |
51 { 0x66, 0x0f, 0x3a, 0x0e, 0xd0, 0xc0, // pblendw $0xc0,%xmm0,%xmm2 | 51 { 0x66, 0x0f, 0x3a, 0x0e, 0xd0, 0xc0, // pblendw $0xc0,%xmm0,%xmm2 |
52 0x0f, 0x18, 0x04, 0x24 }; // prefetchnta (%rsp) | 52 // Example of a non-temporal instruction that is rewritten without |
| 53 // being rejected entirely. |
| 54 #if NACL_BUILD_SUBARCH == 32 |
| 55 0x66, 0x0f, 0xe7, 0x04, 0x24 // movntdq %xmm0,(%esp) |
| 56 #else |
| 57 0x66, 0x41, 0x0f, 0xe7, 0x07 // movntdq %xmm0,(%r15) |
| 58 #endif |
| 59 }; |
53 | 60 |
54 // Example of a valid JMP to outside the bundle, in a bundle containing an | 61 // Example of a valid JMP to outside the bundle, in a bundle containing an |
55 // instruction that gets stubbed out. | 62 // instruction that gets stubbed out. |
56 const uint8_t sse41_plus_valid_jmp[] = | 63 const uint8_t sse41_plus_valid_jmp[] = |
57 { 0x66, 0x0f, 0x3a, 0x0e, 0xd0, 0xc0, // pblendw $0xc0,%xmm0,%xmm2 | 64 { 0x66, 0x0f, 0x3a, 0x0e, 0xd0, 0xc0, // pblendw $0xc0,%xmm0,%xmm2 |
58 0xeb, 0x19 }; // jmp to a non-bundle-aligned nop in the next bundle | 65 0xeb, 0x19 }; // jmp to a non-bundle-aligned nop in the next bundle |
59 | 66 |
60 // Example of an invalid JMP to outside the bundle, in a bundle containing | 67 // Example of an invalid JMP to outside the bundle, in a bundle containing |
61 // an instruction that gets stubbed out. | 68 // an instruction that gets stubbed out. |
62 const uint8_t sse41_plus_invalid_jmp[] = | 69 const uint8_t sse41_plus_invalid_jmp[] = |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // One file we know must exist is this executable. | 513 // One file we know must exist is this executable. |
507 AN_ARBITRARY_FILE_PATH = argv[0]; | 514 AN_ARBITRARY_FILE_PATH = argv[0]; |
508 // The IllegalInst test touches the log mutex deep inside the validator. | 515 // The IllegalInst test touches the log mutex deep inside the validator. |
509 // This causes an SEH exception to be thrown on Windows if the mutex is not | 516 // This causes an SEH exception to be thrown on Windows if the mutex is not |
510 // initialized. | 517 // initialized. |
511 // http://code.google.com/p/nativeclient/issues/detail?id=1696 | 518 // http://code.google.com/p/nativeclient/issues/detail?id=1696 |
512 NaClLogModuleInit(); | 519 NaClLogModuleInit(); |
513 testing::InitGoogleTest(&argc, argv); | 520 testing::InitGoogleTest(&argc, argv); |
514 return RUN_ALL_TESTS(); | 521 return RUN_ALL_TESTS(); |
515 } | 522 } |
OLD | NEW |