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

Side by Side Diff: src/minsfi/trusted/state.c

Issue 539683002: MinSFI: Add loader (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Fixed nits Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/minsfi/trusted/loader.c ('k') | tests/minsfi/nacl.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014 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 #include <string.h>
7
8 #include "native_client/src/include/minsfi_priv.h"
9
10 /*
11 * This is the memory base variable which the SFI-sandboxed pointers are
12 * treated relative to. It is defined in the trusted runtime, exported and then
13 * imported by the untrusted code via the compiler transforms. It is a 64-bit
14 * unsigned integer on both 32-bit and 64-bit platforms. See comments in the
15 * SandboxMemoryAccesses MinSFI LLVM pass for more details.
16 */
17 uint64_t __sfi_memory_base = 0;
18
19 static MinsfiSandbox ActiveSandbox = { .mem_base = NULL };
20
21 const MinsfiSandbox *MinsfiGetActiveSandbox(void) {
22 if (ActiveSandbox.mem_base != NULL)
23 return &ActiveSandbox;
24 else
25 return NULL;
26 }
27
28 void MinsfiSetActiveSandbox(const MinsfiSandbox *sb) {
29 if (sb != NULL)
30 memcpy(&ActiveSandbox, sb, sizeof(MinsfiSandbox));
31 else
32 ActiveSandbox.mem_base = NULL;
33
34 __sfi_memory_base = (uintptr_t) ActiveSandbox.mem_base;
35 }
OLDNEW
« no previous file with comments | « src/minsfi/trusted/loader.c ('k') | tests/minsfi/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698