From owner-freebsd-stable@FreeBSD.ORG Wed Jun 15 14:12:54 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2622C106566B for ; Wed, 15 Jun 2011 14:12:54 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta06.westchester.pa.mail.comcast.net (qmta06.westchester.pa.mail.comcast.net [76.96.62.56]) by mx1.freebsd.org (Postfix) with ESMTP id C92878FC1A for ; Wed, 15 Jun 2011 14:12:53 +0000 (UTC) Received: from omta09.westchester.pa.mail.comcast.net ([76.96.62.20]) by qmta06.westchester.pa.mail.comcast.net with comcast id wECc1g0030SCNGk56ECufB; Wed, 15 Jun 2011 14:12:54 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta09.westchester.pa.mail.comcast.net with comcast id wECh1g01i1t3BNj3VECoWd; Wed, 15 Jun 2011 14:12:51 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 3F08E102C19; Wed, 15 Jun 2011 07:12:40 -0700 (PDT) Date: Wed, 15 Jun 2011 07:12:40 -0700 From: Jeremy Chadwick To: Joerg Wunsch Message-ID: <20110615141240.GA61227@icarus.home.lan> References: <20110615135704.GQ23206@uriah.heep.sax.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110615135704.GQ23206@uriah.heep.sax.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-stable@freebsd.org Subject: Re: doscmd under 8-stable, anyone? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2011 14:12:54 -0000 On Wed, Jun 15, 2011 at 03:57:05PM +0200, Joerg Wunsch wrote: > When trying to use doscmd on 8-stable, all I get is: > > Error mapping HMA, HMA disabled: : Invalid argument > Segmentation fault (core dumped) > > The segfault happens at the end of mem_init(), when the allocated DOS > memory (which is located at virtual address 0) is attempted to be > written to. Apparently, the mmap() failure that causes the "HMA > disabled" message is actually a fatal error rather than a benign one > the could be ignored, as it results in no valid DOS memory allocation > at all. > > Right now, the only older system I could test it against uses FreeBSD > 5.x, where the mmap() works as expected. So does anyone have an idea > why this mmap() call: > > if (mmap((caddr_t)0x000000, 0x100000, > PROT_EXEC | PROT_READ | PROT_WRITE, > MAP_ANON | MAP_FIXED | MAP_SHARED, > -1, 0) == MAP_FAILED) { > perror("Error mapping HMA, HMA disabled: "); > HMA_a20 = -1; > close(HMA_fd_off); > close(HMA_fd_on); > return; > } > > yields an EINVAL now under 8-stable? Based on what I can determine from the mmap(2) man page: MAP_FIXED Do not permit the system to select a different address than the one specified. If the specified address can- not be used, mmap() will fail. If MAP_FIXED is speci- fied, addr must be a multiple of the pagesize. If a MAP_FIXED request is successful, the mapping estab- lished by mmap() replaces any previous mappings for the process' pages in the range from addr to addr + len. Use of this option is discouraged. [EINVAL] MAP_FIXED was specified and the addr argument was not page aligned, or part of the desired address space resides out of the valid address space for a user process. I imagine that the page size ordeal is probably what's biting you. Now, I'm not sure if page size in that above context refers to "kernel page size" (e.g. hw.pagesizes or hw.pagesize) or if it refers to "a page of memory" as in what libc/malloc uses. I'm not sure why a person would need or want MAP_FIXED in this situation; why can't they just take the result of mmap() (a void *) and use that as a base address offset instead of assuming zero in their software? -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |