Index: src/trusted/validator_ragel/unreviewed/dfa_validate_64.c |
diff --git a/src/trusted/validator_ragel/unreviewed/dfa_validate_64.c b/src/trusted/validator_ragel/unreviewed/dfa_validate_64.c |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6aed991415f76764f7d6e81e3b813777f6338413 |
--- /dev/null |
+++ b/src/trusted/validator_ragel/unreviewed/dfa_validate_64.c |
@@ -0,0 +1,51 @@ |
+/* |
+ * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+/* Implement the ApplyDfaValidator API for the x86-64 architecture. */ |
+#include <assert.h> |
+#include "native_client/src/shared/platform/nacl_log.h" |
+#include "native_client/src/trusted/validator/ncvalidate.h" |
+#include "native_client/src/trusted/validator/validation_cache.h" |
+#include "native_client/src/trusted/validator_ragel/unreviewed/validator.h" |
+ |
+/* Be sure the correct compile flags are defined for this. */ |
+#if NACL_ARCH(NACL_TARGET_ARCH) != NACL_x86 |
+# error("Can't compile, target is for x86-64") |
+#else |
+# if NACL_TARGET_SUBARCH != 64 |
+# error("Can't compile, target is for x86-64") |
+# endif |
+#endif |
+ |
+static void ProcessError(const uint8_t *ptr, void *userdata) { |
+ UNREFERENCED_PARAMETER(ptr); |
+ UNREFERENCED_PARAMETER(userdata); |
+} |
+ |
+NaClValidationStatus NACL_SUBARCH_NAME(ApplyDfaValidator, x86, 64) ( |
+ enum NaClSBKind sb_kind, |
+ uintptr_t guest_addr, |
+ uint8_t *data, |
+ size_t size, |
+ int stubout_mode, |
+ int readonly_text, |
+ const NaClCPUFeaturesX86 *cpu_features, |
+ struct NaClValidationCache *cache) { |
+ UNREFERENCED_PARAMETER(guest_addr); |
+ 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.
|
+ UNREFERENCED_PARAMETER(cache); |
+ |
+ 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.
|
+ return NaClValidationFailedNotImplemented; |
+ } |
+ if (!NaClArchSupported(cpu_features)) { |
+ return NaClValidationFailedCpuNotSupported; |
+ } |
+ 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.
|
+ return NaClValidationSucceeded; |
+ } |
+ return NaClValidationFailed; |
+} |