public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [question] What's the difference between /dev/kmem and /dev/mem
@ 2005-08-11 21:36 Steven Rostedt
  2005-08-12  1:15 ` [PATCH] Fix mmap_kmem (was: [question] What's the difference between /dev/kmem and /dev/mem) Steven Rostedt
  0 siblings, 1 reply; 35+ messages in thread
From: Steven Rostedt @ 2005-08-11 21:36 UTC (permalink / raw)
  To: LKML

OK, I thought I use to know this. But what is the difference
between /dev/kmem and /dev/mem.  I thought that with /dev/kmem you could
use the actual kernel addresses to read from. 

For example, if I wanted to read the current variable X in the kernel, I
could look up the address of X in System.map, then mmaping to /dev/kmem
I could get to that variable using the address that I got from
System.map.  But this doesn't seem to work.

I'm getting an IO error on read. And looking at this I see:


static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
{
        unsigned long long val;
	/*
	 * RED-PEN: on some architectures there is more mapped memory
	 * than available in mem_map which pfn_valid checks
	 * for. Perhaps should add a new macro here.
	 *
	 * RED-PEN: vmalloc is not supported right now.
	 */
	if (!pfn_valid(vma->vm_pgoff))
		return -EIO;
	val = (u64)vma->vm_pgoff << PAGE_SHIFT;
	vma->vm_pgoff = __pa(val) >> PAGE_SHIFT;
	return mmap_mem(file, vma);
}

I printed out the value in vma->vm_pgoff, and it still has the
0xc0000000 (but shifted >> 12). Isn't this suppose to also remove the
0xc?  Or am I just totally off here? 

Thanks,

-- Steve




^ permalink raw reply	[flat|nested] 35+ messages in thread
[parent not found: <1123796188.17269.127.camel@localhost.localdomain.suse.lists.linux.kernel>]

end of thread, other threads:[~2005-08-18 14:18 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-11 21:36 [question] What's the difference between /dev/kmem and /dev/mem Steven Rostedt
2005-08-12  1:15 ` [PATCH] Fix mmap_kmem (was: [question] What's the difference between /dev/kmem and /dev/mem) Steven Rostedt
2005-08-12 14:25   ` Hugh Dickins
2005-08-12 16:35   ` Linus Torvalds
2005-08-12 16:56     ` Dave Jones
2005-08-12 17:07       ` Steven Rostedt
2005-08-12 17:16         ` Arjan van de Ven
2005-08-12 17:32           ` Steven Rostedt
2005-08-12 17:01     ` Steven Rostedt
2005-08-13 13:39     ` [PATCH] Fix mmap kmem " Nicolas George
2005-08-13 16:50     ` [PATCH] Fix mmap_kmem " Arjan van de Ven
2005-08-13 16:56       ` Linus Torvalds
2005-08-13 17:25         ` Arjan van de Ven
2005-08-13 17:37           ` Linus Torvalds
2005-08-13 18:18             ` Arjan van de Ven
2005-08-16 22:12               ` Greg Edwards
2005-08-16 23:33                 ` Alan Cox
2005-08-16 23:47                   ` Steven Rostedt
2005-08-15 19:33             ` Olaf Hering
2005-08-15 21:14               ` Jeff Dike
2005-08-15 21:50                 ` Olaf Hering
2005-08-15 22:41               ` Linus Torvalds
2005-08-16  1:16             ` Steven Rostedt
2005-08-16  1:22               ` Steven Rostedt
2005-08-16  1:36                 ` Linus Torvalds
2005-08-13 16:57       ` Joshua Hudson
2005-08-13 17:27         ` Arjan van de Ven
2005-08-14 14:50       ` Martin J. Bligh
2005-08-18 14:07         ` Arjan van de Ven
2005-08-18 14:18           ` Steven Rostedt
     [not found] <1123796188.17269.127.camel@localhost.localdomain.suse.lists.linux.kernel>
     [not found] ` <1123809302.17269.139.camel@localhost.localdomain.suse.lists.linux.kernel>
     [not found]   ` <Pine.LNX.4.58.0508120930150.3295@g5.osdl.org.suse.lists.linux.kernel>
2005-08-12 16:54     ` Andi Kleen
2005-08-12 17:56       ` Arjan van de Ven
2005-08-12 18:26         ` Andi Kleen
2005-08-13  9:56       ` Ingo Oeser
2005-08-13 12:40         ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox