Mail Archives: djgpp/1997/03/20/14:23:54
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:
> On Mon, 17 Mar 1997, Hans-Juergen Boehm wrote:
> > If there is some agreement as to what the definitions should be, I'd be
> > happy to fix 4.12. But I do have vague recollections of contradictory
> > fixes in the past, suggesting that what works for one program may not be
> > universally correct.
Reading my first post I found a mistake. STACKBOTTOM is
to be #define'd as follows:
# ifdef DJGPP
# include "stubinfo.h"
# define OS_TYPE "DJGPP"
extern int etext;
extern int _stklen;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
# define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
+ _stklen))
# endif
(I didn't have the source at hand when I wrote the first post).
I haven't upgraded to DJGPP version 2.10, so I don't know wether
this will work with other versions than 2.00.
> I don't know anything about this garbage collector, and only a vague
> idea about the problem with the stack bottom variable. But if
> somebody can post a short description of the problem, including what
> is the use of stack bottom in the package, I'm sure this issue can be
> resolved, because people who designed and implemented the way memory
> is mapped under DJGPP are available here. (I'm not one of those
> people, so please do NOT email me directly, post to the news group.)
When the collector tries to free up unused memory it sweeps the stack
to see if theres should be any memory cell's on the stack containing
a value that might be a valid pointer to a memory block managed by
the allocator. To perform this sweep the collector needs to know the
lowest and the highest address of the active part of the stack. The
lowest address can be aquired by looking at esp and the highest address
is the end of the memory block allocated for the stack; this is
STACKBOTTOM. Looking into crt0.S I find:
...
pushl %eax
call ___sbrk
movl %eax, __stubinfo
movl %eax, %edi
... /* <- no calls to sbrk here */
pushl %eax
call ___sbrk /* allocate the memory */
cmpl $-1, %eax
je no_memory
addl __stklen, %eax
movw %ds, %dx /* set stack */
movw %dx, %ss
movl %eax, %esp
thus STACKBOTTOM should be defined so that it evaluates to the value
eax holds in the last line above... I cant figure out how to do this
if not the way shown above. Anyways, since _stklen is adjustable
(for example using stubedit) a fixed value like 0x00080000 as it's
#define'd in config.h from GC version 4.10 couldn't be correct.
regards,
Kristian Hogsberg
hogsberg AT daimi DOT aau DOT dk
- Raw text -