From owner-freebsd-mips@FreeBSD.ORG Thu Jan 12 08:13:19 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D718A106566C; Thu, 12 Jan 2012 08:13:19 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 444B98FC0C; Thu, 12 Jan 2012 08:13:18 +0000 (UTC) Received: by werb13 with SMTP id b13so1851044wer.13 for ; Thu, 12 Jan 2012 00:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=7RgJDNsCPttjOXPV11aDUQv6yQMsHvIIthd75nmULJQ=; b=AqypW9674v0zvfuw9CYmvPebBNdbMRoj+fsxaOBVryw0bXY41aCOagOMCx9WkqtwIM ow3DoI9KicQqgNSNNkVrW3YXDN6RIArlfs3upSih1wwJR0DPPG4awdDxWIJh+Vnzb4xG aoPEis/4/J8cQrHP8Y6fLh5k4ZL4C+flZnZzY= MIME-Version: 1.0 Received: by 10.180.105.129 with SMTP id gm1mr19086978wib.1.1326354648832; Wed, 11 Jan 2012 23:50:48 -0800 (PST) Received: by 10.216.54.15 with HTTP; Wed, 11 Jan 2012 23:50:48 -0800 (PST) In-Reply-To: <4F0E1965.6060808@freebsd.org> References: <4F0E1965.6060808@freebsd.org> Date: Thu, 12 Jan 2012 13:20:48 +0530 Message-ID: From: "Jayachandran C." To: Oleksandr Tymoshenko Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-mips@freebsd.org" , Alan Cox Subject: Re: MIPS64 modules X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2012 08:13:19 -0000 On Thu, Jan 12, 2012 at 4:51 AM, Oleksandr Tymoshenko w= rote: > =A0 =A0Modules on MIPS use the same interface as AMD64 modules: > sys/kern/link_elf_obj.c. It works for MIPS32 but there is a problem > with MIPS64. sys/kern/link_elf_obj.c calls vm_map_find that uses > KERNBASE as a map base. As I told - it works for mips32 because > KERNBASE for mips32 is located before actual virtual memory area > (KERNBASE points to directly-mapped KSEG0 segment). But for MIPS64 > it's not the case - KERNBASE points to the very end of address space > and vm_map_find fails. > > Using VM_MIN_KERNEL_ADDRESS fixes this problem. So the question is - > what should I do? Add #ifdef to link_elf_obj.c as in kmem_init in > vm/vm_kern.c or change KERNBASE to VM_MIN_KERNEL_ADDRESS? This is probably the right fix for both 32 and 64-bit mips. Using a KSEG0 address as argument for vm_map_find is not correct as the kernel map does not include that region for mips. This reminds me of another issue I had seen in kern/link_elf.c, the value of linker_kernel_file->address is also set to KERNBASE, but this really should be KERNLOADADDR (used in our conf files) for mips. JC.