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

Side by Side Diff: sandbox/linux/seccomp-bpf/codegen.h

Issue 693943003: Update from https://crrev.com/302630 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sandbox/linux/sandbox_linux_test_sources.gypi ('k') | sandbox/linux/seccomp-bpf/codegen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__
6 #define SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__ 6 #define SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // 56 //
57 class SANDBOX_EXPORT CodeGen { 57 class SANDBOX_EXPORT CodeGen {
58 public: 58 public:
59 // A vector of BPF instructions that need to be installed as a filter 59 // A vector of BPF instructions that need to be installed as a filter
60 // program in the kernel. 60 // program in the kernel.
61 typedef std::vector<struct sock_filter> Program; 61 typedef std::vector<struct sock_filter> Program;
62 62
63 CodeGen(); 63 CodeGen();
64 ~CodeGen(); 64 ~CodeGen();
65 65
66 // This is a helper method that can be used for debugging purposes. It is
67 // not normally called.
68 static void PrintProgram(const Program& program);
69
70 // Create a new instruction. Instructions form a DAG. The instruction objects 66 // Create a new instruction. Instructions form a DAG. The instruction objects
71 // are owned by the CodeGen object. They do not need to be explicitly 67 // are owned by the CodeGen object. They do not need to be explicitly
72 // deleted. 68 // deleted.
73 // For details on the possible parameters refer to <linux/filter.h> 69 // For details on the possible parameters refer to <linux/filter.h>
74 Instruction* MakeInstruction(uint16_t code, 70 Instruction* MakeInstruction(uint16_t code,
75 uint32_t k, 71 uint32_t k,
76 Instruction* next = nullptr); 72 Instruction* next = nullptr);
77 Instruction* MakeInstruction(uint16_t code, 73 Instruction* MakeInstruction(uint16_t code,
78 uint32_t k, 74 uint32_t k,
79 Instruction* jt, 75 Instruction* jt,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 BasicBlocks basic_blocks_; 138 BasicBlocks basic_blocks_;
143 139
144 // Compile() must only ever be called once as it makes destructive changes 140 // Compile() must only ever be called once as it makes destructive changes
145 // to the DAG. 141 // to the DAG.
146 bool compiled_; 142 bool compiled_;
147 }; 143 };
148 144
149 } // namespace sandbox 145 } // namespace sandbox
150 146
151 #endif // SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__ 147 #endif // SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__
OLDNEW
« no previous file with comments | « sandbox/linux/sandbox_linux_test_sources.gypi ('k') | sandbox/linux/seccomp-bpf/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698