On Tue, Sep 05, 2000 at 06:46:38PM -0400, [EMAIL PROTECTED] wrote:
> On Mon, Sep 04, 2000 at 08:48:33PM -0400, Kevin Lawton wrote:
> > I got a message from someone working towards compiling plex86
> > on Linux kernel 2.4:
> 
> I lurk on the list...
> 
> > > Still getting an error -- MAP_NR (host-linux.c, line 954 or nearby) -- what's
> > > that do? I'm no kernel hacker ;)
> > 
> > It takes an address as returned by get_free_page(), and returns
> > the top 20bits of the physical address of the page.
> > 
> > Pages returned by get_free_page() are called 'physical', but
> > really they are offset by a kernel offset on newer kernels.
> > We want the real physical address, shifted right 12 bits;
> > the physical page index.
> > 
> > I'm including include/asm/page.h from my linux kernel.
> > 
> > If anyone else has ideas, please chime in.
> > 
> > It looks like MAP_NR() was supplanted by virt_to_page(),
> > probably because of reworking of kernel virtual memory
> > handling to take advantage of large system RAM.
> > 
> > You could try that macro instead.  Not guaranteeing anything. :^)
> 
> Segfaults. Four lines showed up in the logs; didn't look that useful.
> I'm still trying to track it down; unfortunately debugging at the kernel
> level is a good deal more difficult than user level.
> 
> [snip]
> > #define MAP_NR(addr)                (__pa(addr) >> PAGE_SHIFT)
> 
> My /usr/src/linux/include/asm/page.h:
> 
> #define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
> 
> ... so what's mem_map? Looking at it...

/usr/src/linux/include/linux/mm.h

struct page {
 ...
} mem_map_t;

...

extern mem_map_t * mem_map;

So what the heck is the kernel doing pointer arithmetic on a structure for?

OTOH, I'm assuming that this is the same mem_map (which seems a reasonable
assumption).

Puzzled by the beast we call a kernel,

Kenneth

Reply via email to