From owner-freebsd-drivers@freebsd.org Mon Jan 22 15:13:28 2018 Return-Path: Delivered-To: freebsd-drivers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B413EC5A92 for ; Mon, 22 Jan 2018 15:13:28 +0000 (UTC) (envelope-from officem4790@gmail.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (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 01BD17FF26 for ; Mon, 22 Jan 2018 15:13:28 +0000 (UTC) (envelope-from officem4790@gmail.com) Received: by mail-it0-x236.google.com with SMTP id w14so10054327itc.3 for ; Mon, 22 Jan 2018 07:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ZlqC0W6yhBkjIQczbjAxJCH9PeYdpreiGzBFQ4Ry2OE=; b=Ro9QYkRc+Hep8UKKFQbwBsGeRMvQfdiJw7hHdxtROLK4tdEny/C9pNenTaSYCRUBXo 3qkLqLtpqQj5wfK+SOnY/fEVojxnagmHsBDFdrK4tqCvjJJqWEdZkee9lRyEo99HS5T4 W0eg9dgDsP6lBWceLWx3uy0ktD7Tuth/FDxrEVPjHqGhOlWku7dCxEnb+EJ2fQ2gxht7 M9BSbS1PhqgTwoq6zZWVxy3iV1uRP+SCLJQeuE2UOWxulHEwOzk3UztEbbv3v49MzqWM ssG7LsHOxguj58ZW3q282MBwLAOUT7FgQ2xKY0vvkm5XEObAxFl86p39pE/hnZ5aMtsM jYQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ZlqC0W6yhBkjIQczbjAxJCH9PeYdpreiGzBFQ4Ry2OE=; b=jlRVTUJLeZhiqfwJh/D1ERPXucwby4CRsqN3yYx8ryQe1zprHOv6tGWlGnva6GNHP1 EVm8RlP6gL6r87OWdnMFMZyjCGkp9QEiz5eBeeaqKXOEcRpDWMFrieJD8z1jWg9AUFsf yJ/IYu++Nv5+T85R0VV/6Gs3ukpY6QtEVj9NQhuKqKVHOVcy3InZJCXlfpnvJLnFffL4 u3bWRKgCib9gRmKqb308VJzZdlp6Ck/RV9GMUCVdtD89joFzVO1nALHPx8L+H4wLHeHU o+Zs3XarpIQ5XTMdcevtROIsrlVY94cvb+llW1hkvHKxox7fkDW2/Sjt8SmGj6qoVLvF lHVA== X-Gm-Message-State: AKwxytd35wCBZ7fSXLuAjZ+GE0+UCSJKYqjhvqEdGju/uom0J2U5xmoI aVL1TVsOEKukctTN8v5WdKGf0029oL9e0Y0+ckk= X-Google-Smtp-Source: AH8x227lMispOR09ng2ARUthT/LTpcSA/Ogi11++ouw/R9ChO7HGSFr4dBTVwQw9F3UA+geu+lfy9IykMPBZOqprHlM= X-Received: by 10.36.123.9 with SMTP id q9mr7709836itc.21.1516634007276; Mon, 22 Jan 2018 07:13:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.28.194 with HTTP; Mon, 22 Jan 2018 07:13:26 -0800 (PST) In-Reply-To: References: From: Office Manager Date: Mon, 22 Jan 2018 17:13:26 +0200 Message-ID: Subject: Fwd: Creating a KLD to dump memory To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2018 15:13:28 -0000 ---------- Forwarded message ---------- From: Office Manager Date: Mon, Jan 22, 2018 at 4:52 PM Subject: Re: Creating a KLD to dump memory To: Warner Losh Hi, As I said I'm using memrw which is /dev/mem code to read and write memory. My problem is in 32bit the dump outputs to about 4gb(size of all possible mappings of physical address) /dev/mem as well gives 0xFF to unmapped physical pages, I want to dump only mapped physical pages. On Mon, Jan 22, 2018 at 4:14 PM, Warner Losh wrote: > > > On Mon, Jan 22, 2018 at 6:48 AM, Office Manager > wrote: > >> Hi, >> I'm trying to create a kernel module to dump the memory of a machine like >> lime . >> Right now I'm using memrw implementation to read the physical memory, my >> problem with this method is the garbage pages that return a page filled >> with 0xFF's. >> How can I create a dump containing only the physical available memory? >> >> e.g my machine has 256mb so I want a 256mb memory dump. >> > > Study the code that implements /dev/mem. It's in mem.c in the arch > dependent directory in the kernel. > > Warner >