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

Unified Diff: src/IceAssemblerARM32.cpp

Issue 1519873003: Add trap (an UDF instruction) to the ARM integrated Assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Clean up modeling of trap instruction. Created 5 years 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/IceAssemblerARM32.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssemblerARM32.cpp
diff --git a/src/IceAssemblerARM32.cpp b/src/IceAssemblerARM32.cpp
index 0d5dc380efc64a554729e9ad491b814f2538e76e..cddc6c97909c0aa43f5a3b19a5f4ae96e033dbaa 100644
--- a/src/IceAssemblerARM32.cpp
+++ b/src/IceAssemblerARM32.cpp
@@ -1873,6 +1873,27 @@ void AssemblerARM32::sub(const Operand *OpRd, const Operand *OpRn,
SubName);
}
+namespace {
+
+// Use a particular UDF encoding -- TRAPNaCl in LLVM: 0xE7FEDEF0
+// http://llvm.org/viewvc/llvm-project?view=revision&revision=173943
+const uint8_t TrapBytesRaw[] = {0xE7, 0xFE, 0xDE, 0xF0};
+
+const auto TrapBytes =
+ llvm::ArrayRef<uint8_t>(TrapBytesRaw, llvm::array_lengthof(TrapBytesRaw));
+
+} // end of anonymous namespace
+
+llvm::ArrayRef<uint8_t> AssemblerARM32::getNonExecBundlePadding() const {
+ return TrapBytes;
+}
+
+void AssemblerARM32::trap() {
+ AssemblerBuffer::EnsureCapacity ensured(&Buffer);
+ for (const uint8_t &Byte : reverse_range(TrapBytes))
+ Buffer.emit<uint8_t>(Byte);
+}
+
void AssemblerARM32::tst(const Operand *OpRn, const Operand *OpSrc1,
CondARM32::Cond Cond) {
// TST (register) - ARM section A8.8.241, encoding A1:
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698