On Thu, Sep 07, 2000 at 10:36:22PM +0200, Frank Cornelis wrote:
> Hi,
>
> The mem_map stuff has changed in linux kernel 2.4.
> Tried to patch it. But since I'm not very familiar with linux mem_map
> stuff and because I don't know what has changed since 2.2.x it's not a
> very good patch. It makes plex86 compile under kernel 2.4 but that's about
> it. Hint: don't try it.
> Someone with experience on this topic please fix it.
>
> PS: They also abandoned MAP_NR, and I don't know how to replace it.
It looks very familiar... that's exactly what I was working on (already
submitted almost exactly the below to Kevin).
MAP_NR => virt_to_page.
segfaults.
Look in the kernel tree, and you'll see something a bit peculiar:
/usr/src/linux/include/linux/mm.h:
...
typedef struct page {
struct list_head list;
struct address_space *mapping;
unsigned long index;
struct page *next_hash;
atomic_t count;
unsigned long flags; /* atomic flags, some possibly updated asynchronously
*/
struct list_head lru;
wait_queue_head_t wait;
struct page **pprev_hash;
struct buffer_head * buffers;
void *virtual; /* non-NULL if kmapped */
struct zone_struct *zone;
} mem_map_t;
...
extern mem_map_t * mem_map;
...
and in asm/pages.h:
...
#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
...
So why is a pointer to a structure getting into pointer arithmetic?
Looks like a bug... Comments?
Kenneth