Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: src/trusted/validator/x86/halt_trim.c

Issue 625923004: Delete old x86 validator. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: rebase master Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/validator/x86/halt_trim.h ('k') | src/trusted/validator/x86/halt_trim_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/validator/x86/halt_trim.c
diff --git a/src/trusted/validator/x86/halt_trim.c b/src/trusted/validator/x86/halt_trim.c
deleted file mode 100644
index 0e9c4e0f0b50850dd69450fb9152e9fa707600f9..0000000000000000000000000000000000000000
--- a/src/trusted/validator/x86/halt_trim.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2011 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.
- */
-
-#include "native_client/src/trusted/validator/x86/halt_trim.h"
-
-#include <stdio.h>
-#include "native_client/src/trusted/validator/x86/ncinstbuffer.h"
-
-/* Safety buffer size of halts we must keep, so that we guarantee
- * that we don't trim the last legal instruction in the
- * code segment. Note: we add 1 to the maximum instruction length just
- * to be safe.
- */
-static const NaClMemorySize kMinHaltKeepLength = MAX_INST_LENGTH + 1;
-
-/* x86 HALT opcode */
-static const uint8_t kNaClHalt = 0xf4;
-
-NaClMemorySize NCHaltTrimSize(uint8_t *mbase, NaClMemorySize sz,
- uint8_t alignment) {
- NaClMemorySize i;
- NaClMemorySize num_halts;
- for (i = sz - 1; i > 0; --i) {
- if (kNaClHalt != mbase[i]) break;
- }
- num_halts = sz - (i + 1);
- if (num_halts > kMinHaltKeepLength) {
- /* May be able to trim off trailing halts. */
- NaClMemorySize new_size;
- NaClMemorySize block_overflow;
- new_size = (sz - num_halts) + kMinHaltKeepLength;
- /* Round to nearest block alignment. */
- block_overflow = new_size % alignment;
- if (block_overflow) {
- new_size = new_size - block_overflow + alignment;
- }
- /* Never increase the segment size. */
- if (new_size < sz) {
- return new_size;
- }
- }
- /* No trim performed. */
- return sz;
-}
« no previous file with comments | « src/trusted/validator/x86/halt_trim.h ('k') | src/trusted/validator/x86/halt_trim_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698