lkml.org 
[lkml]   [2000]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectmmapping kmem...
Date
From

Hi,

I'm writing a driver, and I would like "interactive" access to the
datastructures of the driver. Now I know I could probably juse kgdb,
but that's too fancy for me. So I use the "chipmunk" program to
dynamically examine main memory.

It mmaps /dev/kmem.

Then I can issue commands:

> dump f0000
4024c000 1f 4f 38 4f 51 4f 6a 4f 1e 06 b8 00 00 8e d8 bf .O8OQOjO........

this is the first part of my BIOS. Looks good.

and look: The "read kmem" gives the same result!

/root# ( seek 0xc00f0000 ; dd bs=512 count=1 ) < /dev/kmem | hd
1+0 records in
1+0 records out
00000 1f 4f 38 4f 51 4f 6a 4f 1e 06 b8 00 00 8e d8 bf .O8OQOjO..8...X?

Next, I move over to 1Mb (where the kernel starts):

> dump 100000
4025c000 fc b8 18 00 00 00 8e d8 8e c0 8e e0 8e e8 66 09 ..............f.

/root# ( seek 0xc0100000 ; dd bs=512 count=1 ) < /dev/kmem | hd
1+0 records in
1+0 records out
00000 fc b8 18 00 00 00 8e d8 8e c0 8e e0 8e e8 66 09 |8.....X.@.`.hf.

and they are still the same. Good.

Next I move over to the area of interest:

/root# ( seek 0xc0ec8000 ; dd bs=512 count=1 ) < /dev/kmem | hd
1+0 records in
1+0 records out
00000 00 00 40 c2 00 00 00 00 00 00 00 00 00 00 00 00 ..@B............
00010 00 00 40 c2 01 00 00 00 00 00 00 00 00 00 00 00 ..@B............

and this is what is supposed to be there, but with Chipmunk:

> dump ec8000
41024000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
41024010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

I get only zeroes.

I've traced things into mmap_mem in drivers/char/mem.c, which calls
"remap_page_range". This in the end calls remap_pte_range, which has:

/*
* maps a range of physical memory into the requested pages. the old
* mappings are removed. any references to nonexistent pages results
* in null mappings (currently treated as "copy-on-access")
*/

as a comment (Indicating the possiblity of null mappings, and:

PageReserved(mem_map+mapnr)

which I guess is triggering the difference between a mapping and a
zero mapping.

Why was this added? What's it supposed to do?

Roger.

--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* Common sense is the collection of *
****** prejudices acquired by age eighteen. -- Albert Einstein ********

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.024 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site