* dcrt0.cc (getstack): Try harder to modify memory.

(alloc_stack): Alloc page prior to stack top, too.
This commit is contained in:
Christopher Faylor 2005-12-02 03:12:06 +00:00
parent 032295a988
commit e7f6a31bb0
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2005-12-01 Christopher Faylor <cgf@timesys.com>
* dcrt0.cc (getstack): Try harder to modify memory.
(alloc_stack): Alloc page prior to stack top, too.
2005-12-01 Christopher Faylor <cgf@timesys.com> 2005-12-01 Christopher Faylor <cgf@timesys.com>
* devices.h (_major): Revert previous ill-advised change. * devices.h (_major): Revert previous ill-advised change.

View File

@ -504,9 +504,10 @@ alloc_stack_hard_way (child_info_fork *ci, volatile char *b)
void *getstack (void *) __attribute__ ((noinline)); void *getstack (void *) __attribute__ ((noinline));
volatile char * volatile char *
getstack (volatile char *p) getstack (volatile char * volatile p)
{ {
*p |= 0; *p ^= 1;
*p ^= 1;
return p - 4096; return p - 4096;
} }
@ -515,13 +516,14 @@ getstack (volatile char *p)
static void static void
alloc_stack (child_info_fork *ci) alloc_stack (child_info_fork *ci)
{ {
volatile char *esp; volatile char * volatile esp;
__asm__ volatile ("movl %%esp,%0": "=r" (esp)); __asm__ volatile ("movl %%esp,%0": "=r" (esp));
if (_tlsbase != ci->stackbottom) if (_tlsbase != ci->stackbottom)
alloc_stack_hard_way (ci, esp); alloc_stack_hard_way (ci, esp);
else else
{ {
while (_tlstop > ci->stacktop) char *stacktop = (char *) ci->stacktop - 4096;
while (_tlstop >= stacktop)
esp = getstack (esp); esp = getstack (esp);
ci->stacksize = 0; ci->stacksize = 0;
} }