Update of /cvsroot/squeak/squeak/platforms/Mac OS/plugins/SqueakFFIPrims
In directory sc8-pr-cvs1:/tmp/cvs-serv19410/squeak/platforms/Mac OS/plugins/SqueakFFIPrims
Modified Files:
sqMacFFIPPC.c
Log Message:
1.3 Changes to save and restore CCR, align stack on 32byte boundaries, and to make some variables static versus non-static for classic, versus os-x
Index: sqMacFFIPPC.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/plugins/SqueakFFIPrims/sqMacFFIPPC.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sqMacFFIPPC.c 1 Feb 2002 07:05:09 -0000 1.2
--- sqMacFFIPPC.c 18 Nov 2002 19:09:23 -0000 1.3
***************
*** 20,23 ****
--- 20,29 ----
#endif
+ #if defined ( __APPLE__ ) && defined ( __MACH__ )
+ #define staticIssue
+ #else
+ #define staticIssue static
+ #endif
+
extern struct VirtualMachine *interpreterProxy;
#define primitiveFail() interpreterProxy->primitiveFail();
***************
*** 28,46 ****
/* Values passed in GPR3-GPR10 */
! int GPRegs[8];
!
/* Nr of GPRegs used so far */
! int gpRegCount = 0;
/* Values passed in FPR1-FPR13 */
! double FPRegs[13];
/* Nr of FPRegs used so far */
! int fpRegCount = 0;
/* Max stack size */
#define FFI_MAX_STACK 512
/* The stack used to assemble the arguments for a call */
! int ffiStack[FFI_MAX_STACK];
/* The stack pointer while filling the stack */
! int ffiStackIndex = 0;
/* The area for temporarily allocated strings */
static char *ffiTempStrings[FFI_MAX_STACK];
--- 34,51 ----
/* Values passed in GPR3-GPR10 */
! static int GPRegs[8];
/* Nr of GPRegs used so far */
! staticIssue int gpRegCount = 0;
/* Values passed in FPR1-FPR13 */
! static double FPRegs[13];
/* Nr of FPRegs used so far */
! staticIssue int fpRegCount = 0;
/* Max stack size */
#define FFI_MAX_STACK 512
/* The stack used to assemble the arguments for a call */
! static int ffiStack[FFI_MAX_STACK];
/* The stack pointer while filling the stack */
! staticIssue int ffiStackIndex = 0;
/* The area for temporarily allocated strings */
static char *ffiTempStrings[FFI_MAX_STACK];
***************
*** 49,55 ****
/* The return values for calls */
! int intReturnValue;
! LONGLONG longReturnValue;
! double floatReturnValue;
static int *structReturnValue = NULL;
--- 54,60 ----
/* The return values for calls */
! staticIssue int intReturnValue;
! static LONGLONG longReturnValue;
! static double floatReturnValue;
static int *structReturnValue = NULL;
***************
*** 338,346 ****
}
! int ffiStackLocation=&ffiStack;
! int FPRegsLocation=&FPRegs;
! int GPRegsLocation=&GPRegs;
! int longReturnValueLocation=&longReturnValue;
! int floatReturnValueLocation=&floatReturnValue;
/*****************************************************************************/
/*****************************************************************************/
--- 343,351 ----
}
! int ffiStackLocation=(int) &ffiStack;
! int FPRegsLocation=(int) &FPRegs;
! int GPRegsLocation=(int) &GPRegs;
! int longReturnValueLocation=(int) &longReturnValue;
! int floatReturnValueLocation=(int) &floatReturnValue;
/*****************************************************************************/
/*****************************************************************************/
***************
*** 355,358 ****
--- 360,365 ----
mflr r0
stw r0, 8(SP)
+ mfcr r0 /* save CCR */
+ stw r0,4(sp)
/* get stack index and preserve it for copying stuff later */
***************
*** 361,365 ****
/* compute frame size */
rlwinm r5, r4, 2, 0, 29 /* ffiStackIndex words to bytes (e.g., "slwi r5, r4, 2") */
! addi r5, r5, 24 /* linkage area */
neg r5, r5 /* stack goes down */
--- 368,373 ----
/* compute frame size */
rlwinm r5, r4, 2, 0, 29 /* ffiStackIndex words to bytes (e.g., "slwi r5, r4, 2") */
! addi r5, r5, 24+15 /* linkage area */
! rlwinm r5,r5,0,0,27 /* JMM round up to quad word*/
neg r5, r5 /* stack goes down */
***************
*** 389,393 ****
lwz r12, FPRegs(RTOC)
cmpwi r3, 0 /* skip all fpregs if no FP values used */
! blt _0_fpregs
cmpwi r3, 8
blt _7_fpregs /* skip last N fpregs if unused */
--- 397,401 ----
lwz r12, FPRegs(RTOC)
cmpwi r3, 0 /* skip all fpregs if no FP values used */
! beq _0_fpregs
cmpwi r3, 8
blt _7_fpregs /* skip last N fpregs if unused */
***************
*** 412,416 ****
lwz r3, gpRegCount
lwz r12, GPRegs(RTOC)
! cmpwi r3, 4
blt _4_gpregs /* skip last four gpregs if unused */
_all_gpregs:
--- 420,424 ----
lwz r3, gpRegCount
lwz r12, GPRegs(RTOC)
! cmpwi r3, 5
blt _4_gpregs /* skip last four gpregs if unused */
_all_gpregs:
***************
*** 448,451 ****
--- 456,461 ----
/* and get out of here */
+ lwz r0, 4(sp) /*restore CCR */
+ mtcrf 0xff,r0
lwz r0, 8(SP)
mtlr r0
|