On 11/13/06, vlebed <[EMAIL PROTECTED]> wrote:
/*** HERE IS MY PROGRAM FOR PalmOS 5 (Tungsten T5) ********************
armfn.bin: armfn.o
arm-palmos-objcopy -O binary armfn.o armfn.bin
armfn.o: armfn.c
arm-palmos-gcc -DDEBUG=0 -O2 -Wall -fPIC -ffixed-r9 -c armfn.c
**********************************************************************/
typedef struct fpNewStack
{
void *fpFunctPtr;
void *fpStackPtr;
unsigned long int fpStackSize;
} fpNewStackType;
/******************** From PilotMain() ***********************************
fpStackType fpStackParam;
fpStackParam.fpFunctPtr = (void *)(&EventLoop);
fpStackParam.fpStackPtr = (void *)(MemPtrNew(32768));
fpStackParam.fpStackSize = 32768;
armH = DmGetResource('armc', fpIncreaseStack);
armP = MemHandleLock(armH);
PceNativeCall(armP, &fpStackParam);
MemHandleUnlock(armH);
DmReleaseResource(armH);
*************************************************************************/
void IncreaseStackAndRunEventLoop( const void *emulStateP,
void *userData68KP,
Call68KFuncType *call68KFunc)
{
register void *mem = (void *) ByteSwap32( ((fpNewStackType *)userData68KP)->fpStackPtr );
register void *oldSP = 0;
register unsigned long int ret = (unsigned long int) ByteSwap32( ((fpNewStackType *)userData68KP)->fpStackSize );
register void *funct = (void *) ByteSwap32(((fpNewStackType *)userData68KP)->fpFunctPtr);
asm("mov %0, sp" : : "r" (oldSP));
asm("add sp, %0, %1" : : "r" (mem), "r" (ret) );
/********* callBack EventLoop **************/
(call68KFunc)( emulStateP, (unsigned long int)funct, userData68KP, 4 | kPceNativeWantA0 );
/*******************************************/
asm("mov sp, %0" : : "r" (oldSP));
}
/******************** From EventLoop() ************
**
** . . . . . . . . . . . . . . . . . . . . .
**
MemPtr start, end;
SysGetStackInfo( &start, &end );
** abs( start - end )= 4095
**
** HOW TO INCREASE STACK SIZE
** OF M68K APPLICATION FROM ARM ?
***************************************************/
--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
--
Eng. Hasan A.Hadi
Andalus Software & Development -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
