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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 1559243002: Suzero. X8664. NaCl Sandboxing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes filetype=asm; addresses comments. Created 4 years, 11 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/IceTargetLoweringX8632.h ('k') | src/IceTargetLoweringX8632Traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 4a64b4a9f0a9649cb7f8b1eeba9f6f29f77e1694..209db7c7c33c5c0657e0d72ed2d435a61d11fa97 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -130,6 +130,33 @@ FixupKind TargetX86Base<X8632::Traits>::AbsFixup =
// \/_____/\/_____/\/_/ \/_/\/_____/\/_/ /_/\/_/\/_/ \/_/\/_____/
//
//------------------------------------------------------------------------------
+void TargetX8632::_add_sp(Operand *Adjustment) {
+ Variable *esp = getPhysicalRegister(Traits::RegisterSet::Reg_esp);
+ _add(esp, Adjustment);
+}
+
+void TargetX8632::_mov_sp(Operand *NewValue) {
+ Variable *esp = getPhysicalRegister(Traits::RegisterSet::Reg_esp);
+ _redefined(_mov(esp, NewValue));
+}
+
+void TargetX8632::_sub_sp(Operand *Adjustment) {
+ Variable *esp = getPhysicalRegister(Traits::RegisterSet::Reg_esp);
+ _sub(esp, Adjustment);
+}
+
+void TargetX8632::lowerIndirectJump(Variable *JumpTarget) {
+ if (NeedSandboxing) {
+ _bundle_lock();
+ const SizeT BundleSize =
+ 1 << Func->getAssembler<>()->getBundleAlignLog2Bytes();
+ _and(JumpTarget, Ctx->getConstantInt32(~(BundleSize - 1)));
+ }
+ _jmp(JumpTarget);
+ if (NeedSandboxing)
+ _bundle_unlock();
+}
+
void TargetX8632::lowerCall(const InstCall *Instr) {
// x86-32 calling convention:
//
@@ -253,7 +280,6 @@ void TargetX8632::lowerCall(const InstCall *Instr) {
}
Operand *CallTarget =
legalize(Instr->getCallTarget(), Legal_Reg | Legal_Imm | Legal_AddrAbs);
- const bool NeedSandboxing = Ctx->getFlags().getUseSandboxing();
if (NeedSandboxing) {
if (llvm::isa<Constant>(CallTarget)) {
_bundle_lock(InstBundleLock::Opt_AlignToEnd);
@@ -723,7 +749,7 @@ void TargetX8632::addEpilog(CfgNode *Node) {
}
}
- if (!Ctx->getFlags().getUseSandboxing())
+ if (!NeedSandboxing)
return;
// Change the original ret instruction into a sandboxed return sequence.
// t:ecx = pop
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | src/IceTargetLoweringX8632Traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698