Skip to content
Snippets Groups Projects
Commit 55da453e authored by wlott's avatar wlott
Browse files

Don't trash the return values in call-into-c before we have a change to

return them to the lisp code.
parent a2599f2b
No related branches found
No related tags found
No related merge requests found
...@@ -150,15 +150,22 @@ call_into_c: ...@@ -150,15 +150,22 @@ call_into_c:
ti 7, r0, trap_PendingInterrupt ti 7, r0, trap_PendingInterrupt
1: 1:
/* Get the first 4 args. */ /* Get the first 4 args, and adjust the stack pointer. We need to */
/* adjust the stack pointer because r1 is supposed to point at the */
/* 5th argument, not the 1st. This is easier than trying to fix */
/* pack to be able to deal with TNs with a negative offset. */
l r2, 0(r1) l r2, 0(r1)
l r3, 4(r1) l r3, 4(r1)
l r4, 8(r1) l r4, 8(r1)
l r5, 9(r1) l r5, 12(r1)
cal r1, 16(r1)
/* And hit it. */ /* And hit it. */
balr r15, r15 balr r15, r15
/* Save the second return value (assuming there is one) */
mr NARGS, OCFP
/* Clear desriptor regs. We have to do this before we clear the /* Clear desriptor regs. We have to do this before we clear the
foreign-function-call-active flag even if we are just going to foreign-function-call-active flag even if we are just going to
load the saved value back into the reg to make sure we don't keep load the saved value back into the reg to make sure we don't keep
...@@ -174,18 +181,18 @@ call_into_c: ...@@ -174,18 +181,18 @@ call_into_c:
/* No longer in foreign function call. */ /* No longer in foreign function call. */
/* Note: the atomic flag should still be set. */ /* Note: the atomic flag should still be set. */
lis A0, 0 lis A0, 0
store A0, _foreign_function_call_active, NL0 store A0, _foreign_function_call_active, OCFP
/* Load the rest of lisp state. */ /* Load the rest of lisp state. */
load CSP, _current_control_stack_pointer load CSP, _current_control_stack_pointer
load CFP, _current_control_frame_pointer load CFP, _current_control_frame_pointer
/* No longer atomic. */ /* No longer atomic. */
store A0, PSEUDO_ATOMIC_ATOMIC+SYMBOL_VALUE_OFFSET, NL0 store A0, PSEUDO_ATOMIC_ATOMIC+SYMBOL_VALUE_OFFSET, OCFP
/* Were we interrupted? */ /* Were we interrupted? */
load NL0, PSEUDO_ATOMIC_INTERRUPTED+SYMBOL_VALUE_OFFSET load OCFP, PSEUDO_ATOMIC_INTERRUPTED+SYMBOL_VALUE_OFFSET
ci NL0, 0 ci OCFP, 0
je 1f je 1f
ti 7, r0, trap_PendingInterrupt ti 7, r0, trap_PendingInterrupt
...@@ -199,6 +206,10 @@ call_into_c: ...@@ -199,6 +206,10 @@ call_into_c:
/* Reset the stack. */ /* Reset the stack. */
mr CSP, CFP mr CSP, CFP
mr CFP, OCFP mr CFP, OCFP
cal r1, -16(r1)
/* Restore the second return value */
mr OCFP, NARGS
/* And return */ /* And return */
cal LIP, (4-type_OtherPointer)(LRA) cal LIP, (4-type_OtherPointer)(LRA)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment