Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #if defined(TARGET_ARCH_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
| 10 | 10 |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 | 1218 |
| 1219 void Simulator::ClearExclusive() { | 1219 void Simulator::ClearExclusive() { |
| 1220 MutexLocker ml(exclusive_access_lock_); | 1220 MutexLocker ml(exclusive_access_lock_); |
| 1221 // Remove the reservation for this thread. | 1221 // Remove the reservation for this thread. |
| 1222 SetExclusiveAccess(NULL); | 1222 SetExclusiveAccess(NULL); |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 | 1225 |
| 1226 intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { | 1226 intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { |
|
zra
2016/02/25 04:02:35
Hmm. Should this be int32_t? ReadW returns int32_t
rmacnak
2016/02/25 23:31:46
Changed this to ReadExclusiveX using ReadX.
| |
| 1227 MutexLocker ml(exclusive_access_lock_); | 1227 MutexLocker ml(exclusive_access_lock_); |
| 1228 SetExclusiveAccess(addr); | 1228 SetExclusiveAccess(addr); |
| 1229 return ReadW(addr, instr); | 1229 return ReadW(addr, instr); |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 | 1232 |
| 1233 intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { | 1233 intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { |
| 1234 MutexLocker ml(exclusive_access_lock_); | 1234 MutexLocker ml(exclusive_access_lock_); |
| 1235 bool write_allowed = HasExclusiveAccessAndOpen(addr); | 1235 bool write_allowed = HasExclusiveAccessAndOpen(addr); |
| 1236 if (write_allowed) { | 1236 if (write_allowed) { |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2157 if (instr->Bit(30)) { | 2157 if (instr->Bit(30)) { |
| 2158 // Format(instr, "ldrx 'rt, 'pcldr"); | 2158 // Format(instr, "ldrx 'rt, 'pcldr"); |
| 2159 set_register(instr, rt, val, R31IsZR); | 2159 set_register(instr, rt, val, R31IsZR); |
| 2160 } else { | 2160 } else { |
| 2161 // Format(instr, "ldrw 'rt, 'pcldr"); | 2161 // Format(instr, "ldrw 'rt, 'pcldr"); |
| 2162 set_wregister(rt, static_cast<int32_t>(val), R31IsZR); | 2162 set_wregister(rt, static_cast<int32_t>(val), R31IsZR); |
| 2163 } | 2163 } |
| 2164 } | 2164 } |
| 2165 | 2165 |
| 2166 | 2166 |
| 2167 void Simulator::DecodeLoadStoreExclusive(Instr* instr) { | |
| 2168 if ((instr->Bit(23) != 0) || | |
| 2169 (instr->Bit(21) != 0) || | |
| 2170 (instr->Bit(15) != 0)) { | |
| 2171 UNIMPLEMENTED(); | |
| 2172 } | |
| 2173 const int32_t size = instr->Bits(30, 2); | |
| 2174 if (size != 3) { | |
| 2175 UNIMPLEMENTED(); | |
| 2176 } | |
| 2177 | |
| 2178 const Register rs = instr->RsField(); | |
| 2179 const Register rn = instr->RnField(); | |
| 2180 const Register rt = instr->RtField(); | |
| 2181 const bool is_load = instr->Bit(22) == 1; | |
| 2182 if (is_load) { | |
| 2183 // Format(instr, "ldxr 'rt, 'rn"); | |
| 2184 const int64_t addr = get_register(rn, R31IsSP); | |
| 2185 intptr_t value = ReadExclusiveW(addr, instr); | |
|
zra
2016/02/25 04:02:35
int64_t calling ReadExclusiveX?
rmacnak
2016/02/25 23:31:46
Done.
| |
| 2186 set_register(instr, rt, value, R31IsSP); | |
| 2187 } else { | |
| 2188 // Format(instr, "stxr 'rs, 'rt, 'rn"); | |
| 2189 uword value = get_register(rt, R31IsSP); | |
| 2190 uword addr = get_register(rn, R31IsSP); | |
| 2191 intptr_t status = WriteExclusiveW(addr, value, instr); | |
| 2192 set_register(instr, rs, status, R31IsSP); | |
| 2193 } | |
| 2194 } | |
| 2195 | |
| 2196 | |
| 2167 void Simulator::DecodeLoadStore(Instr* instr) { | 2197 void Simulator::DecodeLoadStore(Instr* instr) { |
| 2168 if (instr->IsLoadStoreRegOp()) { | 2198 if (instr->IsLoadStoreRegOp()) { |
| 2169 DecodeLoadStoreReg(instr); | 2199 DecodeLoadStoreReg(instr); |
| 2170 } else if (instr->IsLoadStoreRegPairOp()) { | 2200 } else if (instr->IsLoadStoreRegPairOp()) { |
| 2171 DecodeLoadStoreRegPair(instr); | 2201 DecodeLoadStoreRegPair(instr); |
| 2172 } else if (instr->IsLoadRegLiteralOp()) { | 2202 } else if (instr->IsLoadRegLiteralOp()) { |
| 2173 DecodeLoadRegLiteral(instr); | 2203 DecodeLoadRegLiteral(instr); |
| 2204 } else if (instr->IsLoadStoreExclusiveOp()) { | |
| 2205 DecodeLoadStoreExclusive(instr); | |
| 2174 } else { | 2206 } else { |
| 2175 UnimplementedInstruction(instr); | 2207 UnimplementedInstruction(instr); |
| 2176 } | 2208 } |
| 2177 } | 2209 } |
| 2178 | 2210 |
| 2179 | 2211 |
| 2180 int64_t Simulator::ShiftOperand(uint8_t reg_size, | 2212 int64_t Simulator::ShiftOperand(uint8_t reg_size, |
| 2181 int64_t value, | 2213 int64_t value, |
| 2182 Shift shift_type, | 2214 Shift shift_type, |
| 2183 uint8_t amount) { | 2215 uint8_t amount) { |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3568 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3600 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
| 3569 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3601 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
| 3570 buf->Longjmp(); | 3602 buf->Longjmp(); |
| 3571 } | 3603 } |
| 3572 | 3604 |
| 3573 } // namespace dart | 3605 } // namespace dart |
| 3574 | 3606 |
| 3575 #endif // !defined(USING_SIMULATOR) | 3607 #endif // !defined(USING_SIMULATOR) |
| 3576 | 3608 |
| 3577 #endif // defined TARGET_ARCH_ARM64 | 3609 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |