From: P. T. <uml...@ya...> - 2004-06-15 20:33:29
|
Hi, I am trying to do a mmap from the UML kernel to UML user space. But the mmap in the user space returns zero. Can you please tell me why ? Here the code : User code: ---------- fd = open("/dev/mymem", O_RDWR); if (fd < 0) { perror("open - failed:"); exit (1); }; kern_ptr = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0 ); UML Kernel code: ---------------- mmap_kern(struct file *file, struct vm_area_struct *vm) { int ret = -EINVAL; int size; if (vm->vm_pgoff != 0) goto out; size = vm->vm_end - vm->vm_start; if(size > mmapper_size) return(-EFAULT); if (remap_page_range(vm->vm_start, p_buf, size, vm->vm_page_prot)) goto out; ret = 0; out: return ret; } mymem_module_init() { major = register_chrdev(0, "mymem", &mem_ops); v_buf = (char *) find_iomem("my_mem_mapper", &mmapper_size); if(mmapper_size == 0) { printk("<1> find_iomem failed \n"); return(0); }; p_buf = __pa(v_buf); return 0; }; Is there any other alternative way to memory map from the UML kernel to the UML user space? Regards... __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo |