From: | Andrzej J. Debicki |
Date: | 20 Apr 00 at 08:21:24 |
Subject: | Re: How to change stack |
Hello Colin,
Wednesday, April 19, 2000, you wrote:
> [...about StackSwap and StackSwapStruct...]
Thanks. I wrote some test proggy. But something id wrong. It hangs on
first StackSwap func. Can someone help me to solve that?
#include <exec/memory.h>
#include <exec/types.h>
#include <clib/alib_protos.h>
int main(void)
{
struct StackSwapStruct *pNewStack;
struct Task *pTask;
APTR pStackMem;
ULONG lStackSize;
pTask = (struct Task*)FindTask(NULL);
lStackSize = (ULONG)pTask->tc_SPUpper - (ULONG)pTask->tc_SPLower + 16386;
pNewStack = (struct StackSwapStruct*)AllocVec(sizeof(struct StackSwapStruct), MEMF_ANY|MEMF_CLEAR);
Printf("Debug - 1\n");
if(pNewStack)
{
pStackMem = (APTR)AllocVec(lStackSize, MEMF_ANY|MEMF_CLEAR);
Printf("Debug - 2\n");
if(pStackMem)
{
pNewStack->stk_Lower = pStackMem;
pNewStack->stk_Upper = (ULONG)pStackMem + lStackSize;
pNewStack->stk_Pointer = (APTR)pNewStack->stk_Upper;
StackSwap(pNewStack);
Printf("Debug - 3\n");
/* rest of program */
StackSwap(pNewStack);
Printf("Debug - 4\n");
FreeVec(pStackMem);
}
Printf("Debug - 5\n");
FreeVec(pNewStack);
}
return 0;
}
I can see only:
Debug - 1
Debug - 2
and then GURU :-(. I tried vbcc and StormC 3.
------------------------------------------------------------------------
Enjoy the award-winning journalism of The New York Times with
convenient home delivery. And for a limited time, get 50% off for the
first 8 weeks by subscribing. Pay by credit card and receive an
additional 4 weeks at this low introductory rate.
http://click.egroups.com/1/3102/1/_/451227/_/956215293/
------------------------------------------------------------------------