2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
5 Desc: NewStackSwap() - Call a function with swapped stack.
9 #include "aros/m68k/asm.h"
13 .globl AROS_SLIB_ENTRY(NewStackSwap,Exec,134)
14 AROS_SLIB_ENTRY(NewStackSwap,Exec,134):
16 /* Stackswap will clobber %d0, %d1, %a0, and %a1,
17 * so we need to save %a0/%a1 in %a3/%a4
27 move.l %a2@(7*4),%sp@- // Put the C arguments on the stack
28 move.l %a2@(6*4),%sp@-
29 move.l %a2@(5*4),%sp@-
30 move.l %a2@(4*4),%sp@-
31 move.l %a2@(3*4),%sp@-
32 move.l %a2@(2*4),%sp@-
33 move.l %a2@(1*4),%sp@-
34 move.l %a2@(0*4),%sp@-
37 jsr %a4@ // Call the C function
42 lea.l %sp@(8*4),%sp // Remove the C arguments
45 move.l %d0,%a4 // save C function returncode
50 /* Now we can restore %a3/%a4