Subject: svr4 emulation and brk
To: None <current-users@NetBSD.ORG>
From: Thomas Seidmann <>
List: current-users
Date: 04/07/1998 15:03:17

I'm trying to get a software package made for Solaris 2 to run under
NetBSD/sparc 1.3. While starting the license manager, I've observed its
malfunction and ktrace showed, that it is trying to push the end of the
data segment a big step:

   318 synopsysd CALL  setitimer(0,0x7afcc,0x7afbc)
   318 synopsysd RET   setitimer 0
   318 synopsysd CALL  break(0x97000)
   318 synopsysd RET   break 0
>>>318 synopsysd CALL  break(0x10097000)
   318 synopsysd RET   break -1 errno 12 Cannot allocate memory

I realized that this is after 256M (MAXDSIZ), so I built a kernel with
MAXDSIZ=512M. The license manager won't start either. So I wrote a
simple test program that tries to perform this operation:

#include <unistd.h>

char *b = sbrk(0);
printf("break is at %lx\n", (int)b);
printf("Calling break: %d\n", brk(0x10097000));
b = sbrk(0);
printf("break is at %lx\n", (int)b);

When I compile and run this as a native NetBSD image (after pushing the
limit datasize to unlimited i.e. 512M), it works fine. But when compiled
under Solaris and run under emulation, it does not - brk returns (-1).
After some investigation I've found out that the problem is no more the
datasize limit, but vm_allocate returning KERN_NO_SPACE due to the fact,
that it has got into way of another memory region. Having played with
the desired break value I discovered that 0x10000000 is the largest
possible for brk to work.

My questions are:
1. Does anyone know of a memory region that gets mapped from 0x10000000,
that has most probably to do with svr4 emulation?
2. How can I find out what memory region is the confilicting one?

Thank you very much.


Dipl.-Ing. Thomas Seidmann
Department of Computer Science and Engineering
Slovak University of Technology in Bratislava       Tel +421.7.60291153