On Fri, 21 Apr 2000, Zhixu Liu wrote:

> I have a question about the share memory use mmap. (in rtlinux-2.2)
> I use the example in mmap, but what i want to know is is there is a 

mmap is for user space. Use ioremap in the kernel.

> limit of the size of share memory, for when i try to map a region
> about 1000 int, in the kernel module the computer always dead.
> 
> Following is the program i use.
> 
> ===================================
> #include <rtl.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <sys/mman.h>

Did you compile it with -D__KERNEL__ etc. ? You should not include things
like unistd.h or fcntl.h or sys/mman.h in kernel space. They are unusable
there anyway.

>       int fd = open("/dev/mem", O_RDWR);
I do not think it is supported in the kernel.

>       start = (int *)mmap(0,length*sizeof(int),PROT_READ|PROT_WRITE,
>                       MAP_SHARED,fd,BASE_ADDRESS);

Just use ioremap instead.

--
Tomek

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to