OLD | NEW |
1 // Copyright 2009 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 28 matching lines...) Expand all Loading... |
40 namespace assembler { | 40 namespace assembler { |
41 namespace arm { | 41 namespace arm { |
42 | 42 |
43 using ::v8::internal::Object; | 43 using ::v8::internal::Object; |
44 using ::v8::internal::PrintF; | 44 using ::v8::internal::PrintF; |
45 using ::v8::internal::OS; | 45 using ::v8::internal::OS; |
46 using ::v8::internal::ReadLine; | 46 using ::v8::internal::ReadLine; |
47 using ::v8::internal::DeleteArray; | 47 using ::v8::internal::DeleteArray; |
48 | 48 |
49 // This macro provides a platform independent use of sscanf. The reason for | 49 // This macro provides a platform independent use of sscanf. The reason for |
50 // SScanF not being implemented in a platform independent was through | 50 // SScanF not being implemented in a platform independent way through |
51 // ::v8::internal::OS in the same way as SNPrintF is that the Windows C Run-Time | 51 // ::v8::internal::OS in the same way as SNPrintF is that the |
52 // Library does not provide vsscanf. | 52 // Windows C Run-Time Library does not provide vsscanf. |
53 #define SScanF sscanf // NOLINT | 53 #define SScanF sscanf // NOLINT |
54 | 54 |
55 // The Debugger class is used by the simulator while debugging simulated ARM | 55 // The Debugger class is used by the simulator while debugging simulated ARM |
56 // code. | 56 // code. |
57 class Debugger { | 57 class Debugger { |
58 public: | 58 public: |
59 explicit Debugger(Simulator* sim); | 59 explicit Debugger(Simulator* sim); |
60 ~Debugger(); | 60 ~Debugger(); |
61 | 61 |
62 void Stop(Instr* instr); | 62 void Stop(Instr* instr); |
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 UNIMPLEMENTED(); // Not used by V8. | 2026 UNIMPLEMENTED(); // Not used by V8. |
2027 } | 2027 } |
2028 } | 2028 } |
2029 } | 2029 } |
2030 | 2030 |
2031 | 2031 |
2032 // void Simulator::DecodeType6CoprocessorIns(Instr* instr) | 2032 // void Simulator::DecodeType6CoprocessorIns(Instr* instr) |
2033 // Decode Type 6 coprocessor instructions. | 2033 // Decode Type 6 coprocessor instructions. |
2034 // Dm = vmov(Rt, Rt2) | 2034 // Dm = vmov(Rt, Rt2) |
2035 // <Rt, Rt2> = vmov(Dm) | 2035 // <Rt, Rt2> = vmov(Dm) |
| 2036 // Ddst = MEM(Rbase + 4*offset). |
| 2037 // MEM(Rbase + 4*offset) = Dsrc. |
2036 void Simulator::DecodeType6CoprocessorIns(Instr* instr) { | 2038 void Simulator::DecodeType6CoprocessorIns(Instr* instr) { |
2037 ASSERT((instr->TypeField() == 6)); | 2039 ASSERT((instr->TypeField() == 6)); |
2038 | 2040 |
2039 int rt = instr->RtField(); | 2041 if (instr->CoprocessorField() != 0xB) { |
2040 int rn = instr->RnField(); | 2042 UNIMPLEMENTED(); // Not used by V8. |
2041 int vm = instr->VmField(); | 2043 } else { |
| 2044 switch (instr->OpcodeField()) { |
| 2045 case 0x2: |
| 2046 // Load and store double to two GP registers |
| 2047 if (instr->Bits(7, 4) != 0x1) { |
| 2048 UNIMPLEMENTED(); // Not used by V8. |
| 2049 } else { |
| 2050 int rt = instr->RtField(); |
| 2051 int rn = instr->RnField(); |
| 2052 int vm = instr->VmField(); |
| 2053 if (instr->HasL()) { |
| 2054 int32_t rt_int_value = get_sinteger_from_s_register(2*vm); |
| 2055 int32_t rn_int_value = get_sinteger_from_s_register(2*vm+1); |
2042 | 2056 |
2043 if (instr->Bit(23) == 1) { | 2057 set_register(rt, rt_int_value); |
2044 UNIMPLEMENTED(); | 2058 set_register(rn, rn_int_value); |
2045 } else if (instr->Bit(22) == 1) { | 2059 } else { |
2046 if ((instr->Bits(27, 24) == 0xC) && | 2060 int32_t rs_val = get_register(rt); |
2047 (instr->Bit(22) == 1) && | 2061 int32_t rn_val = get_register(rn); |
2048 (instr->Bits(11, 8) == 0xB) && | |
2049 (instr->Bits(7, 6) == 0x0) && | |
2050 (instr->Bit(4) == 1)) { | |
2051 if (instr->Bit(20) == 0) { | |
2052 int32_t rs_val = get_register(rt); | |
2053 int32_t rn_val = get_register(rn); | |
2054 | 2062 |
2055 set_s_register_from_sinteger(2*vm, rs_val); | 2063 set_s_register_from_sinteger(2*vm, rs_val); |
2056 set_s_register_from_sinteger((2*vm+1), rn_val); | 2064 set_s_register_from_sinteger((2*vm+1), rn_val); |
2057 | 2065 } |
2058 } else if (instr->Bit(20) == 1) { | 2066 } |
2059 int32_t rt_int_value = get_sinteger_from_s_register(2*vm); | 2067 break; |
2060 int32_t rn_int_value = get_sinteger_from_s_register(2*vm+1); | 2068 case 0x8: |
2061 | 2069 case 0xC: { // Load and store double to memory. |
2062 set_register(rt, rt_int_value); | 2070 int rn = instr->RnField(); |
2063 set_register(rn, rn_int_value); | 2071 int vd = instr->VdField(); |
| 2072 int offset = instr->Immed8Field(); |
| 2073 if (!instr->HasU()) { |
| 2074 offset = -offset; |
| 2075 } |
| 2076 int32_t address = get_register(rn) + 4 * offset; |
| 2077 if (instr->HasL()) { |
| 2078 // Load double from memory: vldr. |
| 2079 set_s_register_from_sinteger(2*vd, ReadW(address, instr)); |
| 2080 set_s_register_from_sinteger(2*vd + 1, ReadW(address + 4, instr)); |
| 2081 } else { |
| 2082 // Store double to memory: vstr. |
| 2083 WriteW(address, get_sinteger_from_s_register(2*vd), instr); |
| 2084 WriteW(address + 4, get_sinteger_from_s_register(2*vd + 1), instr); |
| 2085 } |
| 2086 break; |
2064 } | 2087 } |
2065 } else { | 2088 default: |
2066 UNIMPLEMENTED(); | 2089 UNIMPLEMENTED(); // Not used by V8. |
| 2090 break; |
2067 } | 2091 } |
2068 } else if (instr->Bit(21) == 1) { | |
2069 UNIMPLEMENTED(); | |
2070 } else { | |
2071 UNIMPLEMENTED(); | |
2072 } | 2092 } |
2073 } | 2093 } |
2074 | 2094 |
2075 | 2095 |
2076 // Executes the current instruction. | 2096 // Executes the current instruction. |
2077 void Simulator::InstructionDecode(Instr* instr) { | 2097 void Simulator::InstructionDecode(Instr* instr) { |
2078 pc_modified_ = false; | 2098 pc_modified_ = false; |
2079 if (::v8::internal::FLAG_trace_sim) { | 2099 if (::v8::internal::FLAG_trace_sim) { |
2080 disasm::NameConverter converter; | 2100 disasm::NameConverter converter; |
2081 disasm::Disassembler dasm(converter); | 2101 disasm::Disassembler dasm(converter); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); | 2286 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); |
2267 uintptr_t address = *stack_slot; | 2287 uintptr_t address = *stack_slot; |
2268 set_register(sp, current_sp + sizeof(uintptr_t)); | 2288 set_register(sp, current_sp + sizeof(uintptr_t)); |
2269 return address; | 2289 return address; |
2270 } | 2290 } |
2271 | 2291 |
2272 | 2292 |
2273 } } // namespace assembler::arm | 2293 } } // namespace assembler::arm |
2274 | 2294 |
2275 #endif // !defined(__arm__) | 2295 #endif // !defined(__arm__) |
OLD | NEW |