ChangeSet 1.2231.1.14, 2005/03/28 19:20:04-08:00, [EMAIL PROTECTED] [PATCH] Fix mmap of /dev/kmem Fix mmap of /dev/kmem. It cannot ever have worked before. vmalloc is still not supported because that would be more complicated. Signed-off-by: Andi Kleen <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
mem.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletion(-) diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c --- a/drivers/char/mem.c 2005-03-28 21:09:29 -08:00 +++ b/drivers/char/mem.c 2005-03-28 21:09:29 -08:00 @@ -257,6 +257,23 @@ return 0; } +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); +} + extern long vread(char *buf, char *addr, unsigned long count); extern long vwrite(char *buf, char *addr, unsigned long count); @@ -698,7 +715,6 @@ return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; } -#define mmap_kmem mmap_mem #define zero_lseek null_lseek #define full_lseek null_lseek #define write_zero write_null - To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html