OLD | NEW |
---|---|
(Empty) | |
1 /* | |
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 | |
4 * found in the LICENSE file. | |
5 */ | |
6 | |
7 /* Implement the ApplyDfaValidator API for the x86-64 architecture. */ | |
8 #include <assert.h> | |
9 #include "native_client/src/shared/platform/nacl_log.h" | |
10 #include "native_client/src/trusted/validator/ncvalidate.h" | |
11 #include "native_client/src/trusted/validator/validation_cache.h" | |
12 #include "native_client/src/trusted/validator_ragel/unreviewed/validator.h" | |
13 | |
14 /* Be sure the correct compile flags are defined for this. */ | |
15 #if NACL_ARCH(NACL_TARGET_ARCH) != NACL_x86 | |
16 # error("Can't compile, target is for x86-64") | |
17 #else | |
18 # if NACL_TARGET_SUBARCH != 64 | |
19 # error("Can't compile, target is for x86-64") | |
20 # endif | |
21 #endif | |
22 | |
23 static void ProcessError(const uint8_t *ptr, void *userdata) { | |
24 UNREFERENCED_PARAMETER(ptr); | |
25 UNREFERENCED_PARAMETER(userdata); | |
26 } | |
27 | |
28 NaClValidationStatus NACL_SUBARCH_NAME(ApplyDfaValidator, x86, 64) ( | |
29 enum NaClSBKind sb_kind, | |
30 uintptr_t guest_addr, | |
31 uint8_t *data, | |
32 size_t size, | |
33 int stubout_mode, | |
34 int readonly_text, | |
35 const NaClCPUFeaturesX86 *cpu_features, | |
36 struct NaClValidationCache *cache) { | |
37 UNREFERENCED_PARAMETER(guest_addr); | |
38 UNREFERENCED_PARAMETER(readonly_text); | |
Nick Bray
2012/04/19 23:11:08
Dito.
pasko-google - do not use
2012/04/20 14:30:38
Done.
| |
39 UNREFERENCED_PARAMETER(cache); | |
40 | |
41 if (stubout_mode || sb_kind != NACL_SB_DEFAULT) { | |
Nick Bray
2012/04/19 23:11:08
Dito.
pasko-google - do not use
2012/04/20 14:30:38
Done.
| |
42 return NaClValidationFailedNotImplemented; | |
43 } | |
44 if (!NaClArchSupported(cpu_features)) { | |
45 return NaClValidationFailedCpuNotSupported; | |
46 } | |
47 if (!ValidateChunkAMD64(data, size, ProcessError, 0)) { | |
Nick Bray
2012/04/19 23:11:08
Dito.
pasko-google - do not use
2012/04/20 14:30:38
Done.
| |
48 return NaClValidationSucceeded; | |
49 } | |
50 return NaClValidationFailed; | |
51 } | |
OLD | NEW |