(lwpSave, lwpReschedule) [hpc]: Move machine-dependent code to arch.c,

where it belongs.  Code looks fishy.  Untested.
(initcontext, startpoint): Internal linkage.
This commit is contained in:
Markus Armbruster 2005-12-05 21:38:03 +00:00
parent 955fab9d86
commit 3a18d0b986
3 changed files with 25 additions and 27 deletions

View file

@ -70,8 +70,8 @@ lwpInitContext(struct lwpProc *newp, stack_t *spp)
#elif defined(hpc)
static struct lwpProc *tempcontext;
struct lwpProc *initcontext = NULL;
int startpoint;
static struct lwpProc *initcontext = NULL;
static int startpoint;
static void
startcontext(void)
@ -117,6 +117,25 @@ lwpInitContext(struct lwpProc *newp, void *sp)
}
}
int
lwpSave(jmp_buf jb)
{
int endpoint;
endpoint = &endpoint;
if (initcontext == NULL || endpoint < startpoint)
return setjmp(jb, 1);
LwpCurrent->size = endpoint - startpoint;
LwpCurrent->sbtm = realloc(LwpCurrent->sbtm, LwpCurrent->size);
memcpy(LwpCurrent->sbtm, startpoint, LwpCurrent->size);
if (setjmp(jb, 1)) {
memcpy(startpoint, LwpCurrent->sbtm, LwpCurrent->size);
return 1;
}
return 0;
}
#elif defined(hpux)
void

View file

@ -129,26 +129,7 @@ lwpReschedule(void)
BOUNDS_CHECKING_OFF;
#endif
#if defined(hpc)
{
int endpoint;
endpoint = &endpoint;
if (initcontext == NULL || endpoint < startpoint) {
i = lwpSave(LwpCurrent->context);
} else {
LwpCurrent->size = endpoint - startpoint;
LwpCurrent->sbtm = realloc(LwpCurrent->sbtm, LwpCurrent->size);
memcpy(LwpCurrent->sbtm, startpoint, LwpCurrent->size);
if (i = lwpSave(LwpCurrent->context)) {
memcpy(startpoint, LwpCurrent->sbtm, LwpCurrent->size);
i = 1;
}
}
}
#else
i = lwpSave(LwpCurrent->context);
#endif
#ifdef BOUNDS_CHECK
BOUNDS_CHECKING_ON;
#endif

View file

@ -39,7 +39,10 @@ void lwpInitContext(volatile struct lwpProc * volatile, void *);
#else
void lwpInitContext(struct lwpProc *, void *);
#endif
#if (defined(hpux) && !defined(hpc)) || defined(AIX32) || defined(ALPHA)
#if defined(hpc)
int lwpSave(jmp_buf);
#define lwpRestore(x) longjmp(x, 1)
#elif defined(hpux) || defined(AIX32) || defined(ALPHA)
int lwpSave(jmp_buf);
void lwpRestore(jmp_buf);
#elif defined(SUN4)
@ -51,11 +54,6 @@ void lwpRestore(jmp_buf);
#endif
#endif /* !UCONTEXT */
#ifdef hpc
extern struct lwpProc *initcontext;
extern int startpoint;
#endif
#ifdef AIX32
/* AIX needs 12 extra bytes above the stack; we add it here */
#define LWP_EXTRASTACK 3*sizeof(long)