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

Side by Side Diff: src/ppc/assembler-ppc-inl.h

Issue 1239583002: PPC: protect against malformed branch and memory access instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/ppc/assembler-ppc.cc ('k') | no next file » | 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) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 590 }
591 return offset; 591 return offset;
592 } 592 }
593 593
594 594
595 void Assembler::PatchConstantPoolAccessInstruction( 595 void Assembler::PatchConstantPoolAccessInstruction(
596 int pc_offset, int offset, ConstantPoolEntry::Access access, 596 int pc_offset, int offset, ConstantPoolEntry::Access access,
597 ConstantPoolEntry::Type type) { 597 ConstantPoolEntry::Type type) {
598 Address pc = buffer_ + pc_offset; 598 Address pc = buffer_ + pc_offset;
599 bool overflowed = (access == ConstantPoolEntry::OVERFLOWED); 599 bool overflowed = (access == ConstantPoolEntry::OVERFLOWED);
600 CHECK(overflowed != is_int16(offset));
600 #ifdef DEBUG 601 #ifdef DEBUG
601 ConstantPoolEntry::Access access_check = 602 ConstantPoolEntry::Access access_check =
602 static_cast<ConstantPoolEntry::Access>(-1); 603 static_cast<ConstantPoolEntry::Access>(-1);
603 DCHECK(IsConstantPoolLoadStart(pc, &access_check)); 604 DCHECK(IsConstantPoolLoadStart(pc, &access_check));
604 DCHECK(access_check == access); 605 DCHECK(access_check == access);
605 DCHECK(overflowed != is_int16(offset));
606 #endif 606 #endif
607 if (overflowed) { 607 if (overflowed) {
608 int hi_word = static_cast<int>(offset >> 16); 608 int hi_word = static_cast<int>(offset >> 16);
609 int lo_word = static_cast<int>(offset & 0xffff); 609 int lo_word = static_cast<int>(offset & 0xffff);
610 if (lo_word & 0x8000) hi_word++; 610 if (lo_word & 0x8000) hi_word++;
611 611
612 Instr instr1 = instr_at(pc); 612 Instr instr1 = instr_at(pc);
613 Instr instr2 = instr_at(pc + kInstrSize); 613 Instr instr2 = instr_at(pc + kInstrSize);
614 instr1 &= ~kImm16Mask; 614 instr1 &= ~kImm16Mask;
615 instr1 |= (hi_word & kImm16Mask); 615 instr1 |= (hi_word & kImm16Mask);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 721 }
722 #endif 722 #endif
723 return; 723 return;
724 } 724 }
725 UNREACHABLE(); 725 UNREACHABLE();
726 } 726 }
727 } 727 }
728 } // namespace v8::internal 728 } // namespace v8::internal
729 729
730 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_ 730 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_
OLDNEW
« no previous file with comments | « src/ppc/assembler-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698