| OLD | NEW |
| 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 <map> | 8 #include <map> |
| 9 #include <set> | |
| 10 #include <vector> | 9 #include <vector> |
| 11 | 10 |
| 12 #include "sandbox/linux/seccomp-bpf/basicblock.h" | |
| 13 #include "sandbox/linux/seccomp-bpf/instruction.h" | |
| 14 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | 11 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
| 15 #include "sandbox/sandbox_export.h" | 12 #include "sandbox/sandbox_export.h" |
| 16 | 13 |
| 17 namespace sandbox { | 14 namespace sandbox { |
| 15 struct BasicBlock; |
| 16 class ErrorCode; |
| 17 struct Instruction; |
| 18 | 18 |
| 19 typedef std::vector<Instruction*> Instructions; | 19 typedef std::vector<Instruction*> Instructions; |
| 20 typedef std::vector<BasicBlock*> BasicBlocks; | 20 typedef std::vector<BasicBlock*> BasicBlocks; |
| 21 typedef std::map<const Instruction*, int> BranchTargets; | 21 typedef std::map<const Instruction*, int> BranchTargets; |
| 22 typedef std::map<const Instruction*, BasicBlock*> TargetsToBlocks; | 22 typedef std::map<const Instruction*, BasicBlock*> TargetsToBlocks; |
| 23 typedef std::map<const BasicBlock*, int> IncomingBranches; | 23 typedef std::map<const BasicBlock*, int> IncomingBranches; |
| 24 | 24 |
| 25 // The code generator instantiates a basic compiler that can convert a | 25 // The code generator instantiates a basic compiler that can convert a |
| 26 // graph of BPF instructions into a well-formed stream of BPF instructions. | 26 // graph of BPF instructions into a well-formed stream of BPF instructions. |
| 27 // Most notably, it ensures that jumps are always forward and don't exceed | 27 // Most notably, it ensures that jumps are always forward and don't exceed |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 BasicBlocks basic_blocks_; | 151 BasicBlocks basic_blocks_; |
| 152 | 152 |
| 153 // Compile() must only ever be called once as it makes destructive changes | 153 // Compile() must only ever be called once as it makes destructive changes |
| 154 // to the DAG. | 154 // to the DAG. |
| 155 bool compiled_; | 155 bool compiled_; |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 } // namespace sandbox | 158 } // namespace sandbox |
| 159 | 159 |
| 160 #endif // SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__ | 160 #endif // SANDBOX_LINUX_SECCOMP_BPF_CODEGEN_H__ |
| OLD | NEW |