Subject: Re: CVS commit: basesrc
To: None <ross@netbsd.org>
From: Anders Magnusson <ragge@ludd.luth.se>
List: source-changes
Date: 05/06/2001 21:40:19
> 
> Module Name:	basesrc
> Committed By:	ross
> Date:		Sun May  6 19:27:08 UTC 2001
> 
> Modified Files:
> 	basesrc/lib/libc/arch/i386/sys: brk.S
> 
> Log Message:
> I have no idea why this syscall wrapper does some very un-unix-like
> argument prefrobbing, in particular, it computes max(addr, __minbrk)
> and uses that. The code is like this even in the ancient libc/i386 tree,
> back to the earliest rev 1.2. I did not see it Lite 1, but I'm not totally
> sure what the random site I found was serving up.
>
The comments from the vax port may explain:
ENTRY(_brk, 0)
        cmpl    4(ap),_C_LABEL(__minbrk)        # gtr > _end 
        bgeq    1f                              #   is fine
        movl    _C_LABEL(__minbrk),4(ap)        # shrink back to _end
1:      chmk    $ SYS_break                     # do it
...

Avoid lowering brk below end of program...

-- Ragge