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

Side by Side Diff: src/arm/simulator-arm.cc

Issue 6598062: ARM: Fix unaligned read/write... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/codegen-arm.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 998
999 int Simulator::ReadW(int32_t addr, Instruction* instr) { 999 int Simulator::ReadW(int32_t addr, Instruction* instr) {
1000 #if V8_TARGET_CAN_READ_UNALIGNED 1000 #if V8_TARGET_CAN_READ_UNALIGNED
1001 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); 1001 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1002 return *ptr; 1002 return *ptr;
1003 #else 1003 #else
1004 if ((addr & 3) == 0) { 1004 if ((addr & 3) == 0) {
1005 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); 1005 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1006 return *ptr; 1006 return *ptr;
1007 } 1007 }
1008 PrintF("Unaligned read at 0x%08x, pc=%p\n", addr, instr); 1008 PrintF("Unaligned read at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1009 addr,
1010 reinterpret_cast<intptr_t>(instr));
1009 UNIMPLEMENTED(); 1011 UNIMPLEMENTED();
1010 return 0; 1012 return 0;
1011 #endif 1013 #endif
1012 } 1014 }
1013 1015
1014 1016
1015 void Simulator::WriteW(int32_t addr, int value, Instruction* instr) { 1017 void Simulator::WriteW(int32_t addr, int value, Instruction* instr) {
1016 #if V8_TARGET_CAN_READ_UNALIGNED 1018 #if V8_TARGET_CAN_READ_UNALIGNED
1017 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); 1019 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1018 *ptr = value; 1020 *ptr = value;
1019 return; 1021 return;
1020 #else 1022 #else
1021 if ((addr & 3) == 0) { 1023 if ((addr & 3) == 0) {
1022 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); 1024 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr);
1023 *ptr = value; 1025 *ptr = value;
1024 return; 1026 return;
1025 } 1027 }
1026 PrintF("Unaligned write at 0x%08x, pc=%p\n", addr, instr); 1028 PrintF("Unaligned write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1029 addr,
1030 reinterpret_cast<intptr_t>(instr));
1027 UNIMPLEMENTED(); 1031 UNIMPLEMENTED();
1028 #endif 1032 #endif
1029 } 1033 }
1030 1034
1031 1035
1032 uint16_t Simulator::ReadHU(int32_t addr, Instruction* instr) { 1036 uint16_t Simulator::ReadHU(int32_t addr, Instruction* instr) {
1033 #if V8_TARGET_CAN_READ_UNALIGNED 1037 #if V8_TARGET_CAN_READ_UNALIGNED
1034 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); 1038 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1035 return *ptr; 1039 return *ptr;
1036 #else 1040 #else
1037 if ((addr & 1) == 0) { 1041 if ((addr & 1) == 0) {
1038 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); 1042 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1039 return *ptr; 1043 return *ptr;
1040 } 1044 }
1041 PrintF("Unaligned unsigned halfword read at 0x%08x, pc=%p\n", addr, instr); 1045 PrintF("Unaligned unsigned halfword read at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1046 addr,
1047 reinterpret_cast<intptr_t>(instr));
1042 UNIMPLEMENTED(); 1048 UNIMPLEMENTED();
1043 return 0; 1049 return 0;
1044 #endif 1050 #endif
1045 } 1051 }
1046 1052
1047 1053
1048 int16_t Simulator::ReadH(int32_t addr, Instruction* instr) { 1054 int16_t Simulator::ReadH(int32_t addr, Instruction* instr) {
1049 #if V8_TARGET_CAN_READ_UNALIGNED 1055 #if V8_TARGET_CAN_READ_UNALIGNED
1050 int16_t* ptr = reinterpret_cast<int16_t*>(addr); 1056 int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1051 return *ptr; 1057 return *ptr;
(...skipping 13 matching lines...) Expand all
1065 #if V8_TARGET_CAN_READ_UNALIGNED 1071 #if V8_TARGET_CAN_READ_UNALIGNED
1066 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); 1072 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1067 *ptr = value; 1073 *ptr = value;
1068 return; 1074 return;
1069 #else 1075 #else
1070 if ((addr & 1) == 0) { 1076 if ((addr & 1) == 0) {
1071 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); 1077 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr);
1072 *ptr = value; 1078 *ptr = value;
1073 return; 1079 return;
1074 } 1080 }
1075 PrintF("Unaligned unsigned halfword write at 0x%08x, pc=%p\n", addr, instr); 1081 PrintF("Unaligned unsigned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1082 addr,
1083 reinterpret_cast<intptr_t>(instr));
1076 UNIMPLEMENTED(); 1084 UNIMPLEMENTED();
1077 #endif 1085 #endif
1078 } 1086 }
1079 1087
1080 1088
1081 void Simulator::WriteH(int32_t addr, int16_t value, Instruction* instr) { 1089 void Simulator::WriteH(int32_t addr, int16_t value, Instruction* instr) {
1082 #if V8_TARGET_CAN_READ_UNALIGNED 1090 #if V8_TARGET_CAN_READ_UNALIGNED
1083 int16_t* ptr = reinterpret_cast<int16_t*>(addr); 1091 int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1084 *ptr = value; 1092 *ptr = value;
1085 return; 1093 return;
1086 #else 1094 #else
1087 if ((addr & 1) == 0) { 1095 if ((addr & 1) == 0) {
1088 int16_t* ptr = reinterpret_cast<int16_t*>(addr); 1096 int16_t* ptr = reinterpret_cast<int16_t*>(addr);
1089 *ptr = value; 1097 *ptr = value;
1090 return; 1098 return;
1091 } 1099 }
1092 PrintF("Unaligned halfword write at 0x%08x, pc=%p\n", addr, instr); 1100 PrintF("Unaligned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n",
1101 addr,
1102 reinterpret_cast<intptr_t>(instr));
1093 UNIMPLEMENTED(); 1103 UNIMPLEMENTED();
1094 #endif 1104 #endif
1095 } 1105 }
1096 1106
1097 1107
1098 uint8_t Simulator::ReadBU(int32_t addr) { 1108 uint8_t Simulator::ReadBU(int32_t addr) {
1099 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); 1109 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr);
1100 return *ptr; 1110 return *ptr;
1101 } 1111 }
1102 1112
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 uintptr_t address = *stack_slot; 3152 uintptr_t address = *stack_slot;
3143 set_register(sp, current_sp + sizeof(uintptr_t)); 3153 set_register(sp, current_sp + sizeof(uintptr_t));
3144 return address; 3154 return address;
3145 } 3155 }
3146 3156
3147 } } // namespace v8::internal 3157 } } // namespace v8::internal
3148 3158
3149 #endif // USE_SIMULATOR 3159 #endif // USE_SIMULATOR
3150 3160
3151 #endif // V8_TARGET_ARCH_ARM 3161 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698