From owner-freebsd-hackers@freebsd.org Tue Jun 12 17:45:03 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DB1F100BD83 for ; Tue, 12 Jun 2018 17:45:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0291070D0F for ; Tue, 12 Jun 2018 17:45:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x231.google.com with SMTP id r24-v6so352980ioh.9 for ; Tue, 12 Jun 2018 10:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PqtB5GT4x1Q8vjRiz/oBrmxBtQmhZJqoIrhT4f7W4u4=; b=kV952aZP1tV5JCG62YGD0vb2z+ELJscj8yx81ogkMUtS3qRtByYVbk/i4Wag1AM22M isrvjW4AsGftCaF+zpu/E8So7Tld6VUH+BVCbObxT8kM0dE7x3Ss5M0IqiYvU9ijeXEE pKeD2wqKH7O+QZFmxkTKbqczUy0xat6vtC+tupXpeMlF8+E51Zi8ls6h+IZSxKfRAB4s xP2oEV8YRF8uxaMXparH9LSZ4+T6J+qGk8t+h6G/KSpOBJ0kZ3Jkw7l+zd9yKXqmUc+f x0HJCSCfNLBegS7O3osMy5DGX7srqXYIC16Ba9/VaPeLMg4uz+ZX6OPC5PwduPsgVjMb HvUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=PqtB5GT4x1Q8vjRiz/oBrmxBtQmhZJqoIrhT4f7W4u4=; b=AK2cfH5uBRee/0LLEYG7/71/1ptVAqUGtNFyKYnhoal2XbSX6MAuu3gPxE6riPY52F Oq5GHhgMk10Taue4pxZIK83zJVUZmXUznqjnSCW3iY6h//CorlK+MH74YqVOO9hOBi1y 8JNLWqDn5XAOy27Nx7i0SmOe0w5a5a1d8VNv564P5K+tHKI2XPJG1X+4faLxvsVz7AuV E9q7oirLQlf76YHaFunF8G5ZBSMhq/3wYhqO9VAIY0vtDjm0CVhjkzQFEMpbZuiXTtyb phqza/q3Vvw53arFh/NwQfBeekhZuR//yL+LAT7ky0ImHA1QBJGoUbO6pCfIgqJlAgEn WDKQ== X-Gm-Message-State: APt69E1He9mniGaVgDu8upVDuDLG+J2znms/2fCpGrz/XmdYQB1/fklK BfWBPB2hTsMSQ7RJhnBwByUJriJtfZJpWaSHngU1pw== X-Google-Smtp-Source: ADUXVKJnv08bJwwATTyZtmZdXMhHXeuZa0alFLLlGlb8lyZaZL9u3FXWaN9+OplAYy8vazJwszxblMErtfzzzZtel/4= X-Received: by 2002:a6b:d40c:: with SMTP id l12-v6mr1491446iog.37.1528825502271; Tue, 12 Jun 2018 10:45:02 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:d028:0:0:0:0:0 with HTTP; Tue, 12 Jun 2018 10:45:01 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20180612171649.GE56138@raichu> References: <20180612170420.GD56138@raichu> <20180612171649.GE56138@raichu> From: Warner Losh Date: Tue, 12 Jun 2018 11:45:01 -0600 X-Google-Sender-Auth: t__rGbtHYKRLg0ZMnVEtwfRKsR4 Message-ID: Subject: Re: specifying alignment of loader files To: Mark Johnston Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2018 17:45:03 -0000 On Tue, Jun 12, 2018 at 11:16 AM, Mark Johnston wrote: > On Tue, Jun 12, 2018 at 11:11:25AM -0600, Warner Losh wrote: > > On Tue, Jun 12, 2018 at 11:04 AM, Mark Johnston > wrote: > > > > > Hi, > > > > > > I'm writing some code which processes a file loaded by the loader. I > > > want the file's contents to be available at a certain alignment in > > > memory, and as far as I can see, the loader provides no alignment > > > guarantees today. The access will happen early enough during boot that > > > making an aligned copy of the data will be awkward, so I'd like the > > > loader to provide the desired alignment. > > > > > > I'm considering adding a new "module_align" variable that would specify > > > the alignment for a given file type, and plumb that through to > > > command_load(). Does anyone have an alternate suggestion, or an > > > objection to my proposal? > > > > > > > I thought the loader already did that for ELF sections... Why not wrap > your > > file in such a segment? > > In this case it's a raw binary file (CPU microcode), and I want to be > able to load it without any modifications or wrappers. > How do you identify the type then? I'm ok in theory with this (though a variable is more flexible than needed), but that's my main concern. What's the alignment required btw? Warner