Skip to contentSkip to conversation

Problem with rtdm_mmap_to_user

Xenomai Oded Gabbay 1 participant 1 message Oct 25, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using Xenomai 2.6.1 and kernel 2.6.33 on mpc8309 (powerpc) processor.

I'm trying to map a kernel memory area to user space memory.

The call to rtdm_mmap_to_user inside the rt driver works but when I read the memory in the user space thread (rt thread), the contents of the memory area are wrong.

Here is the code in the driver:

ret = rtdm_mmap_to_user(user_info, skb, sizeof(struct rtskb),
PROT_READ|PROT_WRITE,

                                (void **)&msg->msg_iov[1].iov_base, 

NULL, NULL);

msg->msg_iov[1].iov_base is a void* which points to NULL before the call to rtdm_mmap_to_user.

The result is in msg->msg_iov[1].iov_base. The address seems good, as it in the range of the addresses of other variables in my user space thread.

In the user-space thread I do:

            void *tmp;
            tmp = msg->msg_iov[1].iov_base;
            printf("tmp = %p:%x\n", tmp, *(int *)tmp);

The results is that tmp points to the same address I got at rtdm_mmap_to_user, but the contents of tmp are wrong.

Please help me...

Thanks,
Oded