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

Unified Diff: src/IceAssemblerARM32.h

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: 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 | « no previous file | src/IceAssemblerARM32.cpp » ('j') | src/IceAssemblerARM32.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssemblerARM32.h
diff --git a/src/IceAssemblerARM32.h b/src/IceAssemblerARM32.h
index 0dbff60651726a193515416843a116c8acc6a353..ff1e6ee553600c09be7ea865d985534565f97c9a 100644
--- a/src/IceAssemblerARM32.h
+++ b/src/IceAssemblerARM32.h
@@ -114,12 +114,10 @@ public:
void alignFunction() override {
const SizeT Align = 1 << getBundleAlignLog2Bytes();
SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align);
- constexpr IValueT UndefinedInst = 0xe7fedef0; // udf #60896
constexpr SizeT InstSize = sizeof(IValueT);
assert(BytesNeeded % InstARM32::InstSize == 0);
while (BytesNeeded > 0) {
- AssemblerBuffer::EnsureCapacity ensured(&Buffer);
- emitInst(UndefinedInst);
+ trap();
BytesNeeded -= InstSize;
}
}
@@ -129,10 +127,7 @@ public:
const char *getAlignDirective() const override { return ".p2alignl"; }
llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override {
- // Use a particular UDF encoding -- TRAPNaCl in LLVM: 0xE7FEDEF0
- // http://llvm.org/viewvc/llvm-project?view=revision&revision=173943
- static const uint8_t Padding[] = {0xE7, 0xFE, 0xDE, 0xF0};
- return llvm::ArrayRef<uint8_t>(Padding, 4);
+ return llvm::ArrayRef<uint8_t>(TrapInst, 4);
Jim Stichnoth 2015/12/11 23:31:08 Can you move the implementation into the .cpp file
Karl 2015/12/17 16:23:09 Done.
}
void padWithNop(intptr_t Padding) override;
@@ -287,6 +282,8 @@ public:
// Implements sxtb/sxth depending on type of OpSrc0.
void sxt(const Operand *OpRd, const Operand *OpSrc0, CondARM32::Cond Cond);
+ void trap();
+
void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond);
void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
@@ -313,6 +310,8 @@ private:
// Number of bytes emitted by InstARM32::emit() methods, when run inside
// InstARM32::emitUsingTextFixup().
size_t EmitTextSize = 0;
+ // Trap instruction (defined in textual byte order).
Jim Stichnoth 2015/12/11 23:31:08 "textual"? Maybe "little-endian" instead?
Karl 2015/12/17 16:23:09 Done.
+ static const uint8_t TrapInst[];
// Load/store multiple addressing mode.
enum BlockAddressMode {
« no previous file with comments | « no previous file | src/IceAssemblerARM32.cpp » ('j') | src/IceAssemblerARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698