OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2640 } else { | 2640 } else { |
2641 if (instr->HasL()) { | 2641 if (instr->HasL()) { |
2642 set_register(rd, ReadW(addr, instr)); | 2642 set_register(rd, ReadW(addr, instr)); |
2643 } else { | 2643 } else { |
2644 WriteW(addr, get_register(rd), instr); | 2644 WriteW(addr, get_register(rd), instr); |
2645 } | 2645 } |
2646 } | 2646 } |
2647 } | 2647 } |
2648 | 2648 |
2649 | 2649 |
2650 static uint32_t ReverseBits(uint32_t value) { | |
titzer
2016/02/14 11:18:34
Good candidate for src/base/bits.cc?
Rodolph Perfetta
2016/02/15 17:56:01
Done.
| |
2651 uint32_t result = 0; | |
2652 for (unsigned i = 0; i < 32; ++i) { | |
2653 result = (result << 1) | (value & 1); | |
2654 value >>= 1; | |
2655 } | |
2656 return result; | |
2657 } | |
2658 | |
2659 | |
2650 void Simulator::DecodeType3(Instruction* instr) { | 2660 void Simulator::DecodeType3(Instruction* instr) { |
2651 int rd = instr->RdValue(); | 2661 int rd = instr->RdValue(); |
2652 int rn = instr->RnValue(); | 2662 int rn = instr->RnValue(); |
2653 int32_t rn_val = get_register(rn); | 2663 int32_t rn_val = get_register(rn); |
2654 bool shifter_carry_out = 0; | 2664 bool shifter_carry_out = 0; |
2655 int32_t shifter_operand = GetShiftRm(instr, &shifter_carry_out); | 2665 int32_t shifter_operand = GetShiftRm(instr, &shifter_carry_out); |
2656 int32_t addr = 0; | 2666 int32_t addr = 0; |
2657 switch (instr->PUField()) { | 2667 switch (instr->PUField()) { |
2658 case da_x: { | 2668 case da_x: { |
2659 DCHECK(!instr->HasW()); | 2669 DCHECK(!instr->HasW()); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2913 rm_val = (rm_val >> 16) | (rm_val << 16); | 2923 rm_val = (rm_val >> 16) | (rm_val << 16); |
2914 break; | 2924 break; |
2915 case 3: | 2925 case 3: |
2916 rm_val = (rm_val >> 24) | (rm_val << 8); | 2926 rm_val = (rm_val >> 24) | (rm_val << 8); |
2917 break; | 2927 break; |
2918 } | 2928 } |
2919 set_register(rd, rn_val + (rm_val & 0xFFFF)); | 2929 set_register(rd, rn_val + (rm_val & 0xFFFF)); |
2920 } | 2930 } |
2921 } | 2931 } |
2922 } else { | 2932 } else { |
2923 UNIMPLEMENTED(); | 2933 // PU == 0b01, BW == 0b11, Bits(9, 6) != 0b0001 |
2934 if ((instr->Bits(20, 16) == 0x1f) && | |
2935 (instr->Bits(11, 4) == 0xf3)) { | |
2936 // Rbit. | |
2937 uint32_t rm_val = get_register(instr->RmValue()); | |
2938 set_register(rd, ReverseBits(rm_val)); | |
2939 } else { | |
2940 UNIMPLEMENTED(); | |
2941 } | |
2924 } | 2942 } |
2925 break; | 2943 break; |
2926 } | 2944 } |
2927 } | 2945 } |
2928 return; | 2946 return; |
2929 } | 2947 } |
2930 break; | 2948 break; |
2931 } | 2949 } |
2932 case db_x: { | 2950 case db_x: { |
2933 if (instr->Bits(22, 20) == 0x5) { | 2951 if (instr->Bits(22, 20) == 0x5) { |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4215 set_register(sp, current_sp + sizeof(uintptr_t)); | 4233 set_register(sp, current_sp + sizeof(uintptr_t)); |
4216 return address; | 4234 return address; |
4217 } | 4235 } |
4218 | 4236 |
4219 } // namespace internal | 4237 } // namespace internal |
4220 } // namespace v8 | 4238 } // namespace v8 |
4221 | 4239 |
4222 #endif // USE_SIMULATOR | 4240 #endif // USE_SIMULATOR |
4223 | 4241 |
4224 #endif // V8_TARGET_ARCH_ARM | 4242 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |