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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
893 } | 893 } |
894 return simulator; | 894 return simulator; |
895 } | 895 } |
896 | 896 |
897 | 897 |
898 // Sets the register in the architecture state. | 898 // Sets the register in the architecture state. |
899 void Simulator::set_register( | 899 void Simulator::set_register( |
900 Instr* instr, Register reg, int64_t value, R31Type r31t) { | 900 Instr* instr, Register reg, int64_t value, R31Type r31t) { |
901 // Register is in range. | 901 // Register is in range. |
902 ASSERT((reg >= 0) && (reg < kNumberOfCpuRegisters)); | 902 ASSERT((reg >= 0) && (reg < kNumberOfCpuRegisters)); |
903 ASSERT(instr == NULL || reg != R18); // R18 is globally reserved on iOS. | |
903 if ((reg != R31) || (r31t != R31IsZR)) { | 904 if ((reg != R31) || (r31t != R31IsZR)) { |
904 registers_[reg] = value; | 905 registers_[reg] = value; |
905 // If we're setting CSP, make sure it is 16-byte aligned. In truth, CSP | 906 // If we're setting CSP, make sure it is 16-byte aligned. In truth, CSP |
906 // can store addresses that are not 16-byte aligned, but loads and stores | 907 // can store addresses that are not 16-byte aligned, but loads and stores |
907 // are not allowed through CSP when it is not aligned. Thus, this check is | 908 // are not allowed through CSP when it is not aligned. Thus, this check is |
908 // more conservative that necessary. However, it will likely be more | 909 // more conservative that necessary. However, it will likely be more |
909 // useful to find the program locations where CSP is set to a bad value, | 910 // useful to find the program locations where CSP is set to a bad value, |
910 // than to find only the resulting loads/stores that would cause a fault on | 911 // than to find only the resulting loads/stores that would cause a fault on |
911 // hardware. | 912 // hardware. |
912 if ((instr != NULL) && (reg == R31) && !Utils::IsAligned(value, 16)) { | 913 if ((instr != NULL) && (reg == R31) && !Utils::IsAligned(value, 16)) { |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1643 reinterpret_cast<SimulatorNativeCall>(external); | 1644 reinterpret_cast<SimulatorNativeCall>(external); |
1644 target(arguments, target_func); | 1645 target(arguments, target_func); |
1645 // Zap result register from void function. | 1646 // Zap result register from void function. |
1646 set_register(instr, R0, icount_); | 1647 set_register(instr, R0, icount_); |
1647 set_register(instr, R1, icount_); | 1648 set_register(instr, R1, icount_); |
1648 } | 1649 } |
1649 set_top_exit_frame_info(0); | 1650 set_top_exit_frame_info(0); |
1650 | 1651 |
1651 // Zap caller-saved registers, since the actual runtime call could have | 1652 // Zap caller-saved registers, since the actual runtime call could have |
1652 // used them. | 1653 // used them. |
1653 set_register(instr, R2, icount_); | 1654 set_register(instr, R2, icount_); |
rmacnak
2015/10/19 20:11:04
Maybe these should all be with NULL? They aren't t
regis
2015/10/19 20:42:55
Yes.
rmacnak
2015/10/19 21:14:32
Done.
| |
1654 set_register(instr, R3, icount_); | 1655 set_register(instr, R3, icount_); |
1655 set_register(instr, R4, icount_); | 1656 set_register(instr, R4, icount_); |
1656 set_register(instr, R5, icount_); | 1657 set_register(instr, R5, icount_); |
1657 set_register(instr, R6, icount_); | 1658 set_register(instr, R6, icount_); |
1658 set_register(instr, R7, icount_); | 1659 set_register(instr, R7, icount_); |
1659 set_register(instr, R8, icount_); | 1660 set_register(instr, R8, icount_); |
1660 set_register(instr, R9, icount_); | 1661 set_register(instr, R9, icount_); |
1661 set_register(instr, R10, icount_); | 1662 set_register(instr, R10, icount_); |
1662 set_register(instr, R11, icount_); | 1663 set_register(instr, R11, icount_); |
1663 set_register(instr, R12, icount_); | 1664 set_register(instr, R12, icount_); |
1664 set_register(instr, R13, icount_); | 1665 set_register(instr, R13, icount_); |
1665 set_register(instr, R14, icount_); | 1666 set_register(instr, R14, icount_); |
1666 set_register(instr, R15, icount_); | 1667 set_register(instr, R15, icount_); |
1667 set_register(instr, IP0, icount_); | 1668 set_register(instr, IP0, icount_); |
1668 set_register(instr, IP1, icount_); | 1669 set_register(instr, IP1, icount_); |
1669 set_register(instr, R18, icount_); | 1670 set_register(NULL, R18, icount_); |
1670 set_register(instr, LR, icount_); | 1671 set_register(instr, LR, icount_); |
1671 | 1672 |
1672 // TODO(zra): Zap caller-saved fpu registers. | 1673 // TODO(zra): Zap caller-saved fpu registers. |
1673 | 1674 |
1674 // Return. | 1675 // Return. |
1675 set_pc(saved_lr); | 1676 set_pc(saved_lr); |
1676 } else { | 1677 } else { |
1677 // Coming via long jump from a throw. Continue to exception handler. | 1678 // Coming via long jump from a throw. Continue to exception handler. |
1678 set_top_exit_frame_info(0); | 1679 set_top_exit_frame_info(0); |
1679 } | 1680 } |
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3536 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3537 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
3537 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3538 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3538 buf->Longjmp(); | 3539 buf->Longjmp(); |
3539 } | 3540 } |
3540 | 3541 |
3541 } // namespace dart | 3542 } // namespace dart |
3542 | 3543 |
3543 #endif // !defined(USING_SIMULATOR) | 3544 #endif // !defined(USING_SIMULATOR) |
3544 | 3545 |
3545 #endif // defined TARGET_ARCH_ARM64 | 3546 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |