Index: src/arm/simulator-arm.cc |
diff --git a/src/arm/simulator-arm.cc b/src/arm/simulator-arm.cc |
index efbfff200360f2b6e8618cf3d1ae0becf180ac88..d11e340a9b88b2f6076f424d196b223b87fd771b 100644 |
--- a/src/arm/simulator-arm.cc |
+++ b/src/arm/simulator-arm.cc |
@@ -3301,33 +3301,7 @@ void Simulator::Execute() { |
} |
-int32_t Simulator::Call(byte* entry, int argument_count, ...) { |
- va_list parameters; |
- va_start(parameters, argument_count); |
- // Set up arguments |
- |
- // First four arguments passed in registers. |
- ASSERT(argument_count >= 4); |
- set_register(r0, va_arg(parameters, int32_t)); |
- set_register(r1, va_arg(parameters, int32_t)); |
- set_register(r2, va_arg(parameters, int32_t)); |
- set_register(r3, va_arg(parameters, int32_t)); |
- |
- // Remaining arguments passed on stack. |
- int original_stack = get_register(sp); |
- // Compute position of stack on entry to generated code. |
- int entry_stack = (original_stack - (argument_count - 4) * sizeof(int32_t)); |
- if (OS::ActivationFrameAlignment() != 0) { |
- entry_stack &= -OS::ActivationFrameAlignment(); |
- } |
- // Store remaining arguments on stack, from low to high memory. |
- intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack); |
- for (int i = 4; i < argument_count; i++) { |
- stack_argument[i - 4] = va_arg(parameters, int32_t); |
- } |
- va_end(parameters); |
- set_register(sp, entry_stack); |
- |
+void Simulator::CallInternal(byte* entry) { |
// Prepare to execute the code at entry |
set_register(pc, reinterpret_cast<int32_t>(entry)); |
// Put down marker for end of simulation. The simulator will stop simulation |
@@ -3381,6 +3355,37 @@ int32_t Simulator::Call(byte* entry, int argument_count, ...) { |
set_register(r9, r9_val); |
set_register(r10, r10_val); |
set_register(r11, r11_val); |
+} |
+ |
+ |
+int32_t Simulator::Call(byte* entry, int argument_count, ...) { |
+ va_list parameters; |
+ va_start(parameters, argument_count); |
+ // Set up arguments |
+ |
+ // First four arguments passed in registers. |
+ ASSERT(argument_count >= 4); |
+ set_register(r0, va_arg(parameters, int32_t)); |
+ set_register(r1, va_arg(parameters, int32_t)); |
+ set_register(r2, va_arg(parameters, int32_t)); |
+ set_register(r3, va_arg(parameters, int32_t)); |
+ |
+ // Remaining arguments passed on stack. |
+ int original_stack = get_register(sp); |
+ // Compute position of stack on entry to generated code. |
+ int entry_stack = (original_stack - (argument_count - 4) * sizeof(int32_t)); |
+ if (OS::ActivationFrameAlignment() != 0) { |
+ entry_stack &= -OS::ActivationFrameAlignment(); |
+ } |
+ // Store remaining arguments on stack, from low to high memory. |
+ intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack); |
+ for (int i = 4; i < argument_count; i++) { |
+ stack_argument[i - 4] = va_arg(parameters, int32_t); |
+ } |
+ va_end(parameters); |
+ set_register(sp, entry_stack); |
+ |
+ CallInternal(entry); |
// Pop stack passed arguments. |
CHECK_EQ(entry_stack, get_register(sp)); |
@@ -3391,6 +3396,27 @@ int32_t Simulator::Call(byte* entry, int argument_count, ...) { |
} |
+double Simulator::CallFP(byte* entry, double d0, double d1) { |
+ if (use_eabi_hardfloat()) { |
+ set_d_register_from_double(0, d0); |
+ set_d_register_from_double(1, d1); |
+ } else { |
+ int buffer[2]; |
+ ASSERT(sizeof(buffer[0]) * 2 == sizeof(d0)); |
+ memcpy(buffer, &d0, sizeof(d0)); |
+ set_dw_register(0, buffer); |
+ memcpy(buffer, &d1, sizeof(d1)); |
+ set_dw_register(2, buffer); |
+ } |
+ CallInternal(entry); |
+ if (use_eabi_hardfloat()) { |
+ return get_double_from_d_register(0); |
+ } else { |
+ return get_double_from_register_pair(0); |
+ } |
+} |
+ |
+ |
uintptr_t Simulator::PushAddress(uintptr_t address) { |
int new_sp = get_register(sp) - sizeof(uintptr_t); |
uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(new_sp); |